From 19aac8e8d3be3676cbe8e064f38f428c67c451c3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 4 May 2016 18:42:47 -0700 Subject: [PATCH] Pass the new default syntax highlighting map to the remarkup engine Summary: Ref T9790. This passes the map down so we can generate highlighted mail. Test Plan: Generated this relatively respectable-looking HTML mail: {F1258558} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9790 Differential Revision: https://secure.phabricator.com/D15848 --- .../markup/PhabricatorMarkupEngine.php | 4 ++++ .../syntax/PhabricatorSyntaxStyle.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php index f570ee7e51..92e027f86d 100644 --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -480,6 +480,10 @@ final class PhabricatorMarkupEngine extends Phobject { 'syntax-highlighter.engine', $options['syntax-highlighter.engine']); + $style_map = id(new PhabricatorDefaultSyntaxStyle()) + ->getRemarkupStyleMap(); + $engine->setConfig('phutil.codeblock.style-map', $style_map); + $engine->setConfig('uri.full', $options['uri.full']); $rules = array(); diff --git a/src/infrastructure/syntax/PhabricatorSyntaxStyle.php b/src/infrastructure/syntax/PhabricatorSyntaxStyle.php index c61210d06b..3f75f5c639 100644 --- a/src/infrastructure/syntax/PhabricatorSyntaxStyle.php +++ b/src/infrastructure/syntax/PhabricatorSyntaxStyle.php @@ -27,4 +27,18 @@ abstract class PhabricatorSyntaxStyle extends Phobject { ->execute(); } + final public function getRemarkupStyleMap() { + $map = array( + 'rbw_r' => 'color: red', + 'rbw_o' => 'color: orange', + 'rbw_y' => 'color: yellow', + 'rbw_g' => 'color: green', + 'rbw_b' => 'color: blue', + 'rbw_i' => 'color: indigo', + 'rbw_v' => 'color: violet', + ); + + return $map + $this->getStyleMap(); + } + }