mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-07-04 03:03:18 +00:00
Refactor parse mode out of getTransclusionTarget
This commit is contained in:
parent
c1ff85c205
commit
c4fc3168d1
|
@ -41,8 +41,15 @@ TranscludeWidget.prototype.execute = function() {
|
||||||
this.collectAttributes();
|
this.collectAttributes();
|
||||||
this.collectStringParameters();
|
this.collectStringParameters();
|
||||||
this.collectSlotFillParameters();
|
this.collectSlotFillParameters();
|
||||||
|
// Determine whether we're being used in inline or block mode
|
||||||
|
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||||
|
if(this.transcludeMode === "inline") {
|
||||||
|
parseAsInline = true;
|
||||||
|
} else if(this.transcludeMode === "block") {
|
||||||
|
parseAsInline = false;
|
||||||
|
}
|
||||||
// Get the target text and parse tree nodes that we are transcluding
|
// Get the target text and parse tree nodes that we are transcluding
|
||||||
var target = this.getTransclusionTarget(),
|
var target = this.getTransclusionTarget(parseAsInline),
|
||||||
parseTreeNodes;
|
parseTreeNodes;
|
||||||
this.sourceText = target.text;
|
this.sourceText = target.text;
|
||||||
this.parserType = target.type;
|
this.parserType = target.type;
|
||||||
|
@ -163,15 +170,8 @@ TranscludeWidget.prototype.collectSlotFillParameters = function() {
|
||||||
/*
|
/*
|
||||||
Get transcluded parse tree nodes as an object {text:,type:,parseTreeNodes:,parseAsInline:}
|
Get transcluded parse tree nodes as an object {text:,type:,parseTreeNodes:,parseAsInline:}
|
||||||
*/
|
*/
|
||||||
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
TranscludeWidget.prototype.getTransclusionTarget = function(parseAsInline) {
|
||||||
var self = this;
|
var self = this;
|
||||||
// Determine whether we're being used in inline or block mode
|
|
||||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
|
||||||
if(this.transcludeMode === "inline") {
|
|
||||||
parseAsInline = true;
|
|
||||||
} else if(this.transcludeMode === "block") {
|
|
||||||
parseAsInline = false;
|
|
||||||
}
|
|
||||||
var parser;
|
var parser;
|
||||||
// Get the parse tree
|
// Get the parse tree
|
||||||
if(this.hasAttribute("$variable")) {
|
if(this.hasAttribute("$variable")) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user