Page MenuHomePhorge

D25435.1734743449.diff
No OneTemporary

D25435.1734743449.diff

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

Mime Type
text/plain
Expires
Sat, Dec 21, 01:10 (15 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1021567
Default Alt Text
D25435.1734743449.diff (1 KB)

Event Timeline