mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-12 10:20:26 +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",
|
||||
match: "<<",
|
||||
lookaheadRegExp: /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
|
||||
lookaheadRegExp: /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
|
||||
handler: function(w)
|
||||
{
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[1]) {
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source),
|
||||
name = lookaheadMatch[1] || lookaheadMatch[2];
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && name) {
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
var name = lookaheadMatch[1];
|
||||
insertMacroCall(w,w.output,name,lookaheadMatch[2]);
|
||||
insertMacroCall(w,w.output,name,lookaheadMatch[3]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user