Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
index 0f4b9818da..c537ded05b 100644
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
@@ -1,93 +1,93 @@
<?php
final class PhabricatorRemarkupCowsayBlockInterpreter
extends PhutilRemarkupBlockInterpreter
implements RemarkupSyntaxDocumentationProvider {
public function getInterpreterName() {
return 'cowsay';
}
public function markupContent($content, array $argv) {
$action = idx($argv, 'think') ? 'think' : 'say';
$eyes = idx($argv, 'eyes', 'oo');
$tongue = idx($argv, 'tongue', ' ');
$map = self::getCowMap();
$cow = idx($argv, 'cow');
$cow = phutil_utf8_strtolower($cow);
if (empty($map[$cow])) {
$cow = 'default';
}
$result = id(new PhutilCowsay())
->setTemplate($map[$cow])
->setAction($action)
->setEyes($eyes)
->setTongue($tongue)
->setText($content)
->renderCow();
$engine = $this->getEngine();
if ($engine->isTextMode()) {
return $result;
}
if ($engine->isHTMLMailMode()) {
return phutil_tag('pre', array(), $result);
}
return phutil_tag(
'div',
array(
'class' => 'PhabricatorMonospaced remarkup-cowsay',
),
$result);
}
private static function getCowMap() {
$root = dirname(phutil_get_library_root('phabricator'));
$directories = array(
$root.'/externals/cowsay/cows/',
$root.'/resources/cows/builtin/',
$root.'/resources/cows/custom/',
);
$map = array();
foreach ($directories as $directory) {
foreach (Filesystem::listDirectory($directory, false) as $cow_file) {
$matches = null;
if (!preg_match('/^(.*)\.cow\z/', $cow_file, $matches)) {
continue;
}
$cow_name = $matches[1];
$cow_name = phutil_utf8_strtolower($cow_name);
$map[$cow_name] = Filesystem::readFile($directory.$cow_file);
}
}
return $map;
}
public function getDocumentation() {
return <<<EOT
= Cowsay
Cowsay is an application by Tony Monroe which has been ported over to
Phabricator/Phorge to allow your comments to be voiced by
a cow.
A basic example of using cowsay would be to add a comment
cowsay{{{Why don't they play poker in the jungle? Too many cheetahs}}}
which generates:
cowsay{{{Why don't they play poker in the jungle? Too many cheetahs}}}
-More information about Cowsay can be found [[/reference/cowsay/ | here]]
+[[/reference/cowsay/ | More information about Cowsay]] is available.
EOT;
}
}
diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php
index 87ac14d1fc..d959b3cc42 100644
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php
@@ -1,87 +1,87 @@
<?php
final class PhabricatorRemarkupFigletBlockInterpreter
extends PhutilRemarkupBlockInterpreter
implements RemarkupSyntaxDocumentationProvider {
public function getInterpreterName() {
return 'figlet';
}
/**
* @phutil-external-symbol class Text_Figlet
*/
public function markupContent($content, array $argv) {
$map = self::getFigletMap();
$font = idx($argv, 'font');
$font = phutil_utf8_strtolower($font);
if (empty($map[$font])) {
$font = 'standard';
}
$root = dirname(phutil_get_library_root('phabricator'));
require_once $root.'/externals/pear-figlet/Text/Figlet.php';
$figlet = new Text_Figlet();
$figlet->loadFont($map[$font]);
$result = $figlet->lineEcho($content);
$engine = $this->getEngine();
if ($engine->isTextMode()) {
return $result;
}
if ($engine->isHTMLMailMode()) {
return phutil_tag('pre', array(), $result);
}
return phutil_tag(
'div',
array(
'class' => 'PhabricatorMonospaced remarkup-figlet',
),
$result);
}
private static function getFigletMap() {
$root = dirname(phutil_get_library_root('phabricator'));
$dirs = array(
$root.'/externals/figlet/fonts/',
$root.'/externals/pear-figlet/fonts/',
$root.'/resources/figlet/custom/',
);
$map = array();
foreach ($dirs as $dir) {
foreach (Filesystem::listDirectory($dir, false) as $file) {
if (preg_match('/\.flf\z/', $file)) {
$name = phutil_utf8_strtolower($file);
$name = preg_replace('/\.flf\z/', '', $name);
$map[$name] = $dir.$file;
}
}
}
return $map;
}
public function getDocumentation() {
return <<<EOT
= Figlet
The `figlet` interpreter allows you to write some large text.
For example, this:
```figlet{{{Some big text!}}}```
...produces this:
figlet{{{Some big text!}}}
-More information about Figlet can be found [[/reference/figlet/ | here]]
+[[/reference/figlet/ | More information about Figlet]] is available.
EOT;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 12:25 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1092
Default Alt Text
(5 KB)

Event Timeline