mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-02 22:27:12 +00:00
Use double linebreaks to indicate content of a widget or html element should be parsed in block mode
Fixes #82. The old behaviour was to parse the content of a widget or html element in block mode if the opening tag was followed by a line break. The new behaviour requires two line breaks. This makes it possible to include linebreaks more liberally within wikitext, although care must still be taken to only use double line breaks when the block mode behaviour is desired. The code change here is very simple, just a single line change in html.js. Most of the other changes are to convert various single line breaks into double line breaks.
This commit is contained in:
@@ -47,8 +47,8 @@ exports.parse = function() {
|
||||
this.nextTag = null;
|
||||
// Advance the parser position to past the tag
|
||||
this.parser.pos = tag.end;
|
||||
// Check for a following linebreak
|
||||
var hasLineBreak = !tag.isSelfClosing && !!this.parseTokenRegExp(this.parser.source,this.parser.pos,/(\r?\n)/g);
|
||||
// Check for an immediately following double linebreak
|
||||
var hasLineBreak = !tag.isSelfClosing && !!this.parseTokenRegExp(this.parser.source,this.parser.pos,/(\r?\n\r?\n)/g);
|
||||
// Set whether we're in block mode
|
||||
tag.isBlock = this.is.block || hasLineBreak;
|
||||
// Parse the body if we need to
|
||||
|
||||
Reference in New Issue
Block a user