1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 02:33:15 +00:00
TiddlyWiki5/core/modules/parsers/wikiparser/rules/commentblock.js

36 lines
778 B
JavaScript
Raw Normal View History

2012-12-15 11:39:58 +00:00
/*\
title: $:/core/modules/parsers/wikiparser/rules/commentblock.js
2012-12-15 11:39:58 +00:00
type: application/javascript
module-type: wikirule
2012-12-15 11:39:58 +00:00
Wiki text block rule for HTML comments. For example:
2012-12-15 11:39:58 +00:00
2012-12-22 23:09:44 +00:00
```
2012-12-15 11:39:58 +00:00
<!-- This is a comment -->
2012-12-22 23:09:44 +00:00
```
2012-12-15 11:39:58 +00:00
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "commentblock";
exports.types = {block: true};
2012-12-15 11:39:58 +00:00
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]*)\>\r?\n/mg;
2012-12-15 11:39:58 +00:00
};
2012-12-20 15:43:12 +00:00
exports.parse = function() {
2012-12-15 11:39:58 +00:00
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
// Don't return any elements
return [];
};
})();