mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-26 03:51:14 -08:00
Fixed problem with wikitext macro rule selecting block mode wrongly
This commit is contained in:
parent
5cb834784a
commit
a2da94e657
1 changed files with 10 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue