mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-12 18:30:27 +00:00
Added support for single punctuation character macro names
Punctuation characters such as !@£$%^&*() etc can be used as macro names, in which case the space after the macro name is not required
This commit is contained in:
parent
6267bdd6ee
commit
1c9ef2af45
@ -437,15 +437,15 @@ var rules = [
|
|||||||
{
|
{
|
||||||
name: "macro",
|
name: "macro",
|
||||||
match: "<<",
|
match: "<<",
|
||||||
lookaheadRegExp: /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
|
lookaheadRegExp: /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
|
||||||
handler: function(w)
|
handler: function(w)
|
||||||
{
|
{
|
||||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
var lookaheadMatch = this.lookaheadRegExp.exec(w.source),
|
||||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[1]) {
|
name = lookaheadMatch[1] || lookaheadMatch[2];
|
||||||
|
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && name) {
|
||||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||||
var name = lookaheadMatch[1];
|
insertMacroCall(w,w.output,name,lookaheadMatch[3]);
|
||||||
insertMacroCall(w,w.output,name,lookaheadMatch[2]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user