diff --git a/docs/Plugins/FancyPants/Synopsis.md b/docs/Plugins/FancyPants/Synopsis.md index 52e283852a..1fecd00f72 100644 --- a/docs/Plugins/FancyPants/Synopsis.md +++ b/docs/Plugins/FancyPants/Synopsis.md @@ -55,8 +55,8 @@ echo $html; MathSymbols - a != b. 2" x 4" planks. - a ≠ b. 2″ × 4″ planks. + 2" x 4". a != b. apples =/= oranges. + 2″ × 4″. a ≠ b. apples ≠ oranges. Punctuation diff --git a/src/Plugins/FancyPants/Parser.js b/src/Plugins/FancyPants/Parser.js index 531fadaa10..049f103e86 100644 --- a/src/Plugins/FancyPants/Parser.js +++ b/src/Plugins/FancyPants/Parser.js @@ -104,18 +104,20 @@ function parseGuillemets() /** * Parse the not equal sign +* +* Supports != and =/= */ function parseNotEqualSign() { - if (text.indexOf('!=') < 0) + if (text.indexOf('!=') < 0 && text.indexOf('=/=') < 0) { return; } - var m, regexp = /\b !=(?= \b)/g; + var m, regexp = /\b (?:!|=\/)=(?= \b)/g; while (m = regexp.exec(text)) { - addTag(+m['index'] + 1, 2, "\u2260"); + addTag(+m['index'] + 1, m[0].length - 1, "\u2260"); } } diff --git a/src/Plugins/FancyPants/Parser.php b/src/Plugins/FancyPants/Parser.php index c2ffcfc616..e857c400bb 100644 --- a/src/Plugins/FancyPants/Parser.php +++ b/src/Plugins/FancyPants/Parser.php @@ -151,20 +151,22 @@ protected function parseGuillemets() /** * Parse the not equal sign * + * Supports != and =/= + * * @return void */ protected function parseNotEqualSign() { - if (strpos($this->text, '!=') === false) + if (strpos($this->text, '!=') === false && strpos($this->text, '=/=') === false) { return; } - $regexp = '/\\b !=(?= \\b)/'; + $regexp = '/\\b (?:!|=\\/)=(?= \\b)/'; preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE); foreach ($matches[0] as $m) { - $this->addTag($m[1] + 1, 2, "\xE2\x89\xA0"); + $this->addTag($m[1] + 1, strlen($m[0]) - 1, "\xE2\x89\xA0"); } } diff --git a/tests/Plugins/FancyPants/ParserTest.php b/tests/Plugins/FancyPants/ParserTest.php index 25fb4cde3f..8555e3e7e8 100644 --- a/tests/Plugins/FancyPants/ParserTest.php +++ b/tests/Plugins/FancyPants/ParserTest.php @@ -199,6 +199,10 @@ function ($configurator) 'apples != oranges', 'apples != oranges' ], + [ + 'apples =/= oranges', + 'apples =/= oranges' + ], [ 'apples != oranges', 'apples != oranges',