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.
Files changed (111) hide show
  1. package/bin/build-site.sh +1 -1
  2. package/boot/boot.js +6 -7
  3. package/core/images/new-journal-button.tid +1 -3
  4. package/core/modules/parsers/wikiparser/rules/fnprocdef.js +2 -2
  5. package/core/modules/parsers/wikiparser/rules/parameters.js +1 -1
  6. package/core/modules/startup/rootwidget.js +1 -0
  7. package/core/modules/startup/startup.js +5 -0
  8. package/core/modules/utils/dom/dragndrop.js +4 -2
  9. package/core/modules/utils/dom/http.js +19 -3
  10. package/core/modules/widgets/checkbox.js +3 -1
  11. package/core/modules/widgets/importvariables.js +1 -1
  12. package/core/modules/widgets/select.js +4 -0
  13. package/core/modules/widgets/transclude.js +69 -39
  14. package/core/modules/widgets/widget.js +7 -28
  15. package/core/modules/wiki.js +1 -1
  16. package/core/ui/AlertTemplate.tid +1 -0
  17. package/core/ui/EditTemplate.tid +1 -0
  18. package/core/ui/ImportPreviews/Text.tid +1 -0
  19. package/core/ui/PageStylesheet.tid +1 -0
  20. package/core/ui/PageTemplate.tid +1 -0
  21. package/core/ui/RootTemplate.tid +1 -0
  22. package/core/ui/StoryTiddlerTemplate.tid +1 -0
  23. package/core/ui/ViewTemplate/body/default.tid +1 -0
  24. package/core/ui/ViewTemplate.tid +1 -0
  25. package/core/wiki/config/OfficialPluginLibrary.tid +1 -1
  26. package/core/wiki/config/ViewTemplateBodyFilters.multids +2 -1
  27. package/core/wiki/macros/toc.tid +2 -2
  28. package/core/wiki/tags/ViewTemplateBodyFilter.tid +1 -2
  29. package/editions/de-AT/tiddlers/external/tiddlywiki.files +1 -1
  30. package/editions/prerelease/tiddlers/{Release 5.3.1.tid → Release 5.3.2.tid } +30 -26
  31. package/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid +1 -1
  32. package/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid +1 -1
  33. package/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid +1 -1
  34. package/editions/test/tiddlers/tests/data/functions/IndentedFunctions.tid +24 -0
  35. package/editions/test/tiddlers/tests/data/functions/WikifiedFunctions.tid +1 -1
  36. package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgets.tid +23 -0
  37. package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgets2.tid +22 -0
  38. package/editions/test/tiddlers/tests/data/importvariables/WithSetWidgetsAndMacros.tid +29 -0
  39. package/editions/test/tiddlers/tests/data/procedures/Nested-indented.tid +20 -0
  40. package/editions/test/tiddlers/tests/data/procedures/TrailingNewlines.tid +22 -0
  41. package/editions/test/tiddlers/tests/data/transclude/CustomWidget-Simple-Indented.tid +33 -0
  42. package/editions/test/tiddlers/tests/data/transclude/Parameterised-Shortcut-ParametersIndented.tid +20 -0
  43. package/editions/test/tiddlers/tests/data/transclude/Procedures-Double-Underscore.tid +26 -0
  44. package/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid +5 -3
  45. package/editions/test/tiddlers/tests/test-filters.js +4 -4
  46. package/editions/tw5.com/tiddlers/community/resources/TiddlyWiki Posts.tid +3 -3
  47. package/editions/tw5.com/tiddlers/community/tutorials/GitHub Saver Tutorial by Mohammad.tid +5 -5
  48. package/editions/tw5.com/tiddlers/definitions/Git.tid +9 -0
  49. package/editions/tw5.com/tiddlers/definitions/GitHub.tid +6 -4
  50. package/editions/tw5.com/tiddlers/definitions/GitLab.tid +13 -0
  51. package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid +2 -0
  52. package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid +11 -1
  53. package/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid +2 -0
  54. package/editions/tw5.com/tiddlers/filters/substitute Operator.tid +3 -3
  55. package/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +1 -1
  56. package/editions/tw5.com/tiddlers/images/New Release Banner.png +0 -0
  57. package/editions/tw5.com/tiddlers/images/{New Release Banner.jpg.meta → New Release Banner.png.meta } +1 -1
  58. package/editions/tw5.com/tiddlers/macros/TagMacro.tid +3 -1
  59. package/editions/tw5.com/tiddlers/macros/examples/tag.tid +22 -1
  60. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid +2 -2
  61. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid +3 -3
  62. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid +3 -3
  63. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid +2 -2
  64. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid +2 -2
  65. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Random Dog.tid +90 -0
  66. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Zotero.tid +4 -3
  67. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid +4 -2
  68. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid +2 -2
  69. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid +3 -3
  70. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid +3 -3
  71. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid +4 -3
  72. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid +3 -3
  73. package/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid +2 -2
  74. package/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid +2 -2
  75. package/editions/tw5.com/tiddlers/pragmas/Pragmas.tid +3 -1
  76. package/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid +1 -1
  77. package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.1.tid +80 -0
  78. package/editions/tw5.com/tiddlers/releasenotes/Releases.tid +1 -1
  79. package/editions/tw5.com/tiddlers/releasenotes/TiddlyWiki Releases.tid +1 -1
  80. package/editions/tw5.com/tiddlers/{Saving on Browser with TiddlyStow.tid → saving/Saving on Browser with TiddlyStow.tid } +2 -2
  81. package/editions/tw5.com/tiddlers/saving/Saving to a Git service.tid +5 -1
  82. package/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid +8 -11
  83. package/editions/tw5.com/tiddlers/systemtags/SystemTag_ $__tags_Macro.tid +1 -1
  84. package/editions/tw5.com/tiddlers/variables/Behaviour of invoked variables depends on how the variable was declared.tid +52 -0
  85. package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter expression function call.tid +10 -0
  86. package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter operator parameter.tid +11 -0
  87. package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via normal wikitext.tid +11 -0
  88. package/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via widget attributes.tid +11 -0
  89. package/editions/tw5.com/tiddlers/variables/Variable Usage.tid +5 -49
  90. package/editions/tw5.com/tiddlers/widgets/ActionListopsWidget.tid +24 -2
  91. package/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid +2 -2
  92. package/editions/tw5.com/tiddlers/widgets/ListWidget.tid +3 -1
  93. package/editions/tw5.com/tiddlers/widgets/SelectWidget.tid +1 -1
  94. package/editions/tw5.com/tiddlers/widgets/examples/ActionListopsWidget (Examples).tid +12 -1
  95. package/editions/tw5.com/tiddlers/wikitext/Anchor Links using HTML.tid +1 -1
  96. package/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid +52 -19
  97. package/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid +5 -2
  98. package/editions/tw5.com/tiddlers/wikitext/Widget Attributes.tid +8 -3
  99. package/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid +1 -0
  100. package/languages/pl-PL/Help/savewikifolder.tid +17 -4
  101. package/languages/zh-Hans/Help/savewikifolder.tid +5 -1
  102. package/languages/zh-Hant/Help/savewikifolder.tid +5 -1
  103. package/licenses/cla-individual.md +10 -0
  104. package/package.json +1 -1
  105. package/plugins/tiddlywiki/googleanalytics/googleanalytics.js +1 -1
  106. package/plugins/tiddlywiki/googleanalytics/settings.tid +1 -3
  107. package/plugins/tiddlywiki/jasmine/jasmine-plugin.js +9 -2
  108. package/plugins/tiddlywiki/jasmine/startup.js +2 -1
  109. package/readme.md +1 -1
  110. package/themes/tiddlywiki/vanilla/base.tid +8 -7
  111. package/editions/tw5.com/tiddlers/images/New Release Banner.jpg +0 -0
package/bin/build-site.sh CHANGED
@@ -5,7 +5,7 @@
5
5
  # Default to the current version number for building the plugin library
6
6
 
7
7
  if [ -z "$TW5_BUILD_VERSION" ]; then
8
- TW5_BUILD_VERSION=v5.3.0
8
+ TW5_BUILD_VERSION=v5.3.1
9
9
  fi
10
10
 
11
11
  echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
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(){\n" + code + "\n;})();",
598
+ " (function(){" + code + "\n;})();\n",
600
599
  (!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
601
- " return exports;\n",
600
+ "\nreturn exports;\n",
602
601
  "})"
603
- ].join("\n");
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 + ": " + JSON.stringify(e) + "\n\n" + e.stack);
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 = /^\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
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\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
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;
@@ -26,7 +26,7 @@ Instantiate parse rule
26
26
  exports.init = function(parser) {
27
27
  this.parser = parser;
28
28
  // Regexp to match
29
- this.matchRegExp = /^\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
29
+ this.matchRegExp = /\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
30
30
  };
31
31
 
32
32
  /*
@@ -38,6 +38,7 @@ exports.startup = function() {
38
38
  url: params.url,
39
39
  method: params.method,
40
40
  body: params.body,
41
+ binary: params.binary,
41
42
  oncompletion: params.oncompletion,
42
43
  onprogress: params.onprogress,
43
44
  bindStatus: params["bind-status"],
@@ -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 (dragImageType === "blank") {
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
- } else {
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["bind-status"];
110
- this.bindProgress = options["bind-progress"];
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
- this.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
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 (this.checkboxListIndex) {
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
- // Get the parse tree nodes that we are transcluding
45
- var target = this.getTransclusionTarget(),
46
- parseTreeNodes = target.parseTreeNodes;
47
- this.sourceText = target.text;
48
- this.parserType = target.type;
49
- this.parseAsInline = target.parseAsInline;
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
- // No further processing required
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
- parseTreeNodes = [{type: "text", text: this.sourceText}];
64
+ target = this.getTransclusionTarget();
65
+ parseTreeNodes = [{type: "text", text: target.text}];
58
66
  break;
59
67
  default:
60
- // text/plain
61
- var plainText = this.wiki.renderText("text/plain",this.parserType,this.sourceText,{parentWidget: this});
62
- parseTreeNodes = [{type: "text", text: plainText}];
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 parse tree nodes as an object {parser:,text:,type:}
177
+ Get transcluded details as an object {text:,type:}
162
178
  */
163
179
  TranscludeWidget.prototype.getTransclusionTarget = function() {
164
180
  var self = this;
165
- // Determine whether we're being used in inline or block mode
166
- var parseAsInline = !this.parseTreeNode.isBlock;
167
- if(this.transcludeMode === "inline") {
168
- parseAsInline = true;
169
- } else if(this.transcludeMode === "block") {
170
- parseAsInline = false;
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 && (srcVariable.isMacroDefinition || !srcVariable.isFunctionDefinition)) {
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
- if(parser) {
272
- return {
273
- parser: parser,
274
- parseTreeNodes: parser.tree,
275
- parseAsInline: parseAsInline,
276
- text: parser.source,
277
- type: parser.type
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
- Entry into destroy procedure
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.destroy();
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
  */
@@ -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(/\$\((\w+)\)\$/g, function(match,varname) {
1089
+ return output.replace(/\$\(([^\)\$]+)\)\$/g, function(match,varname) {
1090
1090
  return widget.getVariable(varname,{defaultValue: ""})
1091
1091
  });
1092
1092
  };
@@ -1,3 +1,4 @@
1
+ code-body: yes
1
2
  title: $:/core/ui/AlertTemplate
2
3
 
3
4
  \whitespace trim
@@ -1,3 +1,4 @@
1
+ code-body: yes
1
2
  title: $:/core/ui/EditTemplate
2
3
 
3
4
  \define delete-edittemplate-state-tiddlers()
@@ -1,5 +1,6 @@
1
1
  title: $:/core/ui/ImportPreviews/Text
2
2
  tags: $:/tags/ImportPreview
3
3
  caption: {{$:/language/Import/Listing/Preview/Text}}
4
+ code-body: yes
4
5
 
5
6
  <$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode="block"/>
@@ -1,4 +1,5 @@
1
1
  title: $:/core/ui/PageStylesheet
2
+ code-body: yes
2
3
 
3
4
  \import [subfilter{$:/core/config/GlobalImportFilter}]
4
5
  \whitespace trim
@@ -2,6 +2,7 @@ title: $:/core/ui/PageTemplate
2
2
  name: {{$:/language/PageTemplate/Name}}
3
3
  description: {{$:/language/PageTemplate/Description}}
4
4
  icon: $:/core/images/layout-button
5
+ code-body: yes
5
6
 
6
7
  \whitespace trim
7
8
  \import [subfilter{$:/core/config/GlobalImportFilter}]
@@ -1,4 +1,5 @@
1
1
  title: $:/core/ui/RootTemplate
2
+ code-body: yes
2
3
 
3
4
  <$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/>
4
5
 
@@ -1,3 +1,4 @@
1
1
  title: $:/core/ui/StoryTiddlerTemplate
2
+ code-body: yes
2
3
 
3
4
  <$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/StoryTiddlerTemplateFilter]!is[draft]get[text]] :and[has[title]else[$:/core/ui/ViewTemplate]] }}} />
@@ -1,4 +1,5 @@
1
1
  title: $:/core/ui/ViewTemplate/body/default
2
+ code-body: yes
2
3
 
3
4
  <$transclude>
4
5
 
@@ -1,4 +1,5 @@
1
1
  title: $:/core/ui/ViewTemplate
2
+ code-body: yes
2
3
 
3
4
  \whitespace trim
4
5
  \define folded-state()
@@ -1,6 +1,6 @@
1
1
  title: $:/config/OfficialPluginLibrary
2
2
  tags: $:/tags/PluginLibrary
3
- url: https://tiddlywiki.com/library/v5.3.0/index.html
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
- system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/core/ui/]split[/]count[]compare:number:eq[4]] [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]]
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]]
@@ -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='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>">
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "tiddlers": [
3
3
  {
4
- "file": "../../../tw5.com/tiddlers/images/New Release Banner.jpg",
4
+ "file": "../../../tw5.com/tiddlers/images/New Release Banner.png",
5
5
  "fields": {
6
6
  "type": "image/jpeg",
7
7
  "title": "New Release Banner",