tiddlywiki 5.3.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/build-site.sh +1 -1
- package/boot/boot.js +6 -7
- package/core/images/new-journal-button.tid +1 -3
- package/core/modules/parsers/wikiparser/rules/fnprocdef.js +2 -2
- package/core/modules/parsers/wikiparser/rules/parameters.js +1 -1
- package/core/modules/startup/rootwidget.js +1 -0
- package/core/modules/startup/startup.js +5 -0
- package/core/modules/utils/dom/dragndrop.js +4 -2
- package/core/modules/utils/dom/http.js +19 -3
- package/core/modules/widgets/checkbox.js +3 -1
- package/core/modules/widgets/importvariables.js +1 -1
- package/core/modules/widgets/select.js +4 -0
- package/core/modules/widgets/transclude.js +69 -39
- package/core/modules/widgets/widget.js +7 -28
- package/core/modules/wiki.js +1 -1
- package/core/ui/AlertTemplate.tid +1 -0
- package/core/ui/EditTemplate.tid +1 -0
- package/core/ui/ImportPreviews/Text.tid +1 -0
- package/core/ui/PageStylesheet.tid +1 -0
- package/core/ui/PageTemplate.tid +1 -0
- package/core/ui/RootTemplate.tid +1 -0
- package/core/ui/StoryTiddlerTemplate.tid +1 -0
- package/core/ui/ViewTemplate/body/default.tid +1 -0
- package/core/ui/ViewTemplate.tid +1 -0
- package/core/wiki/config/OfficialPluginLibrary.tid +1 -1
- package/core/wiki/config/ViewTemplateBodyFilters.multids +2 -1
- package/core/wiki/macros/toc.tid +2 -2
- package/core/wiki/tags/ViewTemplateBodyFilter.tid +1 -2
- package/editions/de-AT/tiddlers/external/tiddlywiki.files +1 -1
- package/editions/prerelease/tiddlers/{Release 5.3.1.tid → Release 5.3.2.tid } +30 -26
- package/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid +1 -1
- package/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid +1 -1
- package/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid +1 -1
- package/editions/test/tiddlers/tests/data/functions/IndentedFunctions.tid +24 -0
- package/editions/test/tiddlers/tests/data/functions/WikifiedFunctions.tid +1 -1
- package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgets.tid +23 -0
- package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgets2.tid +22 -0
- package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgetsAndMacros.tid +29 -0
- package/editions/test/tiddlers/tests/data/procedures/Nested-indented.tid +20 -0
- package/editions/test/tiddlers/tests/data/procedures/TrailingNewlines.tid +22 -0
- package/editions/test/tiddlers/tests/data/transclude/CustomWidget-Simple-Indented.tid +33 -0
- package/editions/test/tiddlers/tests/data/transclude/Parameterised-Shortcut-ParametersIndented.tid +20 -0
- package/editions/test/tiddlers/tests/data/transclude/Procedures-Double-Underscore.tid +26 -0
- package/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid +5 -3
- package/editions/test/tiddlers/tests/test-filters.js +4 -4
- package/editions/tw5.com/tiddlers/community/resources/TiddlyWiki Posts.tid +3 -3
- package/editions/tw5.com/tiddlers/community/tutorials/GitHub Saver Tutorial by Mohammad.tid +5 -5
- package/editions/tw5.com/tiddlers/definitions/Git.tid +9 -0
- package/editions/tw5.com/tiddlers/definitions/GitHub.tid +6 -4
- package/editions/tw5.com/tiddlers/definitions/GitLab.tid +13 -0
- package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid +2 -0
- package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid +11 -1
- package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid +2 -0
- package/editions/tw5.com/tiddlers/filters/substitute Operator.tid +3 -3
- package/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +1 -1
- package/editions/tw5.com/tiddlers/images/New Release Banner.png +0 -0
- package/editions/tw5.com/tiddlers/images/{New Release Banner.jpg.meta → New Release Banner.png.meta } +1 -1
- package/editions/tw5.com/tiddlers/macros/TagMacro.tid +3 -1
- package/editions/tw5.com/tiddlers/macros/examples/tag.tid +22 -1
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Random Dog.tid +90 -0
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Zotero.tid +4 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid +4 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid +2 -2
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid +3 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid +4 -3
- package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid +3 -3
- package/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid +2 -2
- package/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid +2 -2
- package/editions/tw5.com/tiddlers/pragmas/Pragmas.tid +3 -1
- package/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid +1 -1
- package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.1.tid +80 -0
- package/editions/tw5.com/tiddlers/releasenotes/Releases.tid +1 -1
- package/editions/tw5.com/tiddlers/releasenotes/TiddlyWiki Releases.tid +1 -1
- package/editions/tw5.com/tiddlers/{Saving on Browser with TiddlyStow.tid → saving/Saving on Browser with TiddlyStow.tid } +2 -2
- package/editions/tw5.com/tiddlers/saving/Saving to a Git service.tid +5 -1
- package/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid +8 -11
- package/editions/tw5.com/tiddlers/systemtags/SystemTag_ $__tags_Macro.tid +1 -1
- package/editions/tw5.com/tiddlers/variables/Behaviour of invoked variables depends on how the variable was declared.tid +52 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter expression function call.tid +10 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter operator parameter.tid +11 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via normal wikitext.tid +11 -0
- package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via widget attributes.tid +11 -0
- package/editions/tw5.com/tiddlers/variables/Variable Usage.tid +5 -49
- package/editions/tw5.com/tiddlers/widgets/ActionListopsWidget.tid +24 -2
- package/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid +2 -2
- package/editions/tw5.com/tiddlers/widgets/ListWidget.tid +3 -1
- package/editions/tw5.com/tiddlers/widgets/SelectWidget.tid +1 -1
- package/editions/tw5.com/tiddlers/widgets/examples/ActionListopsWidget (Examples).tid +12 -1
- package/editions/tw5.com/tiddlers/wikitext/Anchor Links using HTML.tid +1 -1
- package/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid +52 -19
- package/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid +5 -2
- package/editions/tw5.com/tiddlers/wikitext/Widget Attributes.tid +8 -3
- package/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid +1 -0
- package/languages/pl-PL/Help/savewikifolder.tid +17 -4
- package/languages/zh-Hans/Help/savewikifolder.tid +5 -1
- package/languages/zh-Hant/Help/savewikifolder.tid +5 -1
- package/licenses/cla-individual.md +10 -0
- package/package.json +1 -1
- package/plugins/tiddlywiki/googleanalytics/googleanalytics.js +1 -1
- package/plugins/tiddlywiki/googleanalytics/settings.tid +1 -3
- package/plugins/tiddlywiki/jasmine/jasmine-plugin.js +9 -2
- package/plugins/tiddlywiki/jasmine/startup.js +2 -1
- package/readme.md +1 -1
- package/themes/tiddlywiki/vanilla/base.tid +8 -7
- package/editions/tw5.com/tiddlers/images/New Release Banner.jpg +0 -0
package/bin/build-site.sh
CHANGED
package/boot/boot.js
CHANGED
@@ -575,9 +575,8 @@ var globalCheck =[
|
|
575
575
|
" configurable: true",
|
576
576
|
" });",
|
577
577
|
" if(Object.keys(__temp__).length){",
|
578
|
-
" console.log(Object.keys(__temp__));",
|
578
|
+
" console.log(\"Warning: Global assignment detected\",Object.keys(__temp__));",
|
579
579
|
" delete Object.prototype.__temp__;",
|
580
|
-
" throw \"Global assignment is not allowed within modules on node.\";",
|
581
580
|
" }",
|
582
581
|
" delete Object.prototype.__temp__;",
|
583
582
|
].join('\n');
|
@@ -596,11 +595,11 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
|
596
595
|
// Add the code prologue and epilogue
|
597
596
|
code = [
|
598
597
|
"(function(" + contextNames.join(",") + ") {",
|
599
|
-
" (function(){
|
598
|
+
" (function(){" + code + "\n;})();\n",
|
600
599
|
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
601
|
-
"
|
600
|
+
"\nreturn exports;\n",
|
602
601
|
"})"
|
603
|
-
].join("
|
602
|
+
].join("");
|
604
603
|
|
605
604
|
// Compile the code into a function
|
606
605
|
var fn;
|
@@ -926,7 +925,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|
926
925
|
}
|
927
926
|
} else {
|
928
927
|
// line number should be included in e.stack for runtime errors
|
929
|
-
$tw.utils.error("Error executing boot module " + name + ": " +
|
928
|
+
$tw.utils.error("Error executing boot module " + name + ": " + String(e) + "\n\n" + e.stack);
|
930
929
|
}
|
931
930
|
}
|
932
931
|
}
|
@@ -1150,7 +1149,7 @@ $tw.Wiki = function(options) {
|
|
1150
1149
|
shadowTiddlerTitles = null,
|
1151
1150
|
getShadowTiddlerTitles = function() {
|
1152
1151
|
if(!shadowTiddlerTitles) {
|
1153
|
-
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
1152
|
+
shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
1154
1153
|
}
|
1155
1154
|
return shadowTiddlerTitles;
|
1156
1155
|
},
|
@@ -1,6 +1,4 @@
|
|
1
1
|
title: $:/core/images/new-journal-button
|
2
2
|
tags: $:/tags/Image
|
3
3
|
|
4
|
-
<$parameters size="22pt" day=<<now "DD"
|
5
|
-
<svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg>
|
6
|
-
</$parameters>
|
4
|
+
<$parameters size="22pt" day=<<now "DD">>><svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg></$parameters>
|
@@ -35,7 +35,7 @@ Instantiate parse rule
|
|
35
35
|
exports.init = function(parser) {
|
36
36
|
this.parser = parser;
|
37
37
|
// Regexp to match
|
38
|
-
this.matchRegExp =
|
38
|
+
this.matchRegExp = /\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
39
39
|
};
|
40
40
|
|
41
41
|
/*
|
@@ -53,7 +53,7 @@ exports.parse = function() {
|
|
53
53
|
var reEnd;
|
54
54
|
if(this.match[5]) {
|
55
55
|
// If so, the end of the body is marked with \end
|
56
|
-
reEnd = new RegExp("(\\r?\\n
|
56
|
+
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
57
57
|
} else {
|
58
58
|
// Otherwise, the end of the definition is marked by the end of the line
|
59
59
|
reEnd = /($|\r?\n)/mg;
|
@@ -27,6 +27,11 @@ exports.startup = function() {
|
|
27
27
|
if($tw.browser) {
|
28
28
|
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
29
29
|
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
30
|
+
// 2023-07-21 Edge returns UA below. So we use "isChromeLike"
|
31
|
+
//'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/114.0.0.0 safari/537.36 edg/114.0.1823.82'
|
32
|
+
$tw.browser.isChromeLike = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
33
|
+
$tw.browser.hasTouch = !!window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
34
|
+
$tw.browser.isMobileChrome = $tw.browser.isChromeLike && $tw.browser.hasTouch;
|
30
35
|
}
|
31
36
|
// Platform detection
|
32
37
|
$tw.platform = {};
|
@@ -80,7 +80,7 @@ exports.makeDraggable = function(options) {
|
|
80
80
|
if(dataTransfer.setDragImage) {
|
81
81
|
if(dragImageType === "pill") {
|
82
82
|
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
83
|
-
} else if
|
83
|
+
} else if(dragImageType === "blank") {
|
84
84
|
dragImage.removeChild(dragImage.firstChild);
|
85
85
|
dataTransfer.setDragImage(dragImage,0,0);
|
86
86
|
} else {
|
@@ -106,7 +106,9 @@ exports.makeDraggable = function(options) {
|
|
106
106
|
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
107
107
|
dataTransfer.setData("text/plain",titleString);
|
108
108
|
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
109
|
-
}
|
109
|
+
}
|
110
|
+
// If browser is Chrome-like and has a touch-input device do NOT .setData
|
111
|
+
if(!($tw.browser.isMobileChrome)) {
|
110
112
|
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
111
113
|
}
|
112
114
|
dataTransfer.setData("Text",titleString);
|
@@ -90,6 +90,7 @@ wiki: wiki to be used for executing action strings
|
|
90
90
|
url: URL for request
|
91
91
|
method: method eg GET, POST
|
92
92
|
body: text of request body
|
93
|
+
binary: set to "yes" to force binary processing of response payload
|
93
94
|
oncompletion: action string to be invoked on completion
|
94
95
|
onprogress: action string to be invoked on progress updates
|
95
96
|
bindStatus: optional title of tiddler to which status ("pending", "complete", "error") should be written
|
@@ -106,10 +107,11 @@ function HttpClientRequest(options) {
|
|
106
107
|
this.wiki = options.wiki;
|
107
108
|
this.completionActions = options.oncompletion;
|
108
109
|
this.progressActions = options.onprogress;
|
109
|
-
this.bindStatus = options["
|
110
|
-
this.bindProgress = options["
|
110
|
+
this.bindStatus = options["bindStatus"];
|
111
|
+
this.bindProgress = options["bindProgress"];
|
111
112
|
this.method = options.method || "GET";
|
112
113
|
this.body = options.body || "";
|
114
|
+
this.binary = options.binary || "";
|
113
115
|
this.variables = options.variables;
|
114
116
|
var url = options.url;
|
115
117
|
$tw.utils.each(options.queryStrings,function(value,name) {
|
@@ -132,7 +134,7 @@ HttpClientRequest.prototype.send = function(callback) {
|
|
132
134
|
var self = this,
|
133
135
|
setBinding = function(title,text) {
|
134
136
|
if(title) {
|
135
|
-
|
137
|
+
self.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
|
136
138
|
}
|
137
139
|
};
|
138
140
|
if(this.url) {
|
@@ -156,6 +158,8 @@ HttpClientRequest.prototype.send = function(callback) {
|
|
156
158
|
type: this.method,
|
157
159
|
headers: this.requestHeaders,
|
158
160
|
data: this.body,
|
161
|
+
returnProp: this.binary === "" ? "responseText" : "response",
|
162
|
+
responseType: this.binary === "" ? "text" : "arraybuffer",
|
159
163
|
callback: function(err,data,xhr) {
|
160
164
|
var hasSucceeded = xhr.status >= 200 && xhr.status < 300,
|
161
165
|
completionCode = hasSucceeded ? "complete" : "error",
|
@@ -175,6 +179,16 @@ HttpClientRequest.prototype.send = function(callback) {
|
|
175
179
|
data: (data || "").toString(),
|
176
180
|
headers: JSON.stringify(headers)
|
177
181
|
};
|
182
|
+
/* Convert data from binary to base64 */
|
183
|
+
if (xhr.responseType === "arraybuffer") {
|
184
|
+
var binary = "",
|
185
|
+
bytes = new Uint8Array(data),
|
186
|
+
len = bytes.byteLength;
|
187
|
+
for (var i=0; i<len; i++) {
|
188
|
+
binary += String.fromCharCode(bytes[i]);
|
189
|
+
}
|
190
|
+
resultVariables.data = window.btoa(binary);
|
191
|
+
}
|
178
192
|
self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getTiddler(requestTrackerTitle),{
|
179
193
|
status: completionCode,
|
180
194
|
}));
|
@@ -212,6 +226,7 @@ Make an HTTP request. Options are:
|
|
212
226
|
callback: function invoked with (err,data,xhr)
|
213
227
|
progress: optional function invoked with (lengthComputable,loaded,total)
|
214
228
|
returnProp: string name of the property to return as first argument of callback
|
229
|
+
responseType: "text" or "arraybuffer"
|
215
230
|
*/
|
216
231
|
exports.httpRequest = function(options) {
|
217
232
|
var type = options.type || "GET",
|
@@ -264,6 +279,7 @@ exports.httpRequest = function(options) {
|
|
264
279
|
}
|
265
280
|
}
|
266
281
|
}
|
282
|
+
request.responseType = options.responseType || "text";
|
267
283
|
// Set up the state change handler
|
268
284
|
request.onreadystatechange = function() {
|
269
285
|
if(this.readyState === 4) {
|
@@ -116,7 +116,7 @@ CheckboxWidget.prototype.getValue = function() {
|
|
116
116
|
} else {
|
117
117
|
list = $tw.utils.parseStringArray(this.checkboxDefault || "") || [];
|
118
118
|
}
|
119
|
-
} else if
|
119
|
+
} else if(this.checkboxListIndex) {
|
120
120
|
list = $tw.utils.parseStringArray(this.wiki.extractTiddlerDataItem(tiddler,this.checkboxListIndex,this.checkboxDefault || "")) || [];
|
121
121
|
} else {
|
122
122
|
list = this.wiki.filterTiddlers(this.checkboxFilter,this) || [];
|
@@ -215,6 +215,8 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
|
215
215
|
if($tw.utils.isArray(fieldContents)) {
|
216
216
|
// Make a copy so we can modify it without changing original that's refrenced elsewhere
|
217
217
|
listContents = fieldContents.slice(0);
|
218
|
+
} else if(fieldContents === undefined) {
|
219
|
+
listContents = [];
|
218
220
|
} else if(typeof fieldContents === "string") {
|
219
221
|
listContents = $tw.utils.parseStringArray(fieldContents);
|
220
222
|
// No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere
|
@@ -49,7 +49,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
|
49
49
|
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
50
50
|
// Accumulate the <$set> widgets from each tiddler
|
51
51
|
$tw.utils.each(this.tiddlerList,function(title) {
|
52
|
-
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true});
|
52
|
+
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:true});
|
53
53
|
if(parser) {
|
54
54
|
var parseTreeNode = parser.tree[0];
|
55
55
|
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
@@ -145,6 +145,7 @@ SelectWidget.prototype.execute = function() {
|
|
145
145
|
this.selectDefault = this.getAttribute("default");
|
146
146
|
this.selectMultiple = this.getAttribute("multiple", false);
|
147
147
|
this.selectSize = this.getAttribute("size");
|
148
|
+
this.selectTabindex = this.getAttribute("tabindex");
|
148
149
|
this.selectTooltip = this.getAttribute("tooltip");
|
149
150
|
this.selectFocus = this.getAttribute("focus");
|
150
151
|
// Make the child widgets
|
@@ -162,6 +163,9 @@ SelectWidget.prototype.execute = function() {
|
|
162
163
|
if(this.selectSize) {
|
163
164
|
$tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize);
|
164
165
|
}
|
166
|
+
if(this.selectTabindex) {
|
167
|
+
$tw.utils.addAttributeToParseTreeNode(selectNode,"tabindex",this.selectTabindex);
|
168
|
+
}
|
165
169
|
if(this.selectTooltip) {
|
166
170
|
$tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip);
|
167
171
|
}
|
@@ -41,27 +41,43 @@ TranscludeWidget.prototype.execute = function() {
|
|
41
41
|
this.collectAttributes();
|
42
42
|
this.collectStringParameters();
|
43
43
|
this.collectSlotFillParameters();
|
44
|
-
//
|
45
|
-
var
|
46
|
-
|
47
|
-
|
48
|
-
this.
|
49
|
-
|
44
|
+
// Determine whether we're being used in inline or block mode
|
45
|
+
var parseAsInline = !this.parseTreeNode.isBlock;
|
46
|
+
if(this.transcludeMode === "inline") {
|
47
|
+
parseAsInline = true;
|
48
|
+
} else if(this.transcludeMode === "block") {
|
49
|
+
parseAsInline = false;
|
50
|
+
}
|
51
|
+
// Set 'thisTiddler'
|
52
|
+
this.setVariable("thisTiddler",this.transcludeTitle);
|
53
|
+
var parseTreeNodes, target;
|
50
54
|
// Process the transclusion according to the output type
|
51
55
|
switch(this.transcludeOutput || "text/html") {
|
52
56
|
case "text/html":
|
53
|
-
//
|
57
|
+
// Return the parse tree nodes of the target
|
58
|
+
target = this.parseTransclusionTarget(parseAsInline);
|
59
|
+
this.parseAsInline = target.parseAsInline;
|
60
|
+
parseTreeNodes = target.parseTreeNodes;
|
54
61
|
break;
|
55
62
|
case "text/raw":
|
56
63
|
// Just return the raw text
|
57
|
-
|
64
|
+
target = this.getTransclusionTarget();
|
65
|
+
parseTreeNodes = [{type: "text", text: target.text}];
|
58
66
|
break;
|
59
67
|
default:
|
60
|
-
// text/plain
|
61
|
-
|
62
|
-
|
68
|
+
// "text/plain" is the plain text result of wikifying the text
|
69
|
+
target = this.parseTransclusionTarget(parseAsInline);
|
70
|
+
var widgetNode = this.wiki.makeWidget(target.parser,{
|
71
|
+
parentWidget: this,
|
72
|
+
document: $tw.fakeDocument
|
73
|
+
});
|
74
|
+
var container = $tw.fakeDocument.createElement("div");
|
75
|
+
widgetNode.render(container,null);
|
76
|
+
parseTreeNodes = [{type: "text", text: container.textContent}];
|
63
77
|
break;
|
64
78
|
}
|
79
|
+
this.sourceText = target.text;
|
80
|
+
this.parserType = target.type;
|
65
81
|
// Set the legacy transclusion context variables only if we're not transcluding a variable
|
66
82
|
if(!this.transcludeVariable) {
|
67
83
|
var recursionMarker = this.makeRecursionMarker();
|
@@ -158,17 +174,44 @@ TranscludeWidget.prototype.collectSlotFillParameters = function() {
|
|
158
174
|
};
|
159
175
|
|
160
176
|
/*
|
161
|
-
Get transcluded
|
177
|
+
Get transcluded details as an object {text:,type:}
|
162
178
|
*/
|
163
179
|
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
164
180
|
var self = this;
|
165
|
-
|
166
|
-
|
167
|
-
if(this.
|
168
|
-
|
169
|
-
|
170
|
-
|
181
|
+
var text;
|
182
|
+
// Return the text and type of the target
|
183
|
+
if(this.hasAttribute("$variable")) {
|
184
|
+
if(this.transcludeVariable) {
|
185
|
+
// Transcluding a variable
|
186
|
+
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
187
|
+
text = variableInfo.text;
|
188
|
+
return {
|
189
|
+
text: variableInfo.text,
|
190
|
+
type: this.transcludeType
|
191
|
+
};
|
192
|
+
}
|
193
|
+
} else {
|
194
|
+
// Transcluding a text reference
|
195
|
+
var parserInfo = this.wiki.getTextReferenceParserInfo(
|
196
|
+
this.transcludeTitle,
|
197
|
+
this.transcludeField,
|
198
|
+
this.transcludeIndex,
|
199
|
+
{
|
200
|
+
subTiddler: this.transcludeSubTiddler,
|
201
|
+
defaultType: this.transcludeType
|
202
|
+
});
|
203
|
+
return {
|
204
|
+
text: parserInfo.text,
|
205
|
+
type: parserInfo.type
|
206
|
+
};
|
171
207
|
}
|
208
|
+
};
|
209
|
+
|
210
|
+
/*
|
211
|
+
Get transcluded parse tree nodes as an object {text:,type:,parseTreeNodes:,parseAsInline:}
|
212
|
+
*/
|
213
|
+
TranscludeWidget.prototype.parseTransclusionTarget = function(parseAsInline) {
|
214
|
+
var self = this;
|
172
215
|
var parser;
|
173
216
|
// Get the parse tree
|
174
217
|
if(this.hasAttribute("$variable")) {
|
@@ -234,7 +277,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|
234
277
|
}
|
235
278
|
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
|
236
279
|
});
|
237
|
-
} else if(srcVariable &&
|
280
|
+
} else if(srcVariable && !srcVariable.isFunctionDefinition) {
|
238
281
|
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
239
282
|
parser = {
|
240
283
|
tree: [
|
@@ -265,27 +308,14 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|
265
308
|
defaultType: this.transcludeType
|
266
309
|
});
|
267
310
|
}
|
268
|
-
// Set 'thisTiddler'
|
269
|
-
this.setVariable("thisTiddler",this.transcludeTitle);
|
270
311
|
// Return the parse tree
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
};
|
279
|
-
} else {
|
280
|
-
// If there's no parse tree then return the missing slot value
|
281
|
-
return {
|
282
|
-
parser: null,
|
283
|
-
parseTreeNodes: (this.slotFillParseTrees["ts-missing"] || []),
|
284
|
-
parseAsInline: parseAsInline,
|
285
|
-
text: null,
|
286
|
-
type: null
|
287
|
-
};
|
288
|
-
}
|
312
|
+
return {
|
313
|
+
parser: parser,
|
314
|
+
parseTreeNodes: parser ? parser.tree : (this.slotFillParseTrees["ts-missing"] || []),
|
315
|
+
parseAsInline: parseAsInline,
|
316
|
+
text: parser && parser.source,
|
317
|
+
type: parser && parser.type
|
318
|
+
};
|
289
319
|
};
|
290
320
|
|
291
321
|
/*
|
@@ -719,44 +719,23 @@ Widget.prototype.findFirstDomNode = function() {
|
|
719
719
|
};
|
720
720
|
|
721
721
|
/*
|
722
|
-
|
723
|
-
*/
|
724
|
-
Widget.prototype.destroyChildren = function() {
|
725
|
-
$tw.utils.each(this.children,function(childWidget) {
|
726
|
-
childWidget.destroy();
|
727
|
-
});
|
728
|
-
};
|
729
|
-
/*
|
730
|
-
Legacy entry into destroy procedure
|
722
|
+
Remove any DOM nodes created by this widget or its children
|
731
723
|
*/
|
732
724
|
Widget.prototype.removeChildDomNodes = function() {
|
733
|
-
this.
|
734
|
-
};
|
735
|
-
/*
|
736
|
-
Default destroy
|
737
|
-
*/
|
738
|
-
Widget.prototype.destroy = function() {
|
739
|
-
// call children to remove their resources
|
740
|
-
this.destroyChildren();
|
741
|
-
// remove our resources
|
742
|
-
this.children = [];
|
743
|
-
this.removeLocalDomNodes();
|
744
|
-
};
|
745
|
-
|
746
|
-
/*
|
747
|
-
Remove any DOM nodes created by this widget
|
748
|
-
*/
|
749
|
-
Widget.prototype.removeLocalDomNodes = function() {
|
750
|
-
// If this widget has directly created DOM nodes, delete them and exit.
|
725
|
+
// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case
|
751
726
|
if(this.domNodes.length > 0) {
|
752
727
|
$tw.utils.each(this.domNodes,function(domNode) {
|
753
728
|
domNode.parentNode.removeChild(domNode);
|
754
729
|
});
|
755
730
|
this.domNodes = [];
|
731
|
+
} else {
|
732
|
+
// Otherwise, ask the child widgets to delete their DOM nodes
|
733
|
+
$tw.utils.each(this.children,function(childWidget) {
|
734
|
+
childWidget.removeChildDomNodes();
|
735
|
+
});
|
756
736
|
}
|
757
737
|
};
|
758
738
|
|
759
|
-
|
760
739
|
/*
|
761
740
|
Invoke the action widgets that are descendents of the current widget.
|
762
741
|
*/
|
package/core/modules/wiki.js
CHANGED
@@ -1086,7 +1086,7 @@ exports.getSubstitutedText = function(text,widget,options) {
|
|
1086
1086
|
output = $tw.utils.replaceString(output,new RegExp("\\$" + $tw.utils.escapeRegExp(substitute.name) + "\\$","mg"),substitute.value);
|
1087
1087
|
});
|
1088
1088
|
// Substitute any variable references with their values
|
1089
|
-
return output.replace(/\$\((
|
1089
|
+
return output.replace(/\$\(([^\)\$]+)\)\$/g, function(match,varname) {
|
1090
1090
|
return widget.getVariable(varname,{defaultValue: ""})
|
1091
1091
|
});
|
1092
1092
|
};
|
package/core/ui/EditTemplate.tid
CHANGED
package/core/ui/PageTemplate.tid
CHANGED
package/core/ui/RootTemplate.tid
CHANGED
package/core/ui/ViewTemplate.tid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
title: $:/config/OfficialPluginLibrary
|
2
2
|
tags: $:/tags/PluginLibrary
|
3
|
-
url: https://tiddlywiki.com/library/v5.3.
|
3
|
+
url: https://tiddlywiki.com/library/v5.3.1/index.html
|
4
4
|
caption: {{$:/language/OfficialPluginLibrary}}
|
5
5
|
|
6
6
|
{{$:/language/OfficialPluginLibrary/Hint}}
|
@@ -2,7 +2,8 @@ title: $:/config/ViewTemplateBodyFilters/
|
|
2
2
|
tags: $:/tags/ViewTemplateBodyFilter
|
3
3
|
|
4
4
|
stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]]
|
5
|
-
|
5
|
+
core-ui-tags: [tag[$:/tags/PageTemplate]] [tag[$:/tags/EditTemplate]] [tag[$:/tags/ViewTemplate]] [tag[$:/tags/KeyboardShortcut]] [tag[$:/tags/ImportPreview]] [tag[$:/tags/EditPreview]][tag[$:/tags/EditorToolbar]] [tag[$:/tags/Actions]] :then[[$:/core/ui/ViewTemplate/body/code]]
|
6
|
+
system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]]
|
6
7
|
code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]]
|
7
8
|
import: [field:plugin-type[import]then[$:/core/ui/ViewTemplate/body/import]]
|
8
9
|
plugin: [has[plugin-type]then[$:/core/ui/ViewTemplate/body/plugin]]
|
package/core/wiki/macros/toc.tid
CHANGED
@@ -7,7 +7,7 @@ tags: $:/tags/Macro
|
|
7
7
|
|
8
8
|
\define toc-caption()
|
9
9
|
\whitespace trim
|
10
|
-
<span class="tc-toc-caption">
|
10
|
+
<span class="tc-toc-caption tc-tiny-gap-left">
|
11
11
|
<$set name="tv-wikilinks" value="no">
|
12
12
|
<$transclude field="caption">
|
13
13
|
<$view field="title"/>
|
@@ -145,7 +145,7 @@ tags: $:/tags/Macro
|
|
145
145
|
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
146
146
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
147
147
|
<li class=<<toc-item-class>>>
|
148
|
-
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class=
|
148
|
+
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
|
149
149
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
150
150
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
151
151
|
<$transclude tiddler=<<toc-closed-icon>> />
|
@@ -1,3 +1,2 @@
|
|
1
1
|
title: $:/tags/ViewTemplateBodyFilter
|
2
|
-
list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default
|
3
|
-
|
2
|
+
list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/core-ui-advanced-search $:/config/ViewTemplateBodyFilters/core-ui-tags $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default
|