mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-28 12:02:40 +00:00
36 lines
724 B
JavaScript
36 lines
724 B
JavaScript
/*\
|
|
title: $:/core/modules/parsers/newwikitextparser/rules/dash.js
|
|
type: application/javascript
|
|
module-type: wikitextrule
|
|
|
|
Wiki text run rule for HTML entities. For example:
|
|
|
|
{{{
|
|
This is an en-dash: --
|
|
|
|
This is an em-dash: ---
|
|
}}}
|
|
|
|
Dashes must be followed by whitespace in order to be distinguished from strikethrough notation (`--strikethrough--`).
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
exports.name = "dash";
|
|
|
|
exports.runParser = true;
|
|
|
|
exports.regExpString = "-{2,3}(?=\\s)";
|
|
|
|
exports.parse = function(match,isBlock) {
|
|
this.pos = match.index + match[0].length;
|
|
var dash = match[0].length === 2 ? "–" : "—";
|
|
return [$tw.Tree.Entity(dash)];
|
|
};
|
|
|
|
})();
|