Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2629347
D25435.1732041832.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25435.1732041832.diff
View Options
diff --git a/src/utils/PhutilCowsay.php b/src/utils/PhutilCowsay.php
--- a/src/utils/PhutilCowsay.php
+++ b/src/utils/PhutilCowsay.php
@@ -71,14 +71,19 @@
$template);
}
- $template = preg_replace_callback(
+ $token_patterns = array(
'/\\$([a-z]+)/',
- array($this, 'replaceTemplateVariable'),
- $template);
- if ($template === false) {
- throw new Exception(
- pht(
- 'Failed to replace template variables while rendering cow!'));
+ '/\\${([a-z]+)}/',
+ );
+ foreach ($token_patterns as $token_pattern) {
+ $template = preg_replace_callback(
+ $token_pattern,
+ array($this, 'replaceTemplateVariable'),
+ $template);
+ if ($template === false) {
+ throw new Exception(
+ pht('Failed to replace template variables while rendering cow!'));
+ }
}
$lines = $this->text;
diff --git a/src/utils/__tests__/cowsay/sheep.expect b/src/utils/__tests__/cowsay/sheep.expect
new file mode 100644
--- /dev/null
+++ b/src/utils/__tests__/cowsay/sheep.expect
@@ -0,0 +1,11 @@
+ __________________
+< How are my eyes? >
+ ------------------
+ \
+ \
+ __
+ UooU\.'@@@@@@`.
+ \__/(@@@@@@@@@@)
+ (@@@@@@@@)
+ `YY~~~~YY'
+ || ||
diff --git a/src/utils/__tests__/cowsay/sheep.test b/src/utils/__tests__/cowsay/sheep.test
new file mode 100644
--- /dev/null
+++ b/src/utils/__tests__/cowsay/sheep.test
@@ -0,0 +1,13 @@
+ $thoughts
+ $thoughts
+ __
+ U${eyes}U\.'@@@@@@`.
+ \__/(@@@@@@@@@@)
+ (@@@@@@@@)
+ `YY~~~~YY'
+ || ||
+~~~~~~~~~~
+{
+ "text": "How are my eyes?",
+ "eyes": "oo"
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 18:43 (20 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
978538
Default Alt Text
D25435.1732041832.diff (1 KB)
Attached To
Mode
D25435: Fix rendering of cowsay sheep.cow
Attached
Detach File
Event Timeline
Log In to Comment