mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-28 04:19:56 +00:00
Replace ubertransclude widget with transclude widget
This commit is contained in:
parent
aac2d6ccb0
commit
886c8620f5
@ -21,7 +21,7 @@ var BinaryParser = function(type,text,options) {
|
||||
type: "element",
|
||||
tag: "p",
|
||||
children: [{
|
||||
type: "ubertransclude",
|
||||
type: "transclude",
|
||||
attributes: {
|
||||
"$tiddler": {type: "string", value: BINARY_WARNING_MESSAGE}
|
||||
}
|
||||
@ -36,7 +36,7 @@ var BinaryParser = function(type,text,options) {
|
||||
download: {type: "indirect", textReference: "!!title"}
|
||||
},
|
||||
children: [{
|
||||
type: "ubertransclude",
|
||||
type: "transclude",
|
||||
attributes: {
|
||||
"$tiddler": {type: "string", value: EXPORT_BUTTON_IMAGE}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ exports.parse = function() {
|
||||
params = this.match[3] ? this.match[3].split("|") : [];
|
||||
// Prepare the transclude widget
|
||||
var transcludeNode = {
|
||||
type: "ubertransclude",
|
||||
type: "transclude",
|
||||
attributes: {},
|
||||
isBlock: true
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ exports.parse = function() {
|
||||
params = this.match[3] ? this.match[3].split("|") : [];
|
||||
// Prepare the transclude widget
|
||||
var transcludeNode = {
|
||||
type: "ubertransclude",
|
||||
type: "transclude",
|
||||
attributes: {}
|
||||
};
|
||||
$tw.utils.each(params,function(paramValue,index) {
|
||||
|
@ -13,7 +13,7 @@ Widget for definition of transclusion parameters
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget,
|
||||
UberTranscludeWidget = require("$:/core/modules/widgets/ubertransclude.js").ubertransclude;
|
||||
TranscludeWidget = require("$:/core/modules/widgets/transclude.js").transclude;
|
||||
|
||||
var ParametersWidget = function(parseTreeNode,options) {
|
||||
// Initialise
|
||||
@ -44,7 +44,7 @@ ParametersWidget.prototype.execute = function() {
|
||||
var self = this;
|
||||
// Find the parent transclusion
|
||||
var transclusionWidget = this.parentWidget;
|
||||
while(transclusionWidget && !(transclusionWidget instanceof UberTranscludeWidget)) {
|
||||
while(transclusionWidget && !(transclusionWidget instanceof TranscludeWidget)) {
|
||||
transclusionWidget = transclusionWidget.parentWidget;
|
||||
}
|
||||
// Process each parameter
|
||||
|
@ -13,7 +13,7 @@ Widget for definition of slots within transcluded content. The values provided b
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget,
|
||||
UberTranscludeWidget = require("$:/core/modules/widgets/ubertransclude.js").ubertransclude;
|
||||
TranscludeWidget = require("$:/core/modules/widgets/transclude.js").transclude;
|
||||
|
||||
var SlotWidget = function(parseTreeNode,options) {
|
||||
// Initialise
|
||||
@ -45,7 +45,7 @@ SlotWidget.prototype.execute = function() {
|
||||
this.slotName = this.getAttribute("$name");
|
||||
// Find the parent transclusion
|
||||
var transclusionWidget = this.parentWidget;
|
||||
while(transclusionWidget && !(transclusionWidget instanceof UberTranscludeWidget)) {
|
||||
while(transclusionWidget && !(transclusionWidget instanceof TranscludeWidget)) {
|
||||
transclusionWidget = transclusionWidget.parentWidget;
|
||||
}
|
||||
// Get the parse tree nodes comprising the slot contents
|
||||
|
@ -1,208 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/ubertransclude.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Ubertransclude widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var UberTranscludeWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
UberTranscludeWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
UberTranscludeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
UberTranscludeWidget.prototype.execute = function() {
|
||||
var self = this;
|
||||
// Get our parameters
|
||||
this.transcludeVariable = this.getAttribute("$variable");
|
||||
this.transcludeType = this.getAttribute("$type");
|
||||
this.transcludeTitle = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
||||
this.transcludeSubTiddler = this.getAttribute("$subtiddler");
|
||||
this.transcludeField = this.getAttribute("$field");
|
||||
this.transcludeIndex = this.getAttribute("$index");
|
||||
this.transcludeMode = this.getAttribute("$mode");
|
||||
this.recursionMarker = this.getAttribute("$recursionMarker","yes");
|
||||
// Collect the string parameters
|
||||
this.stringParametersByName = Object.create(null);
|
||||
$tw.utils.each(this.attributes,function(value,name) {
|
||||
if(name.charAt(0) === "$") {
|
||||
if(name.charAt(1) === "$") {
|
||||
// Attributes starting $$ represent parameters starting with a single $
|
||||
name = name.slice(1);
|
||||
} else {
|
||||
// Attributes starting with a single $ are reserved for the widget
|
||||
return;
|
||||
}
|
||||
}
|
||||
self.stringParametersByName[name] = value;
|
||||
});
|
||||
// Collect the value widgets in our child parse tree
|
||||
this.slotValueParseTrees = Object.create(null);
|
||||
var noValueWidgetsFound = true,
|
||||
searchParseTreeNodes = function(nodes) {
|
||||
$tw.utils.each(nodes,function(node) {
|
||||
if(node.type === "value" && node.tag === "$value") {
|
||||
if(node.attributes["$name"] && node.attributes["$name"].type === "string") {
|
||||
var slotValueName = node.attributes["$name"].value;
|
||||
self.slotValueParseTrees[slotValueName] = node.children;
|
||||
}
|
||||
noValueWidgetsFound = false;
|
||||
} else {
|
||||
searchParseTreeNodes(node.children);
|
||||
}
|
||||
});
|
||||
};
|
||||
searchParseTreeNodes(this.parseTreeNode.children);
|
||||
if(noValueWidgetsFound) {
|
||||
this.slotValueParseTrees["ts-missing"] = this.parseTreeNode.children;
|
||||
}
|
||||
// Parse the text reference
|
||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||
if(this.transcludeMode === "inline") {
|
||||
parseAsInline = true;
|
||||
} else if(this.transcludeMode === "block") {
|
||||
parseAsInline = false;
|
||||
}
|
||||
var parser;
|
||||
if(this.transcludeVariable) {
|
||||
parser = this.wiki.parseText(this.transcludeType,this.getVariable(this.transcludeVariable,""),{parseAsInline: !this.parseTreeNode.isBlock});
|
||||
} else {
|
||||
parser = this.wiki.parseTextReference(
|
||||
this.transcludeTitle,
|
||||
this.transcludeField,
|
||||
this.transcludeIndex,
|
||||
{
|
||||
parseAsInline: parseAsInline,
|
||||
subTiddler: this.transcludeSubTiddler
|
||||
});
|
||||
}
|
||||
var parseTreeNodes = parser ? parser.tree : (this.slotValueParseTrees["ts-missing"] || []);
|
||||
this.sourceText = parser ? parser.source : undefined;
|
||||
this.parserType = parser? parser.type : undefined;
|
||||
// Wrap the transcluded content if required
|
||||
if(this.slotValueParseTrees["ts-wrapper"]) {
|
||||
this.slotValueParseTrees["ts-wrapped"] = parseTreeNodes;
|
||||
parseTreeNodes = this.slotValueParseTrees["ts-wrapper"];
|
||||
this.sourceTest = undefined;
|
||||
this.sourceType = undefined;
|
||||
}
|
||||
// Set context variables for recursion detection
|
||||
var recursionMarker = this.makeRecursionMarker();
|
||||
if(this.recursionMarker === "yes") {
|
||||
this.setVariable("ubertransclusion",recursionMarker);
|
||||
}
|
||||
// Check for recursion
|
||||
if(parser) {
|
||||
if(this.parentWidget && this.parentWidget.hasVariable("ubertransclusion",recursionMarker)) {
|
||||
parseTreeNodes = [{type: "element", tag: "span", attributes: {
|
||||
"class": {type: "string", value: "tc-error"}
|
||||
}, children: [
|
||||
{type: "text", text: $tw.language.getString("Error/RecursiveTransclusion")}
|
||||
]}];
|
||||
}
|
||||
}
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
};
|
||||
|
||||
/*
|
||||
Fetch the value of a parameter
|
||||
*/
|
||||
UberTranscludeWidget.prototype.getTransclusionParameter = function(name,index,defaultValue) {
|
||||
if(name in this.stringParametersByName) {
|
||||
return this.stringParametersByName[name];
|
||||
} else {
|
||||
var name = "" + index;
|
||||
if(name in this.stringParametersByName) {
|
||||
return this.stringParametersByName[name];
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Fetch the value of a parameter identified by its position
|
||||
*/
|
||||
UberTranscludeWidget.prototype.getTransclusionParameterByPosition = function(index,defaultValue) {
|
||||
if(index in this.stringParametersByPosition) {
|
||||
return this.stringParametersByPosition[index];
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Fetch the value of a slot
|
||||
*/
|
||||
UberTranscludeWidget.prototype.getTransclusionSlotValue = function(name,defaultParseTreeNodes) {
|
||||
if(name && this.slotValueParseTrees[name]) {
|
||||
return this.slotValueParseTrees[name];
|
||||
} else {
|
||||
return defaultParseTreeNodes || [];
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
|
||||
*/
|
||||
UberTranscludeWidget.prototype.makeRecursionMarker = function() {
|
||||
var attributes = Object.create(null);
|
||||
$tw.utils.each(this.attributes,function(value,name) {
|
||||
attributes[name] = value;
|
||||
});
|
||||
var output = [];
|
||||
output.push("{");
|
||||
output.push(this.getVariable("currentTiddler",{defaultValue: ""}));
|
||||
output.push("|");
|
||||
output.push(JSON.stringify(attributes));
|
||||
output.push("}");
|
||||
return output.join("");
|
||||
};
|
||||
|
||||
UberTranscludeWidget.prototype.parserNeedsRefresh = function() {
|
||||
var parserInfo = this.wiki.getTextReferenceParserInfo(this.transcludeTitle,this.transcludeField,this.transcludeIndex,{subTiddler:this.transcludeSubTiddler});
|
||||
return (this.sourceText === undefined || parserInfo.sourceText !== this.sourceText || parserInfo.parserType !== this.parserType)
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
UberTranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(($tw.utils.count(changedAttributes) > 0) || (changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
}
|
||||
};
|
||||
|
||||
exports.ubertransclude = UberTranscludeWidget;
|
||||
|
||||
})();
|
@ -3,7 +3,7 @@ title: $:/core/modules/widgets/value.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Sub-widget used by the ubertransclude widget for specifying values for slots within transcluded content. It doesn't do anything by itself because the ubertransclude widget only ever deals with the parse tree nodes, and doesn't instantiate the widget itself
|
||||
Sub-widget used by the transclude widget for specifying values for slots within transcluded content. It doesn't do anything by itself because the transclude widget only ever deals with the parse tree nodes, and doesn't instantiate the widget itself
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
@ -391,10 +391,10 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
|
||||
options = options || {};
|
||||
// Check whether this node type is defined by a custom macro definition
|
||||
var variableDefinitionName = "<$" + parseTreeNode.type + ">";
|
||||
if(parseTreeNode.type !== "ubertransclude" && this.variables[variableDefinitionName] && this.variables[variableDefinitionName].value) {
|
||||
if(parseTreeNode.type !== "transclude" && this.variables[variableDefinitionName] && this.variables[variableDefinitionName].value) {
|
||||
var newParseTreeNode = {
|
||||
type: "ubertransclude",
|
||||
tag: "$ubertransclude",
|
||||
type: "transclude",
|
||||
tag: "$transclude",
|
||||
attributes: {
|
||||
"$variable": {name: "$variable", type: "string", value: variableDefinitionName}
|
||||
},
|
||||
@ -436,7 +436,7 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
|
||||
]
|
||||
};
|
||||
$tw.utils.each(parseTreeNode.attributes,function(attr) {
|
||||
// If the attribute starts with a dollar then add an extra dollar so that it doesn't clash with the $xxx attributes of ubertransclude
|
||||
// If the attribute starts with a dollar then add an extra dollar so that it doesn't clash with the $xxx attributes of transclude
|
||||
var name = attr.name.charAt(0) === "$" ? "$" + attr.name : attr.name,
|
||||
newAttr = {
|
||||
name: name,
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/CustomWidget/ActionWidget
|
||||
title: Transclude/CustomWidget/ActionWidget
|
||||
description: Custom widget definition
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,8 +6,8 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='Result'>
|
||||
</$ubertransclude>
|
||||
<$transclude $tiddler='Result'>
|
||||
</$transclude>
|
||||
_
|
||||
title: Actions
|
||||
|
@ -0,0 +1,35 @@
|
||||
title: Transclude/CustomWidget/OverrideTransclude
|
||||
description: Custom widget definition attempting to override transclude
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerZero
|
||||
|
||||
Antelope
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<!-- Redefine the <$transclude> widget by defining a transcludable variable with that name -->
|
||||
<$set name="<$transclude>" value="""\whitespace trim
|
||||
<$parameters one='Jaguar'>
|
||||
<$text text=<<one>>/>
|
||||
<$slot $name="body">
|
||||
Whale
|
||||
</$slot>
|
||||
</$parameters>"""
|
||||
>
|
||||
<$transclude $tiddler="TiddlerZero">
|
||||
Crocodile
|
||||
</$transclude>
|
||||
</$set>
|
||||
_
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Antelope</p>
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/CustomWidget/Simple
|
||||
title: Transclude/CustomWidget/Simple
|
||||
description: Custom widget definition
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,8 +6,8 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$ubertransclude>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/CustomWidget/TextWidgetOverride
|
||||
title: Transclude/CustomWidget/TextWidgetOverride
|
||||
description: Custom widget definition redefining the text widget
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,8 +6,8 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne'>
|
||||
</$ubertransclude>
|
||||
<$transclude $tiddler='TiddlerOne'>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/CustomWidget/VariableAttribute
|
||||
title: Transclude/CustomWidget/VariableAttribute
|
||||
description: Custom widget definition using an attribute called $variable
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,8 +6,8 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$ubertransclude>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/MissingTarget
|
||||
title: Transclude/MissingTarget
|
||||
description: Transcluding a missing target
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,34 +6,34 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
<$parameters one='Ferret'>
|
||||
Badger
|
||||
<$text text=<<one>>/>
|
||||
</$parameters>
|
||||
</$ubertransclude>
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$transclude>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
<$value $name="ts-missing">
|
||||
<$parameters one='Ferret'>
|
||||
Badger
|
||||
<$text text=<<one>>/>
|
||||
</$parameters>
|
||||
</$value>
|
||||
</$ubertransclude>
|
||||
<$ubertransclude $tiddler='MissingTiddler' one='Ferret'>
|
||||
</$transclude>
|
||||
<$transclude $tiddler='MissingTiddler' one='Ferret'>
|
||||
<$parameters one='Ferret'>
|
||||
Badger
|
||||
<$text text=<<one>>/>
|
||||
</$parameters>
|
||||
</$ubertransclude>
|
||||
<$ubertransclude $tiddler='MissingTiddler' one='Ferret'>
|
||||
</$transclude>
|
||||
<$transclude $tiddler='MissingTiddler' one='Ferret'>
|
||||
<$value $name="ts-missing">
|
||||
<$parameters one='Ferret'>
|
||||
Badger
|
||||
<$text text=<<one>>/>
|
||||
</$parameters>
|
||||
</$value>
|
||||
</$ubertransclude>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/Parameterised/Positional/Shortcut
|
||||
title: Transclude/Parameterised/Positional/Shortcut
|
||||
description: Positional parameterised transclusion using shortcut syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -21,7 +21,7 @@ title: TiddlerTwo
|
||||
|
||||
\whitespace trim
|
||||
<$parameters zero='Mouse' one='Horse' two='Owl'>
|
||||
(<$ubertransclude zero=<<zero>> one=<<one>> two=<<two>>/>)
|
||||
(<$transclude $tiddler=<<currentTiddler>> zero=<<zero>> one=<<one>> two=<<two>>/>)
|
||||
</$parameters>
|
||||
_
|
||||
title: ExpectedResult
|
@ -0,0 +1,26 @@
|
||||
title: Transclude/Parameterised/Positional
|
||||
description: Positional parameterised transclusion
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$transclude $tiddler='TiddlerOne' zero='Ferret'/>
|
||||
<$transclude zero='Ferret' $tiddler='TiddlerOne'/>
|
||||
<$transclude $tiddler='TiddlerOne' 0='Pigeon'/>
|
||||
<$transclude 0='Pigeon' $tiddler='TiddlerOne'/>
|
||||
<$transclude $tiddler='TiddlerOne' zero='Ferret' 0='Pigeon'/>
|
||||
<$transclude zero='Ferret' 0='Pigeon' $tiddler='TiddlerOne'/>
|
||||
<$transclude $tiddler='TiddlerOne'/>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<$parameters zero='Jaguar'>
|
||||
<$text text=<<zero>>/>
|
||||
</$parameters>
|
||||
_
|
||||
title: ExpectedResult
|
||||
|
||||
<p>FerretFerretPigeonPigeonFerretFerretJaguar</p>
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/Parameterised/Simple
|
||||
title: Transclude/Parameterised/Simple
|
||||
description: Simple parameterised transclusion
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,8 +6,8 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'/>
|
||||
<$ubertransclude $tiddler='TiddlerOne'/>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'/>
|
||||
<$transclude $tiddler='TiddlerOne'/>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/Parameterised/Slotted/Missing
|
||||
title: Transclude/Parameterised/Slotted/Missing
|
||||
description: Parameterised transclusion with slotted missing values
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,8 +6,8 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$ubertransclude>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,4 +1,4 @@
|
||||
title: Ubertransclude/Parameterised/Slotted
|
||||
title: Transclude/Parameterised/Slotted
|
||||
description: Parameterised transclusion with slotted values
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
@ -6,11 +6,11 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
<$value $name="content">
|
||||
Hippopotamus
|
||||
</$value>
|
||||
</$ubertransclude>
|
||||
</$transclude>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
@ -1,35 +0,0 @@
|
||||
title: Ubertransclude/CustomWidget/OverrideUbertransclude
|
||||
description: Custom widget definition attempting to override ubertransclude
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$ubertransclude>
|
||||
_
|
||||
title: TiddlerZero
|
||||
|
||||
Antelope
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<!-- Redefine the <$ubertransclude> widget by defining a transcludable variable with that name -->
|
||||
<$set name="<$ubertransclude>" value="""\whitespace trim
|
||||
<$parameters one='Jaguar'>
|
||||
<$text text=<<one>>/>
|
||||
<$slot $name="body">
|
||||
Whale
|
||||
</$slot>
|
||||
</$parameters>"""
|
||||
>
|
||||
<$ubertransclude $tiddler="TiddlerZero">
|
||||
Crocodile
|
||||
</$ubertransclude>
|
||||
</$set>
|
||||
_
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Antelope</p>
|
@ -1,26 +0,0 @@
|
||||
title: Ubertransclude/Parameterised/Positional
|
||||
description: Positional parameterised transclusion
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$ubertransclude $tiddler='TiddlerOne' zero='Ferret'/>
|
||||
<$ubertransclude zero='Ferret' $tiddler='TiddlerOne'/>
|
||||
<$ubertransclude $tiddler='TiddlerOne' 0='Pigeon'/>
|
||||
<$ubertransclude 0='Pigeon' $tiddler='TiddlerOne'/>
|
||||
<$ubertransclude $tiddler='TiddlerOne' zero='Ferret' 0='Pigeon'/>
|
||||
<$ubertransclude zero='Ferret' 0='Pigeon' $tiddler='TiddlerOne'/>
|
||||
<$ubertransclude $tiddler='TiddlerOne'/>
|
||||
_
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<$parameters zero='Jaguar'>
|
||||
<$text text=<<zero>>/>
|
||||
</$parameters>
|
||||
_
|
||||
title: ExpectedResult
|
||||
|
||||
<p>FerretFerretPigeonPigeonFerretFerretJaguar</p>
|
Loading…
Reference in New Issue
Block a user