1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00
TiddlyWiki5/core/modules/parsers/wikiparser/rules/horizrule.js

35 lines
603 B
JavaScript

/*\
title: $:/core/modules/parsers/wikiparser/rules/horizrule.js
type: application/javascript
module-type: wikirule
Wiki text block rule for rules. For example:
```
---
```
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "horizrule";
exports.types = {block: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /-{3,}\r?(?:\n|$)/mg;
};
exports.parse = function() {
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
return [{type: "element", tag: "hr"}];
};
})();