1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-06-11 15:12:24 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Jeremy Ruston 9627f2b6b2 Merge branch 'master' into polymorphic-filters 2024-06-19 18:33:31 +01:00
jeremy@jermolene.com ce0b6c40c0 Merge branch 'master' into polymorphic-filters 2022-09-02 18:23:04 +01:00
jeremy@jermolene.com dceb873ce1 More tests for type conversion 2022-09-01 11:31:56 +01:00
jeremy@jermolene.com 4a23bc5c40 Remove debugging code 2022-08-31 09:17:06 +01:00
jeremy@jermolene.com 3f68b13699 First commit 2022-08-30 18:01:46 +01:00
27 changed files with 247 additions and 165 deletions
-2
View File
@@ -104,8 +104,6 @@ ShowSideBar/Caption: show sidebar
ShowSideBar/Hint: Show sidebar
TagManager/Caption: tag manager
TagManager/Hint: Open tag manager
TestCaseImport/Caption: import tiddlers
TestCaseImport/Hint: Import tiddlers
Timestamp/Caption: timestamps
Timestamp/Hint: Choose whether modifications update timestamps
Timestamp/On/Caption: timestamps are on
+36 -5
View File
@@ -200,12 +200,20 @@ exports.parseFilter = function(filterString) {
exports.getFilterOperators = function() {
if(!this.filterOperators) {
$tw.Wiki.prototype.filterOperators = {};
$tw.modules.applyMethods("filteroperator",this.filterOperators);
$tw.Wiki.prototype.oldFilterOperators = {};
$tw.modules.applyMethods("filteroperator",this.oldFilterOperators);
$tw.Wiki.prototype.newFilterOperators = {};
$tw.modules.applyMethods("newfilteroperator",this.newFilterOperators);
$tw.Wiki.prototype.filterOperators = $tw.utils.extend({},$tw.Wiki.prototype.oldFilterOperators,$tw.Wiki.prototype.newFilterOperators);
}
return this.filterOperators;
};
exports.isFilterOperatorNew = function(name) {
this.getFilterOperators();
return name in $tw.Wiki.prototype.newFilterOperators;
};
exports.getFilterRunPrefixes = function() {
if(!this.filterRunPrefixes) {
$tw.Wiki.prototype.filterRunPrefixes = {};
@@ -214,11 +222,21 @@ exports.getFilterRunPrefixes = function() {
return this.filterRunPrefixes;
}
exports.filterTiddlers = function(filterString,widget,source) {
exports.filterTiddlersPolymorphic = function(filterString,widget,source) {
var fn = this.compileFilter(filterString);
return fn.call(this,source,widget);
};
exports.filterTiddlers = function(filterString,widget,source) {
var results = this.filterTiddlersPolymorphic(filterString,widget,source);
for(var t=0; t<results.length; t++) {
if(typeof results[t] !== "string") {
results[t] = $tw.utils.filterItemToString(results[t]);
}
}
return results;
};
/*
Compile a filter into a function with the signature fn(source,widget) where:
source: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)
@@ -255,16 +273,19 @@ exports.compileFilter = function(filterString) {
currTiddlerTitle = widget && widget.getVariable("currentTiddler");
$tw.utils.each(operation.operators,function(operator) {
var operands = [],
operatorFunction;
operatorFunction,
operatorName;
if(!operator.operator) {
// Use the "title" operator if no operator is specified
operatorFunction = filterOperators.title;
operatorName = "title";
} else if(!filterOperators[operator.operator]) {
// Unknown operators treated as "[unknown]" - at run time we can distinguish between a custom operator and falling back to the default "field" operator
operatorFunction = filterOperators["[unknown]"];
} else {
// Use the operator function
operatorFunction = filterOperators[operator.operator];
operatorName = operator.operator;
}
$tw.utils.each(operator.operands,function(operand) {
if(operand.indirect) {
@@ -277,7 +298,17 @@ exports.compileFilter = function(filterString) {
}
operands.push(operand.value);
});
// If this is a legacy monomorphic operator then wrap the accumulator source in a wrapper that converts each item to a string
if(!self.isFilterOperatorNew(operatorName)) {
var innerAccumulator = accumulator;
accumulator = function(iterator) {
innerAccumulator(function(ignored,item) {
var title = $tw.utils.filterItemToString(item),
tiddler = self.getTiddler(title);
iterator(tiddler,title);
});
};
}
// Invoke the appropriate filteroperator module
results = operatorFunction(accumulator,{
operator: operator.operator,
+2 -2
View File
@@ -1,7 +1,7 @@
/*\
title: $:/core/modules/filters/count.js
type: application/javascript
module-type: filteroperator
module-type: newfilteroperator
Filter operator returning the number of entries in the current list.
@@ -20,7 +20,7 @@ exports.count = function(source,operator,options) {
source(function(tiddler,title) {
count++;
});
return [count + ""];
return [count];
};
})();
+5 -6
View File
@@ -1,7 +1,7 @@
/*\
title: $:/core/modules/filters/json-ops.js
type: application/javascript
module-type: filteroperator
module-type: newfilteroperator
Filter operators for JSON operations
@@ -57,9 +57,9 @@ exports["jsonindexes"] = function(source,operator,options) {
exports["jsontype"] = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
var data = $tw.utils.parseJSONSafe(title,title);
if(data) {
var item = getDataItemType(data,operator.operands);
var data = $tw.utils.filterItemToObject(title,{defaultValue: title,parseStringsAsJson: true});
if(data !== undefined) {
var item = getFilterItemType(data,operator.operands);
if(item !== undefined) {
results.push(item);
}
@@ -196,7 +196,7 @@ function convertDataItemKeysToStrings(item) {
return [];
}
function getDataItemType(data,indexes) {
function getFilterItemType(data,indexes) {
// Get the item
var item = getDataItem(data,indexes);
// Return the item type
@@ -281,4 +281,3 @@ function setDataItem(data,indexes,value) {
}
})();
+4 -4
View File
@@ -1,7 +1,7 @@
/*\
title: $:/core/modules/filters/math.js
type: application/javascript
module-type: filteroperator
module-type: newfilteroperator
Filter operators for math. Unary/binary operators work on each item in turn, and return a new item list.
@@ -207,7 +207,7 @@ function makeNumericBinaryOperator(fnCalc) {
var result = [],
numOperand = $tw.utils.parseNumber(operator.operand);
source(function(tiddler,title) {
result.push($tw.utils.stringifyNumber(fnCalc($tw.utils.parseNumber(title),numOperand)));
result.push(fnCalc($tw.utils.parseNumber(title),numOperand));
});
return result;
};
@@ -226,7 +226,7 @@ function makeNumericReducingOperator(fnCalc,initialValue,fnFinal) {
if(fnFinal) {
value = fnFinal(value,result.length,result);
}
return [$tw.utils.stringifyNumber(value)];
return [value];
};
};
@@ -238,7 +238,7 @@ function makeNumericArrayOperator(fnCalc) {
});
results = fnCalc(results);
$tw.utils.each(results,function(value,index) {
results[index] = $tw.utils.stringifyNumber(value);
results[index] = value;
});
return results;
};
+3 -7
View File
@@ -95,7 +95,6 @@ function SaverHandler(options) {
if($tw.browser) {
$tw.rootWidget.addEventListener("tm-save-wiki",function(event) {
self.saveWiki({
wiki: event.widget.wiki,
template: event.param,
downloadType: "text/plain",
variables: event.paramObject
@@ -103,7 +102,6 @@ function SaverHandler(options) {
});
$tw.rootWidget.addEventListener("tm-download-file",function(event) {
self.saveWiki({
wiki: event.widget.wiki,
method: "download",
template: event.param,
downloadType: "text/plain",
@@ -149,22 +147,20 @@ Save the wiki contents. Options are:
method: "save", "autosave" or "download"
template: the tiddler containing the template to save
downloadType: the content type for the saved file
wiki: optional wiki, overriding the default wiki specified in the constructor
*/
SaverHandler.prototype.saveWiki = function(options) {
options = options || {};
var self = this,
wiki = options.wiki || this.wiki,
method = options.method || "save";
// Ignore autosave if disabled
if(method === "autosave" && ($tw.config.disableAutoSave || wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
if(method === "autosave" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
return false;
}
var variables = options.variables || {},
template = (options.template ||
wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
downloadType = options.downloadType || "text/plain",
text = wiki.renderTiddler(downloadType,template,options),
text = this.wiki.renderTiddler(downloadType,template,options),
callback = function(err) {
if(err) {
alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err);
+86
View File
@@ -0,0 +1,86 @@
/*\
module-type: utils
title: $:/core/modules/utils/simple-list.js
type: application/javascript
Switched from a linked list to simplify things
\*/
(function(){
function SimpleList() {
this.clear();
};
Object.defineProperty(SimpleList.prototype,"length", {
get: function() {
return this.list.length;
}
});
SimpleList.prototype.clear = function() {
this.list = [];
};
SimpleList.prototype.remove = function(value) {
if($tw.utils.isArray(value)) {
for(var t=0; t<value.length; t++) {
this._remove(value[t]);
}
} else {
this._remove(value);
}
};
/*
Push behaves like array.push and accepts multiple string arguments. But it also
accepts a single array argument too, to be consistent with its other methods.
*/
SimpleList.prototype.push = function(/* values */) {
var values = arguments;
if(arguments.length === 1 && $tw.utils.isArray(values[0])) {
values = values[0];
}
for(var i = 0; i < values.length; i++) {
this._push(values[i]);
}
return this.list.length;
};
SimpleList.prototype.pushTop = function(value) {
// this.push(value);
// -or-
$tw.utils.pushTop(this.list,value);
};
SimpleList.prototype.each = function(callback) {
$tw.utils.each(this.list,callback);
};
SimpleList.prototype.toArray = function() {
return this.list.slice(0);
};
SimpleList.prototype.makeTiddlerIterator = function(wiki) {
var self = this;
return function(callback) {
self.each(function(title) {
callback(wiki.getTiddler(title),title);
});
};
};
SimpleList.prototype._remove = function(value) {
var p = this.list.indexOf(value);
if(p !== -1) {
this.list.splice(p,1);
}
};
SimpleList.prototype._push = function(value) {
this.list.push(value);
};
exports.SimpleList = SimpleList;
})();
+48
View File
@@ -1037,4 +1037,52 @@ exports.makeCompareFunction = function(type,options) {
return (types[type] || types[options.defaultType] || types.number);
};
exports.filterItemToString = function(value) {
switch(typeof value) {
case "undefined":
return "undefined"
case "object":
return JSON.stringify(value);
case "boolean":
return value ? "true" : "false";
case "number":
return value.toString();
case "bigint":
return value.toString();
case "string":
return value;
case "symbol":
throw "Filter operators cannot return Symbols";
case "function":
throw "Filter operators cannot return Functions";
}
};
exports.filterItemToObject = function(value,options) {
options = options || {};
var defaultValue = options.defaultValue || {};
switch(typeof value) {
case "undefined":
return defaultValue;
case "object":
return value;
case "boolean":
return value;
case "number":
return value;
case "bigint":
return value;
case "string":
if(options.parseStringsAsJson) {
return $tw.utils.parseJSONSafe(value,defaultValue);
} else {
return value;
}
case "symbol":
throw "Filter operators cannot return Symbols";
case "function":
throw "Filter operators cannot return Functions";
}
};
})();
+1 -1
View File
@@ -99,7 +99,7 @@ table-footer-background: #a8a8a8
table-header-background: #f0f0f0
tag-background: #ec6
tag-foreground: #ffffff
testcase-accent-level-1: #c1eaff
testcase-accent-level-1: #84C5E6
testcase-accent-level-2: #E3B740
testcase-accent-level-3: #5FD564
tiddler-background: <<colour background>>
+1 -26
View File
@@ -27,31 +27,6 @@ title: $:/core/ui/testcases/DefaultTemplate
<%endif%>
<$view tiddler="Description" mode="inline"/>
</$genesis>
<span class="tc-test-case-toolbar">
<$button popup=`$(state)$-more`
tooltip={{$:/language/Buttons/More/Hint}}
aria-label={{$:/language/Buttons/More/Caption}}
class="tc-btn-invisible"
selectedClass="tc-selected"
>
{{$:/core/images/down-arrow}}
</$button>
<$let
tv-config-toolbar-icons="yes"
tv-config-toolbar-text="yes"
tv-config-toolbar-class="tc-btn-invisible"
>
<$reveal state=`$(state)$-more` type="popup" position="belowleft" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TestCase/Actions]!has[draft.of]]"
variable="listItem"
>
<$transclude tiddler=<<listItem>> mode="inline"/>
</$list>
</div>
</$reveal>
</$let>
</span>
</h2>
</div>
<%if [[Narrative]is[tiddler]] %>
@@ -71,7 +46,7 @@ title: $:/core/ui/testcases/DefaultTemplate
<%endif%>
<div class="tc-test-case-panes">
<div class="tc-test-case-source">
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
</div>
<div class="tc-test-case-divider">
</div>
@@ -19,9 +19,6 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
</table>
</$list>
<$edit class="tc-edit-texteditor" tiddler=<<currentTab>>/>
<div class="tc-test-case-footer-toolbar">
<$macrocall $name="copy-to-clipboard" src={{{ [<currentTab>get[text]] }}}/>
</div>
\end
<$transclude $variable="body" $mode="inline"/>
-4
View File
@@ -1,4 +0,0 @@
title: $:/core/ui/testcases/actions/Export
tags: $:/tags/TestCase/Actions
<$macrocall $name="exportButton" exportFilter="[all[tiddlers]sort[]] -[prefix[$:/state/]] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" lingoBase="$:/language/Buttons/ExportTiddlers/"/>
-11
View File
@@ -1,11 +0,0 @@
title: $:/core/ui/testcases/actions/Import
tags: $:/tags/TestCase/Actions
\whitespace trim
<$button tooltip={{$:/language/Buttons/TestCaseImport/Hint}} aria-label={{$:/language/Buttons/TestCaseImport/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-import-tiddlers" $param=<<payloadTiddlers>>/>
{{$:/core/images/permalink-button}}
<span class="tc-btn-text">
<$text text={{$:/language/Buttons/TestCaseImport/Caption}}/>
</span>
</$button>
-2
View File
@@ -1,2 +0,0 @@
title: $:/tags/TestCase/Actions
list:
@@ -708,6 +708,10 @@ Tests the filtering mechanism.
expect(wiki.filterTiddlers("1 2 3 4 +[min[2]]").join(",")).toBe("1,2,2,2");
});
it("should handle type conversions", function() {
expect(wiki.filterTiddlers("[[2]add[2]addprefix[donkey]]").join(",")).toBe("donkey4");
});
/* listops filters */
it("should handle the allafter operator", function() {
@@ -1,15 +1,9 @@
created: 20141129194651420
modified: 20240621074019077
tags: Concepts Definitions
modified: 20141130195444237
tags: Concepts
title: Transclusion
! Definition
<<< Wikipedia: [[Transclusion|https://en.wikipedia.org/wiki/Transclusion]]
In computer science, transclusion is the inclusion of part or all of an electronic document into one or more other documents by reference via hypertext.
<<<
In ~TiddlyWiki: ''Transclusion'' is the process of referencing one tiddler "A" from another tiddler "B" such that the content of "A" appears to be a part of "B".
[[Transclusion|https://en.wikipedia.org/wiki/Transclusion]] is the process of referencing one tiddler "A" from another tiddler "B" such that the content of "A" appears to be a part of "B".
Copying and pasting content creates multiple copies of the same content in several different places. With transclusion, there can be a single copy and a special instruction in "B" which indicates the point at which content should be inserted from tiddler "A".
@@ -1,12 +1,12 @@
caption: minlength
created: 20161011074235805
from-version: 5.1.14
modified: 20240621073052597
modified: 20161011074235805
op-input: a list of items
op-output: those items at least as long as the specified minimum length
op-parameter: the minimum length for items
op-parameter-name: minlength
op-purpose: filter items whose length is greater than the specified minimum length
op-purpose: filter items shorter than the specified minimum length
from-version: 5.1.14
tags: [[Filter Operators]]
title: minlength Operator
type: text/vnd.tiddlywiki
@@ -1,6 +1,4 @@
created: 20240621075644739
modified: 20240621075647009
tags: picture
title: Open Collective Logo
tags: picture
<svg style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 28 28"><path d="M25.509 6.026A13.934 13.934 0 0 1 28 14c0 2.963-.92 5.71-2.491 7.974l-3.626-3.627A8.96 8.96 0 0 0 23 14a8.964 8.964 0 0 0-1.117-4.347l3.626-3.627Z"/><path d="m21.974 2.49-3.627 3.628a9 9 0 1 0 0 15.765l3.627 3.626A13.934 13.934 0 0 1 14 27.999C6.268 28 0 21.733 0 14 0 6.269 6.268 0 14 0c2.963 0 5.711.922 7.974 2.492Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 28 28"><path d="M25.509 6.026A13.934 13.934 0 0 1 28 14c0 2.963-.92 5.71-2.491 7.974l-3.626-3.627A8.96 8.96 0 0 0 23 14a8.964 8.964 0 0 0-1.117-4.347l3.626-3.627Z"/><path d="m21.974 2.49-3.627 3.628a9 9 0 1 0 0 15.765l3.627 3.626A13.934 13.934 0 0 1 14 27.999C6.268 28 0 21.733 0 14 0 6.269 6.268 0 14 0c2.963 0 5.711.922 7.974 2.492Z"/></svg>
@@ -5,7 +5,7 @@ description: An example of a failing test
title: Narrative
This test case intentionally fails (in order to show how failures are displayed). The expected result is set to <code><$text text={{ExpectedResult}}/></code>, but the result computes to <code><$wikify name="html" text={{Output}} mode="block" output="html"><$text text=<<html>>/></$wikify></code>
This test case intentionally fails (in order to show how failures are displayed)
+
title: Output
@@ -72,7 +72,6 @@ The test case wiki will inherit variables that are visible to the <<.wid testcas
|!Variable |!Description |
|<<.var linkTarget>> |Causes the test case description to be rendered as a link to the current tiddler |
|<<.var displayFormat>> |Defaults to "wikitext", can also be "plaintext" to force plain text display |
|<<.var testcaseTiddler>> |Title of the tiddler to be used as a link target for the testcase description |
A custom template can be specified for special purposes. For example, the provided template $:/core/ui/testcases/RawJSONTemplate just displays the payload tiddlers in JSON, which can be used for debugging purposes.
@@ -1,48 +1,21 @@
caption: transclude
created: 20130824142500000
modified: 20240621073236430
modified: 20230511022612458
tags: Widgets
title: TranscludeWidget
type: text/vnd.tiddlywiki
! Introduction
Transclusion is the underlying mechanism for many higher level wikitext features, such as ''procedures'', ''functions'', ''custom widgets'' and ''macros''.
The <<.wlink TranscludeWidget>> widget dynamically includes the content from another tiddler or variable, rendering it as if the transclude widget were replaced by the target content.
The <<.wid transclude>> widget dynamically includes the content from another ''tiddler'' or ''variable'', rendering it as if the transclude widget were replaced by the target content.
The <<.wlink TranscludeWidget>> widget can be used to render content of any type: wikitext, images, videos, etc.
The <<.wid transclude>> widget can be used to render content of any type: wikitext, images, videos, etc.
! Attributes
| !Attribute |<| !Description |
| !(modern) | !(legacy) |~|
|$variable |- |Name of the variable to transclude. Eg: Name of <<.dlink procedures Procedures>>, <<.dlink functions Functions>>, <<.dlink "custom widgets" Widgets>> and <<.dlink macros Macros>> |
|$tiddler |tiddler |The title of the tiddler to transclude (defaults to the current tiddler) |
|$field |field |The field name of the current tiddler (defaults to "text"; if present takes precedence over the index attribute) |
|$index |index |The index of a property in a [[DataTiddler|DataTiddlers]] |
|$subtiddler |subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|$mode |mode |Override the default parsing mode for the transcluded text to "block" or "inline" |
|$type | |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field|
|$output |- |ContentType for the output rendering (defaults to `text/html`, can also be `text/plain` or `text/raw`) |
|$recursionMarker |recursionMarker |Set to ''no'' to prevent creation of [[Legacy Transclusion Recursion Marker]] (defaults to ''yes'') |
|$fillignore |- |Set to ''yes'' to make this transclusion invisible to the <<.attr $depth>> attribute of the <<.wlink SlotWidget>> widget (defaults to ''no'') |
|//{attributes not starting with $}// | |Any other attributes that do not start with a dollar are used as parameters to the transclusion |
|//{other attributes starting with $}// | |Other attributes starting with a single dollar sign are ''reserved'' for future use |
|//{attributes starting with $$}// | |Attributes starting with two dollar signs are used as parameters to the transclusion, but with the name changed to use a single dollar sign |
! Legacy vs. Modern Mode
The <<.wid transclude>> widget can be used in two modes:
* <<.from-version "5.3.0">> ''Modern mode'' offers the full capabilities of the <<.wid transclude>> widget, and incorporates the functionality of the <<.wlink MacroCallWidget>> widget. It is indicated by the presence of at least one attribute starting with a dollar sign `$`
* ''Legacy mode'' offers a more limited set of capabilities. It is indicated by the absence of any attributes starting with a dollar sign `$`
Modern mode is recommended for use in new applications.
Transclusion is the underlying mechanism for many higher level wikitext features, such as procedures, custom widgets and macros.
! Example
Here is a complete example showing the important features of the <<.wid transclude>> widget:
Here is a complete example showing the important features of the <<.wlink TranscludeWidget>> widget:
```
\procedure myproc(name,age)
@@ -56,9 +29,36 @@ My name is <<name>> and my age is <<age>>.
* The content of the procedure refers to the parameters as variables
* The <<.wlink TranscludeWidget>> widget specifies the variable to transclude, and values for the parameters.
! Legacy vs. Modern Mode
The <<.wlink TranscludeWidget>> widget can be used in two modes:
* <<.from-version "5.3.0">> ''Modern mode'' offers the full capabilities of the <<.wlink TranscludeWidget>> widget, and incorporates the functionality of the <<.wlink MacroCallWidget>> widget. It is indicated by the presence of at least one attribute starting with a dollar sign `$`
* ''Legacy mode'' offers a more limited set of capabilities. It is indicated by the absence of any attributes starting with a dollar sign `$`
Modern mode is recommended for use in new applications.
! Attributes
| !Attribute |<| !Description |
| !(modern) | !(legacy) |~|
|$variable |- |Name of the variable to transclude |
|$tiddler |tiddler |The title of the tiddler to transclude (defaults to the current tiddler) |
|$field |field |The field name of the current tiddler (defaults to "text"; if present takes precedence over the index attribute) |
|$index |index |The index of a property in a [[DataTiddler|DataTiddlers]] |
|$subtiddler |subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|$mode |mode |Override the default parsing mode for the transcluded text to "block" or "inline" |
|$type | |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field|
|$output |- |ContentType for the output rendering (defaults to `text/html`, can also be `text/plain` or `text/raw`) |
|$recursionMarker |recursionMarker |Set to ''no'' to prevent creation of [[Legacy Transclusion Recursion Marker]] (defaults to ''yes'') |
|$fillignore |- |Set to ''yes'' to make this transclusion invisible to the <<.attr $depth>> attribute of the <<.wlink SlotWidget>> widget (defaults to ''no'') |
|//{attributes not starting with $}// | |Any other attributes that do not start with a dollar are used as parameters to the transclusion |
|//{other attributes starting with $}// | |Other attributes starting with a single dollar sign are reserved for future use |
|//{attributes starting with $$}// | |Attributes starting with two dollar signs are used as parameters to the transclusion, but with the name changed to use a single dollar sign |
! Basic Operation
The basic operation of the <<.wid transclude>> widget is as follows:
The basic operation of the <<.wlink TranscludeWidget>> widget is as follows:
|`<$transclude/>` |Transcludes the text field of the current tiddler |
|`<$transclude $variable="alpha"/>` |Transcludes the variable "alpha" (note that procedures, custom widgets and macros are all special types of variable) |
@@ -69,7 +69,7 @@ The basic operation of the <<.wid transclude>> widget is as follows:
! Transclusion Parameters
Named string parameters can be passed to the <<.wid transclude>> widget. They are made available as variables within the transcluded text. Parameters are only supported in modern mode.
Named string parameters can be passed to the <<.wlink TranscludeWidget>> widget. They are made available as variables within the transcluded text. Parameters are only supported in modern mode.
When invoking a transclusion, parameters are specified as additional attributes that do not start with a dollar sign `$`:
@@ -108,7 +108,7 @@ Parameters are available here as the variables <<firstParameter>> and <<secondPa
! Transclusion Slots
Transcluded content can define special named locations called slots. At the point of transclusion, blocks of wikitext can be passed to the <<.wid transclude>> widget to fill those slots.
Transcluded content can define special named locations called slots. At the point of transclusion, blocks of wikitext can be passed to the <<.wlink TranscludeWidget>> widget to fill those slots.
Slots work very similarly to parameters except that they can contain structured wikitext, and not just plain text. The primary advantage of slots over parameters is that the contents do not need to be wrapped in quotation symbols, making it much simpler to pass complex structures.
@@ -33,7 +33,7 @@ ConfettiManager.prototype.launch = function (delay,options) {
self.outstandingTimers.splice(p,1);
} else {
console.log("Confetti Manager Error: Cannot find previously stored timer ID");
// debugger;
debugger;
}
confetti(options);
},delay);
@@ -3,8 +3,7 @@ tags: $:/tags/ConfettiExample
<$button>
<$action-sendmessage $message="tm-confetti-launch"/>
<$action-sendmessage $message="tm-confetti-launch" delay=300 originY=0.6 spread=100 scalar=1.5/>
<$action-sendmessage $message="tm-confetti-launch" delay=400 originY=0.55 spread=130/>
<$action-sendmessage $message="tm-confetti-launch" delay=500 originY=0.55 spread=170 scalar=2/>
Launch four staggered rounds of confetti
<$action-sendmessage $message="tm-confetti-launch" originY=0.6 spread=70 delay=300/>
<$action-sendmessage $message="tm-confetti-launch" originY=0.55 spread=30 delay=600/>
Launch three staggered rounds of confetti
</$button>
@@ -6,5 +6,5 @@ Type the word "launch": <$edit-text tiddler="$:/temp/confetti/launchstatus" tag=
<$list filter="[{$:/temp/confetti/launchstatus}match:caseinsensitive[launch]]" variable="ignore">
Launched!
<$confetti particleCount=100/>
<$confetti particleCount=100 spread=170 delay=300/>
<$confetti particleCount=100 delay=300/>
</$list>
+5 -3
View File
@@ -20,9 +20,11 @@ tags: $:/tags/PageTemplate
<%endif%>
<%if [function[tour-is-last-step]] %>
<$confetti/>
<$confetti delay=300 originY=0.6 spread=100 scalar=1.5/>
<$confetti delay=400 originY=0.55 spread=130/>
<$confetti delay=500 originY=0.55 spread=170 scalar=2/>
<$confetti delay=100/>
<$confetti delay=200/>
<$confetti delay=300/>
<$confetti delay=400/>
<$confetti delay=500/>
<%endif%>
</div>
\end
+3 -30
View File
@@ -3297,7 +3297,7 @@ span.tc-translink > a:first-child {
display: inline-block;
line-height: 0;
border-radius: 1em;
vertical-align: text-bottom;
vertical-align: bottom;
margin-right: 0.25em;
}
@@ -3314,12 +3314,6 @@ span.tc-translink > a:first-child {
height: 0.5em;
}
.tc-test-case-header > h2 {
background: <<colour background>>;
border-radius: 4px;
padding: 0.25em;
}
.tc-test-case-header > h2,
.tc-test-case-source > pre {
margin: 0;
@@ -3329,18 +3323,6 @@ span.tc-translink > a:first-child {
font-style: normal;
}
.tc-test-case-toolbar {
float: right;
}
.tc-test-case-toolbar svg {
fill: <<colour tiddler-controls-foreground>>;
}
.tc-test-case-toolbar .tc-drop-down {
font-size: 0.8em;
}
.tc-test-case-result-fail {
border: 1px solid <<colour foreground>>;
background-color: <<colour background>>;
@@ -3384,12 +3366,8 @@ span.tc-translink > a:first-child {
}
.tc-test-case-source .tc-tab-content {
background: inherit;
margin: 0;
}
.tc-test-case-source .tc-tab-content .tc-field-table {
background: <<colour background>>;
margin: 0;
}
.tc-test-case-source .tc-field-table {
@@ -3412,16 +3390,11 @@ span.tc-translink > a:first-child {
padding-top: 0;
}
.tc-test-case-footer-toolbar {
display: flex;
justify-content: flex-end;
}
.tc-test-case-output {
box-shadow: inset 2px 2px 10px 0px <<colour muted-foreground>>;
background: <<colour background>>;
border-radius: 4px;
border: 1px solid <<colour muted-foreground>>;
border: 1px solid <<colour foreground>>;
flex: 1 0 49%;
min-width: 250px;
padding: 0.25em 1em;