From a70de394e1e2820eaa5f138e4e984b62039ed406 Mon Sep 17 00:00:00 2001 From: Erik Fercak Date: Sun, 22 Dec 2013 08:45:21 -0800 Subject: [PATCH] Enable figlet to render text using custom fonts Summary: Figlet with more fonts will make Phabricator ``` _/ _/ _/ _/_/ _/ _/_/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/_/ _/_/_/ _/_/ _/_/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/_/ _/ _/_/_/ _/_/ _/ _/_/ _/_/ _/ _/ _/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ _/_/ _/_/_/ _/_/_/ ``` Test Plan: Use figlet in comment with no font/various fonts as argument (e.g. lean, script) and see preview with no errors. Reviewers: #blessed_reviewers, epriestley Reviewed By: epriestley CC: epriestley, aran Differential Revision: https://secure.phabricator.com/D7815 --- .../interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php index aae99d7dd5..9bf5a132ee 100644 --- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php +++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php @@ -13,7 +13,9 @@ final class PhabricatorRemarkupBlockInterpreterFiglet pht('Unable to locate the `figlet` binary. Install figlet.')); } - $future = id(new ExecFuture('figlet')) + $font = idx($argv, 'font', 'standard'); + $safe_font = preg_replace('/[^0-9a-zA-Z-_.]/', '', $font); + $future = id(new ExecFuture('figlet -f %s', $safe_font)) ->setTimeout(15) ->write(trim($content, "\n"));