mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Fixed problem with wikitext macro rule selecting block mode wrongly
This commit is contained in:
parent
5cb834784a
commit
a2da94e657
@ -29,12 +29,22 @@ exports.regExpString = "<<(?:(?:[!@£\\$%\\^\\&\\*\\(\\)`\\~'\"\\|\\\\\\/;\\:\\.
|
||||
|
||||
exports.parse = function(match,isBlock) {
|
||||
var regExp = /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>|<)))*)>(?:(>)|(<))/mg,
|
||||
reLineBreak = /(\r?\n)/mg,
|
||||
content = [];
|
||||
regExp.lastIndex = this.pos;
|
||||
match = regExp.exec(this.source);
|
||||
if(match && match.index === this.pos) {
|
||||
this.pos = match.index + match[0].length;
|
||||
if(match[5]) {
|
||||
// Look for a line break immediately after the `><` to trigger block mode
|
||||
reLineBreak.lastIndex = this.pos;
|
||||
var lineBreakMatch = reLineBreak.exec(this.source);
|
||||
if(lineBreakMatch && lineBreakMatch.index === this.pos) {
|
||||
this.pos = lineBreakMatch.index + lineBreakMatch[0].length;
|
||||
isBlock = true;
|
||||
} else {
|
||||
isBlock = false;
|
||||
}
|
||||
// If the macro has content then parse it as a block or run
|
||||
if(isBlock) {
|
||||
content = this.parseBlocks(">>");
|
||||
|
Loading…
Reference in New Issue
Block a user