Hi all,
To improve my workflow a bit, I used the the dash-parser as template to
replace ->, -^, -. and -< with →, ↑, ↓ and ←, respectively. Just sharing
in case it could be useful for others!
Best,
Anders
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/649528a9-1354-4a54-9a57-2f127bd5019cn%40googlegroups.com.
created: 20201207140832569
modified: 20201207143705685
module-type: wikirule
tags:
title: $:/core/modules/parsers/wikiparser/rules/arrows.js
type: application/javascript
/*\
title: $:/core/modules/parsers/wikiparser/rules/arrows.js
type: application/javascript
module-type: wikirule
Wiki text inline rule for arrows. For example:
```
-^
-.
->
-<
```
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "arrow";
exports.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /-{1}[\<\^\>\.]{1}/mg;
};
exports.parse = function() {
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
var arrow;
switch(this.match[0].slice(-1)){
case ">":
arrow = "→";
break;
case "<":
arrow = "←";
break;
case ".":
arrow = "↓";
break;
case "^":
arrow = "↑";
break;
}
return [{
type: "entity",
entity: arrow
}];
};
})();