Page MenuHomePhorge

Fix rendering of cowsay sheep.cow

Authored by Sten on Mon, Sep 11, 10:12.
Referenced Files
Unknown Object (File)
Tue, Sep 26, 23:12
Unknown Object (File)
Mon, Sep 25, 12:48
Unknown Object (File)
Mon, Sep 25, 10:42
Unknown Object (File)
Mon, Sep 25, 05:55
Unknown Object (File)
Thu, Sep 21, 09:28
Unknown Object (File)
Mon, Sep 18, 23:11
Unknown Object (File)
Mon, Sep 18, 15:19
Unknown Object (File)
Mon, Sep 18, 06:38



In the templates of the external cowsay library, most replaceable tokens are specified as $var_name.
However, the sheep.cow and flaming-sheep.cow use the ${eyes} syntax instead. This is not recognised by PhutilCowsay.php resulting in incorrect rendering of the template.

This change updates PhutilCowsay.php to handle ${var_name} tokens as well as $var_name

___________________ < My eyes, my eyes! > ------------------- \ \ __ U${eyes}U\.'@@@@@@`. \__/(@@@@@@@@@@) (@@@@@@@@) `YY~~~~YY' || ||
Test Plan

In a Remarkup comment or document, add

cowsay(cow='sheep'){{{How do my eyes look now?}}}

When testing in differential, you don't even need to submit the comment.

Diff Detail

rARC Arcanist
Lint Not Applicable
Tests Not Applicable

Event Timeline

Sten requested review of this revision.Mon, Sep 11, 10:12

Thanks. Personally I would prefer to have these regexes in a dedicated variables, like:

$patterns = array(
foreach($patterns as $token_pattern) {


So the foreach is a bit more readable and it can be expanded in the future without the 80 chars limit

Updates as per reviews

Sten marked an inline comment as done.Mon, Sep 11, 12:39
This revision is now accepted and ready to land.Mon, Sep 11, 19:04
This revision was automatically updated to reflect the committed changes.