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
print-window-tiddler
Jeremy Ruston 2012-05-05 11:20:23 +01:00
rodzic 6267bdd6ee
commit 1c9ef2af45
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -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]);
}
}
},