2012-12-15 17:35:35 +00:00
|
|
|
/*\
|
2012-12-26 19:49:01 +00:00
|
|
|
title: $:/core/modules/parsers/wikiparser/rules/horizrule.js
|
2012-12-15 17:35:35 +00:00
|
|
|
type: application/javascript
|
2012-12-20 16:02:03 +00:00
|
|
|
module-type: wikirule
|
2012-12-15 17:35:35 +00:00
|
|
|
|
|
|
|
Wiki text block rule for rules. For example:
|
|
|
|
|
2012-12-22 23:09:44 +00:00
|
|
|
```
|
2012-12-15 17:35:35 +00:00
|
|
|
---
|
2012-12-22 23:09:44 +00:00
|
|
|
```
|
2012-12-15 17:35:35 +00:00
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
2012-12-26 19:49:01 +00:00
|
|
|
exports.name = "horizrule";
|
2012-12-20 16:02:03 +00:00
|
|
|
exports.types = {block: true};
|
2012-12-15 17:35:35 +00:00
|
|
|
|
|
|
|
exports.init = function(parser) {
|
|
|
|
this.parser = parser;
|
|
|
|
// Regexp to match
|
2013-12-25 22:06:42 +00:00
|
|
|
this.matchRegExp = /-{3,}\r?(?:\n|$)/mg;
|
2012-12-15 17:35:35 +00:00
|
|
|
};
|
|
|
|
|
2012-12-20 15:43:12 +00:00
|
|
|
exports.parse = function() {
|
2012-12-15 17:35:35 +00:00
|
|
|
// Move past the match
|
|
|
|
this.parser.pos = this.matchRegExp.lastIndex;
|
|
|
|
return [{type: "element", tag: "hr"}];
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|