mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 03:27:18 +00:00
Avoid skipping extra whitespace in wikiparser.js (#7835)
When wikiparser parses text looking for a pragma block, it skips whitespace before looking for the next pragma. If no pragma is found, we should return the parse position to the original location so that the skipped whitespace can be parsed as a text node. This allows the attribute `join=" and "` to parse as " and " rather than "and ".
This commit is contained in:
parent
758089cbb3
commit
215bd4e015
@ -194,6 +194,7 @@ Parse any pragmas at the beginning of a block of parse text
|
|||||||
WikiParser.prototype.parsePragmas = function() {
|
WikiParser.prototype.parsePragmas = function() {
|
||||||
var currentTreeBranch = this.tree;
|
var currentTreeBranch = this.tree;
|
||||||
while(true) {
|
while(true) {
|
||||||
|
var savedPos = this.pos;
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check for the end of the text
|
// Check for the end of the text
|
||||||
@ -204,6 +205,7 @@ WikiParser.prototype.parsePragmas = function() {
|
|||||||
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
||||||
// If not, just exit
|
// If not, just exit
|
||||||
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
||||||
|
this.pos = savedPos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Process the pragma rule
|
// Process the pragma rule
|
||||||
|
Loading…
Reference in New Issue
Block a user