1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-05 03:33:27 +00:00
TiddlyWiki5/core/modules/parsers/wikiparser/rules/comment.js
2012-12-22 23:09:44 +00:00

36 lines
765 B
JavaScript

/*\
title: $:/core/modules/parsers/wikiparser/rules/comment.js
type: application/javascript
module-type: wikirule
Wiki text inline 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.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match - HTML comment regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html
this.matchRegExp = /\<![ \r\n\t]*(?:--(?:[^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>/mg;
};
exports.parse = function() {
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
// Don't return any elements
return [];
};
})();