mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-11 21:14:02 +00:00
Added wikitext for m- and n-dashes
This commit is contained in:
28
core/modules/parsers/newwikitextparser/rules/dash.js
Normal file
28
core/modules/parsers/newwikitextparser/rules/dash.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/newwikitextparser/rules/dash.js
|
||||
type: application/javascript
|
||||
module-type: wikitextrule
|
||||
|
||||
Wiki text run rule for HTML entities
|
||||
|
||||
\*/
|
||||
(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;
|
||||
match = /(-{2,3})/mg.exec(match[0]);
|
||||
var dash = match[0].length === 2 ? "–" : "—";
|
||||
return [$tw.Tree.Entity(dash)];
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user