From 9ab9c9cc428c87065bdced505e29f6054b17edd3 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 5 Jun 2012 15:00:55 +0100 Subject: [PATCH] Added run rule for HTML entities --- .../parsers/newwikitextparser/rules/entity.js | 26 +++++++++++++++++++ tw5.com/tiddlers/TestingNewWikiText.tid | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 core/modules/parsers/newwikitextparser/rules/entity.js diff --git a/core/modules/parsers/newwikitextparser/rules/entity.js b/core/modules/parsers/newwikitextparser/rules/entity.js new file mode 100644 index 000000000..3a1578a47 --- /dev/null +++ b/core/modules/parsers/newwikitextparser/rules/entity.js @@ -0,0 +1,26 @@ +/*\ +title: $:/core/modules/parsers/newwikitextparser/rules/entity.js +type: application/javascript +module-type: wikitextrule + +Wiki text run rule for HTML entities + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports.name = "entity"; + +exports.runParser = true; + +exports.regExpString = "&#?[a-zA-Z0-9]{2,8};"; + +exports.parse = function(match,isBlock) { + this.pos = match.index + match[0].length; + return [$tw.Tree.Entity(match[0])]; +}; + +})(); diff --git a/tw5.com/tiddlers/TestingNewWikiText.tid b/tw5.com/tiddlers/TestingNewWikiText.tid index 101116c01..50a01b1b0 100644 --- a/tw5.com/tiddlers/TestingNewWikiText.tid +++ b/tw5.com/tiddlers/TestingNewWikiText.tid @@ -17,7 +17,7 @@ And this will be {{{inline and monospaced}}} and `so will this` little bit. Here is some ''bold face'', and __some underlining__ and of course some --strikethrough--. -Here's an unterminated ''bit of bold face. +Here's an unterminated ''bit of bold face. And also some entities like Ç Ç "HTML Entity". Here is a macro <>