mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-20 14:45:59 +00:00
35 lines
603 B
JavaScript
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"}];
|
|
};
|
|
|
|
})();
|