Added parser rule for HTML format comments

And try it out in the PageTemplate, which is getting pretty
unintelligable
This commit is contained in:
Jeremy Ruston
2012-08-02 22:06:52 +01:00
parent 1f64a9e758
commit 1f52b40cb6
2 changed files with 43 additions and 0 deletions
@@ -0,0 +1,33 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/rules/comment.js
type: application/javascript
module-type: wikitextrule
Wiki text run rule for HTML comments. For example:
{{{
<!-- This is a comment -->
}}}
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "comment";
exports.blockParser = true;
exports.runParser = true;
// Regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html
exports.regExpString = "\\<![ \\r\\n\\t]*(?:--(?:[^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>";
exports.parse = function(match,isBlock) {
this.pos = match.index + match[0].length;
return this.parseBlock();
};
})();