tiddlywiki 5.3.1 → 5.3.2

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 (364) hide show
  1. package/.github/workflows/ci.yml +9 -2
  2. package/bin/build-site.sh +25 -5
  3. package/bin/ci-test.sh +16 -0
  4. package/boot/boot.js +12 -0
  5. package/core/language/en-GB/Exporters.multids +1 -1
  6. package/core/language/en-GB/Help/commands.tid +1 -1
  7. package/core/language/en-GB/Help/savewikifolder.tid +2 -2
  8. package/core/language/en-GB/Help/server.tid +1 -1
  9. package/core/language/en-GB/Types/image_svg_xml.tid +1 -1
  10. package/core/language/en-GB/Types/image_x-icon.tid +1 -1
  11. package/core/modules/commands/savetiddlers.js +1 -1
  12. package/core/modules/editor/engines/framed.js +1 -1
  13. package/core/modules/editor/engines/simple.js +1 -1
  14. package/core/modules/filters/all.js +5 -5
  15. package/core/modules/filters/encodings.js +6 -2
  16. package/core/modules/filters/json-ops.js +95 -1
  17. package/core/modules/filters/listops.js +1 -0
  18. package/core/modules/parsers/textparser.js +5 -4
  19. package/core/modules/parsers/wikiparser/rules/conditional.js +120 -0
  20. package/core/modules/parsers/wikiparser/wikiparser.js +31 -8
  21. package/core/modules/savers/github.js +1 -1
  22. package/core/modules/startup/windows.js +2 -1
  23. package/core/modules/syncer.js +160 -122
  24. package/core/modules/utils/dom/dom.js +3 -3
  25. package/core/modules/utils/dom/http.js +1 -1
  26. package/core/modules/utils/fakedom.js +5 -1
  27. package/core/modules/utils/utils.js +27 -4
  28. package/core/modules/widgets/browse.js +10 -0
  29. package/core/modules/widgets/button.js +15 -3
  30. package/core/modules/widgets/checkbox.js +11 -0
  31. package/core/modules/widgets/draggable.js +16 -5
  32. package/core/modules/widgets/droppable.js +14 -2
  33. package/core/modules/widgets/image.js +19 -14
  34. package/core/modules/widgets/link.js +12 -2
  35. package/core/modules/widgets/list.js +176 -19
  36. package/core/modules/widgets/radio.js +4 -0
  37. package/core/modules/widgets/range.js +4 -0
  38. package/core/modules/widgets/scrollable.js +66 -1
  39. package/core/modules/widgets/select.js +34 -26
  40. package/core/modules/widgets/transclude.js +19 -6
  41. package/core/modules/widgets/widget.js +35 -19
  42. package/core/modules/wiki.js +2 -2
  43. package/core/templates/html-json-skinny-tiddler.tid +0 -1
  44. package/core/templates/html-json-tiddler.tid +1 -1
  45. package/core/templates/store.area.template.html.tid +4 -4
  46. package/core/ui/ControlPanel/Basics.tid +2 -2
  47. package/core/ui/EditTemplate/body/default.tid +12 -8
  48. package/core/ui/EditTemplate/fields.tid +2 -2
  49. package/core/ui/EditTemplate/type.tid +1 -1
  50. package/core/ui/EditorToolbar/preview.tid +6 -0
  51. package/core/ui/PageTemplate.tid +1 -1
  52. package/core/ui/ViewTemplate/subtitle.tid +2 -5
  53. package/core/wiki/config/OfficialPluginLibrary.tid +1 -1
  54. package/core/wiki/macros/colour-picker.tid +6 -6
  55. package/core/wiki/macros/image-picker.tid +5 -5
  56. package/core/wiki/macros/list.tid +95 -78
  57. package/core/wiki/macros/tabs.tid +9 -1
  58. package/core/wiki/macros/tag-picker.tid +2 -2
  59. package/core/wiki/macros/tag.tid +2 -1
  60. package/core/wiki/macros/toc.tid +2 -2
  61. package/editions/de-AT/tiddlers/HelloThere.tid +2 -2
  62. package/editions/de-AT/tiddlers/community/Fur_Entwickler.tid +1 -1
  63. package/editions/de-AT-server/tiddlers/system/favicon.png +0 -0
  64. package/editions/{es-ES-server/tiddlers/system/favicon.ico.meta → de-AT-server/tiddlers/system/favicon.png.meta} +1 -1
  65. package/editions/dev/tiddlers/images/favicon.png +0 -0
  66. package/editions/{de-AT-server/tiddlers/system/favicon.ico.meta → dev/tiddlers/images/favicon.png.meta} +1 -1
  67. package/editions/dev/tiddlers/new/HookMechanism.tid +28 -3
  68. package/editions/empty/tiddlywiki.info +5 -2
  69. package/editions/es-ES/tiddlers/Forums.tid +4 -5
  70. package/editions/es-ES/tiddlers/HelloThere.tid +2 -2
  71. package/editions/es-ES/tiddlers/Typography.tid +1 -1
  72. package/editions/es-ES/tiddlers/images/favicon.png +0 -0
  73. package/editions/{dev/tiddlers/images/favicon.ico.meta → es-ES/tiddlers/images/favicon.png.meta} +1 -1
  74. package/editions/es-ES/tiddlers/images/green_favicon.png +0 -0
  75. package/editions/es-ES/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
  76. package/editions/es-ES-server/tiddlers/system/favicon.png +0 -0
  77. package/editions/{es-ES/tiddlers/images/favicon.ico.meta → es-ES-server/tiddlers/system/favicon.png.meta} +1 -1
  78. package/editions/fr-FR/tiddlers/images/favicon.png +0 -0
  79. package/editions/fr-FR/tiddlers/images/favicon.png.meta +2 -0
  80. package/editions/fr-FR/tiddlers/images/green_favicon.png +0 -0
  81. package/editions/fr-FR/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
  82. package/editions/fr-FR-server/tiddlers/system/favicon.png +0 -0
  83. package/editions/fr-FR-server/tiddlers/system/favicon.png.meta +2 -0
  84. package/editions/highlightdemo/tiddlywiki.info +1 -1
  85. package/editions/ja-JP/tiddlers/images/favicon.png +0 -0
  86. package/editions/ja-JP/tiddlers/images/favicon.png.meta +2 -0
  87. package/editions/ja-JP/tiddlers/images/green_favicon.png +0 -0
  88. package/editions/ja-JP/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
  89. package/editions/katexdemo/tiddlywiki.info +1 -1
  90. package/editions/ko-KR/tiddlers/images/favicon.png +0 -0
  91. package/editions/ko-KR/tiddlers/images/favicon.png.meta +2 -0
  92. package/editions/ko-KR/tiddlers/images/green_favicon.png +0 -0
  93. package/editions/ko-KR/tiddlers/images/{green_favicon.ico.meta → green_favicon.png.meta} +1 -1
  94. package/editions/ko-KR-server/tiddlers/system/favicon.png +0 -0
  95. package/editions/ko-KR-server/tiddlers/system/favicon.png.meta +2 -0
  96. package/editions/pluginlibrary/tiddlywiki.info +2 -2
  97. package/editions/prerelease/tiddlers/{Release 5.3.2.tid → Release 5.3.3.tid } +23 -25
  98. package/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid +1 -1
  99. package/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid +1 -1
  100. package/editions/prerelease/tiddlers/system/favicon.png +0 -0
  101. package/editions/prerelease/tiddlers/system/favicon.png.meta +2 -0
  102. package/editions/prerelease/tiddlers/system/temp-my-scroll-position.tid +3 -0
  103. package/editions/resumebuilder/tiddlywiki.info +1 -1
  104. package/editions/server/tiddlywiki.info +1 -1
  105. package/editions/server-external-js/tiddlywiki.info +1 -1
  106. package/editions/test/playwright.spec.js +25 -0
  107. package/editions/test/tiddlers/tests/data/conditionals/Basic.tid +26 -0
  108. package/editions/test/tiddlers/tests/data/conditionals/BlockMode.tid +37 -0
  109. package/editions/test/tiddlers/tests/data/conditionals/Else.tid +26 -0
  110. package/editions/test/tiddlers/tests/data/conditionals/Elseif.tid +32 -0
  111. package/editions/test/tiddlers/tests/data/conditionals/MissingEndIf.tid +26 -0
  112. package/editions/test/tiddlers/tests/data/conditionals/MultipleResults.tid +12 -0
  113. package/editions/test/tiddlers/tests/data/conditionals/Nested.tid +38 -0
  114. package/editions/test/tiddlers/tests/data/conditionals/NestedElseif.tid +60 -0
  115. package/editions/test/tiddlers/tests/data/list-widget/WithExplicitTemplates.tid +29 -0
  116. package/editions/test/tiddlers/tests/data/list-widget/WithExplicitTemplatesInBlockMode.tid +32 -0
  117. package/editions/test/tiddlers/tests/data/list-widget/WithExplicitTemplatesOverriddenByAttributes.tid +33 -0
  118. package/editions/test/tiddlers/tests/data/list-widget/WithJoinTemplate.tid +30 -0
  119. package/editions/test/tiddlers/tests/data/list-widget/WithJoinTemplateInBlockMode.tid +32 -0
  120. package/editions/test/tiddlers/tests/data/list-widget/WithLimit.tid +25 -0
  121. package/editions/test/tiddlers/tests/data/list-widget/WithMissingTemplate.tid +26 -0
  122. package/editions/test/tiddlers/tests/data/transclude/CustomWidget-CodeblockOverride-TextParser.tid +20 -0
  123. package/editions/test/tiddlers/tests/data/transclude/Variable-Refreshing.tid +27 -0
  124. package/editions/test/tiddlers/tests/data/transclude/Variable-Static.tid +15 -0
  125. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/ButtonWidget-DataAttributes.tid +27 -0
  126. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/CheckboxWidget-DataAttributes.tid +22 -0
  127. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/DraggableWidget-DataAttributes.tid +27 -0
  128. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/DroppableWidget-DataAttributes.tid +27 -0
  129. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/LinkWidget-DataAttributes.tid +27 -0
  130. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/OrderedStyleAttributes.tid +15 -0
  131. package/editions/test/tiddlers/tests/data/widgets/DataAttributes/SelectWidget-DataAttributes.tid +27 -0
  132. package/editions/test/tiddlers/tests/data/widgets/ElementWidgetEventAttributes.tid +15 -0
  133. package/editions/test/tiddlers/tests/data/widgets/ElementWidgetStyleAttributes.tid +15 -0
  134. package/editions/test/tiddlers/tests/test-filters.js +1 -0
  135. package/editions/test/tiddlers/tests/test-json-filters.js +40 -0
  136. package/editions/test/tiddlers/tests/test-utils.js +23 -0
  137. package/editions/test/tiddlers/tests/test-widget.js +62 -0
  138. package/editions/tw.org/tiddlers/$__favicon.ico.png +0 -0
  139. package/editions/tw.org/tiddlywiki.info +1 -1
  140. package/editions/tw5.com/tiddlers/_tw_shared/favicons/classic.tiddlywiki.com.png +0 -0
  141. package/editions/tw5.com/tiddlers/_tw_shared/favicons/{classic.tiddlywiki.com.ico.meta → classic.tiddlywiki.com.png.meta} +1 -1
  142. package/editions/tw5.com/tiddlers/_tw_shared/favicons/links.tiddlywiki.org.png +0 -0
  143. package/editions/tw5.com/tiddlers/_tw_shared/favicons/{links.tiddlywiki.org.ico.meta → links.tiddlywiki.org.png.meta} +1 -1
  144. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.dev.png +0 -0
  145. package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.dev.ico.meta → tiddlywiki.com.dev.png.meta} +1 -1
  146. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.png +0 -0
  147. package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.ico.meta → tiddlywiki.com.png.meta} +1 -1
  148. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.prerelease.png +0 -0
  149. package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.prerelease.ico.meta → tiddlywiki.com.prerelease.png.meta} +1 -1
  150. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.upgrade.png +0 -0
  151. package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.com.upgrade.ico.meta → tiddlywiki.com.upgrade.png.meta} +1 -1
  152. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.org.png +0 -0
  153. package/editions/tw5.com/tiddlers/about/Archive.tid +82 -0
  154. package/editions/tw5.com/tiddlers/community/Chinese Community.tid +20 -0
  155. package/editions/tw5.com/tiddlers/community/editions/Tidme by oflg.tid +16 -0
  156. package/editions/tw5.com/tiddlers/community/plugins/FSRS4TW by oflg.tid +10 -0
  157. package/editions/tw5.com/tiddlers/community/resources/_Timimi_ Extension and executable by Riz.tid +3 -1
  158. package/editions/tw5.com/tiddlers/concepts/Macros.tid +7 -3
  159. package/editions/tw5.com/tiddlers/concepts/Title List.tid +5 -1
  160. package/editions/tw5.com/tiddlers/filters/decodebase64 Operator.tid +6 -1
  161. package/editions/tw5.com/tiddlers/filters/encodebase64 Operator.tid +6 -1
  162. package/editions/tw5.com/tiddlers/filters/examples/jsonset.tid +59 -0
  163. package/editions/tw5.com/tiddlers/filters/examples/jsonstringify Operator (Examples).tid +7 -5
  164. package/editions/tw5.com/tiddlers/filters/examples/stringify_Operator_(Examples).tid +5 -3
  165. package/editions/tw5.com/tiddlers/filters/jsonextract.tid +8 -0
  166. package/editions/tw5.com/tiddlers/filters/jsonget.tid +8 -0
  167. package/editions/tw5.com/tiddlers/filters/jsonset.tid +64 -0
  168. package/editions/tw5.com/tiddlers/filters/jsonstringify Operator.tid +14 -15
  169. package/editions/tw5.com/tiddlers/filters/jsontype.tid +8 -0
  170. package/editions/tw5.com/tiddlers/filters/stringify_Operator.tid +12 -15
  171. package/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid +1 -1
  172. package/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +6 -1
  173. package/editions/tw5.com/tiddlers/howtos/Constructing JSON tiddlers.tid +3 -3
  174. package/editions/tw5.com/tiddlers/images/Favicon template.svg +296 -0
  175. package/editions/tw5.com/tiddlers/images/Favicon template.svg.meta +3 -0
  176. package/editions/tw5.com/tiddlers/images/New Release Banner.png +0 -0
  177. package/editions/tw5.com/tiddlers/images/favicon.png +0 -0
  178. package/editions/tw5.com/tiddlers/images/favicon.png.meta +2 -0
  179. package/editions/tw5.com/tiddlers/images/green_favicon.png +0 -0
  180. package/editions/tw5.com/tiddlers/images/green_favicon.png.meta +2 -0
  181. package/editions/tw5.com/tiddlers/macros/CoreMacros.tid +1 -1
  182. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-window.tid +12 -5
  183. package/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-permalink.tid +1 -1
  184. package/editions/tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid +7 -3
  185. package/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid +3 -1
  186. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.0.tid +1 -0
  187. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.1.tid +1 -0
  188. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.10.tid +1 -0
  189. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.11.tid +1 -0
  190. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.12.tid +1 -0
  191. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.13.tid +1 -0
  192. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.14.tid +1 -0
  193. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.15.tid +1 -0
  194. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.16.tid +1 -0
  195. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.17.tid +1 -0
  196. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.18.tid +1 -0
  197. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.19.tid +1 -0
  198. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.2.tid +1 -0
  199. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.20.tid +1 -0
  200. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.21.tid +1 -0
  201. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.22.tid +1 -0
  202. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.23.tid +1 -0
  203. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.3.tid +1 -0
  204. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.4.tid +1 -0
  205. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.5.tid +1 -0
  206. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.6.tid +1 -0
  207. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.7.tid +1 -0
  208. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.8.tid +1 -0
  209. package/editions/tw5.com/tiddlers/releasenotes/Release 5.1.9.tid +1 -0
  210. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.0.tid +1 -0
  211. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.1.tid +1 -0
  212. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.2.tid +1 -0
  213. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.3.tid +1 -0
  214. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.4.tid +1 -0
  215. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.5.tid +1 -0
  216. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.6.tid +1 -0
  217. package/editions/tw5.com/tiddlers/releasenotes/Release 5.2.7.tid +1 -0
  218. package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.0.tid +1 -0
  219. package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.1.tid +8 -1
  220. package/editions/tw5.com/tiddlers/releasenotes/Release 5.3.2.tid +184 -0
  221. package/editions/tw5.com/tiddlers/releasenotes/Releases.tid +3 -1
  222. package/editions/tw5.com/tiddlers/system/tw5.com-styles.tid +5 -0
  223. package/editions/tw5.com/tiddlers/widgets/BrowseWidget.tid +3 -1
  224. package/editions/tw5.com/tiddlers/widgets/ButtonWidget.tid +3 -1
  225. package/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid +3 -1
  226. package/editions/tw5.com/tiddlers/widgets/Custom Widgets.tid +3 -1
  227. package/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid +3 -2
  228. package/editions/tw5.com/tiddlers/widgets/DroppableWidget.tid +3 -1
  229. package/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid +1 -1
  230. package/editions/tw5.com/tiddlers/widgets/ImageWidget.tid +2 -1
  231. package/editions/tw5.com/tiddlers/widgets/LinkWidget.tid +3 -1
  232. package/editions/tw5.com/tiddlers/widgets/ListWidget.tid +25 -2
  233. package/editions/tw5.com/tiddlers/widgets/RadioWidget.tid +3 -1
  234. package/editions/tw5.com/tiddlers/widgets/RangeWidget.tid +3 -1
  235. package/editions/tw5.com/tiddlers/widgets/ScrollableWidget.tid +27 -2
  236. package/editions/tw5.com/tiddlers/widgets/SelectWidget.tid +4 -1
  237. package/editions/tw5.com/tiddlers/widgets/SetWidget.tid +17 -1
  238. package/editions/tw5.com/tiddlers/widgets/TranscludeWidget.tid +2 -2
  239. package/editions/tw5.com/tiddlers/wikitext/Conditional Shortcut Syntax.tid +62 -0
  240. package/editions/tw5.com/tiddlers/wikitext/Transclusion and Substitution.tid +3 -3
  241. package/editions/tw5.com/tiddlywiki.info +9 -3
  242. package/editions/tw5.com-server/tiddlers/system/tiddlywiki.com.server.png +0 -0
  243. package/editions/tw5.com-server/tiddlers/system/tiddlywiki.com.server.png.meta +2 -0
  244. package/editions/zh-Hans/tiddlers/images/favicon.png +0 -0
  245. package/editions/zh-Hans/tiddlers/images/favicon.png.meta +2 -0
  246. package/editions/zh-Hans/tiddlers/images/green_favicon.png +0 -0
  247. package/editions/zh-Hans/tiddlers/images/green_favicon.png.meta +2 -0
  248. package/editions/zh-Hant/tiddlers/images/favicon.png +0 -0
  249. package/editions/zh-Hant/tiddlers/images/favicon.png.meta +2 -0
  250. package/editions/zh-Hant/tiddlers/images/green_favicon.png +0 -0
  251. package/editions/zh-Hant/tiddlers/images/green_favicon.png.meta +2 -0
  252. package/languages/de-DE/Exporters.multids +1 -1
  253. package/languages/de-DE/Help/commands.tid +2 -2
  254. package/languages/de-DE/Help/server.tid +1 -1
  255. package/languages/de-DE/Types/image_x-icon.tid +1 -1
  256. package/languages/es-ES/Buttons.multids +2 -0
  257. package/languages/es-ES/Fields.multids +4 -0
  258. package/languages/es-ES/Help/listen.tid +1 -1
  259. package/languages/es-ES/Help/savewikifolder.tid +16 -1
  260. package/languages/es-ES/Help/server.tid +1 -1
  261. package/languages/es-ES/Misc.multids +3 -0
  262. package/languages/es-ES/SiteTitle.tid +1 -1
  263. package/languages/pl-PL/Exporters.multids +1 -1
  264. package/languages/pl-PL/Help/commands.tid +1 -1
  265. package/languages/pl-PL/Help/savewikifolder.tid +3 -1
  266. package/languages/pl-PL/Help/server.tid +1 -1
  267. package/languages/zh-Hans/Exporters.multids +1 -1
  268. package/languages/zh-Hans/Help/commands.tid +1 -1
  269. package/languages/zh-Hans/Help/server.tid +1 -1
  270. package/languages/zh-Hans/Types/image_svg_xml.tid +1 -1
  271. package/languages/zh-Hans/Types/image_x-icon.tid +1 -1
  272. package/languages/zh-Hant/Exporters.multids +1 -1
  273. package/languages/zh-Hant/Help/commands.tid +1 -1
  274. package/languages/zh-Hant/Help/server.tid +1 -1
  275. package/languages/zh-Hant/Types/image_svg_xml.tid +1 -1
  276. package/languages/zh-Hant/Types/image_x-icon.tid +1 -1
  277. package/licenses/cla-individual.md +10 -0
  278. package/package.json +4 -1
  279. package/playwright.config.js +46 -0
  280. package/plugins/tiddlywiki/codemirror/styles.tid +5 -0
  281. package/plugins/tiddlywiki/comments/styles.tid +8 -8
  282. package/plugins/tiddlywiki/dynannotate/docs/readme.tid +1 -0
  283. package/plugins/tiddlywiki/dynannotate/modules/dynannotate.js +28 -27
  284. package/plugins/tiddlywiki/evernote/modules/enex-deserializer.js +82 -23
  285. package/plugins/tiddlywiki/evernote/readme.tid +1 -0
  286. package/plugins/tiddlywiki/evernote/samples/sample-enex-with-image.xml.enex +2 -2
  287. package/plugins/tiddlywiki/jasmine/run-wiki-based-tests.js +1 -1
  288. package/plugins/tiddlywiki/qrcode/barcodereader.js +90 -0
  289. package/plugins/tiddlywiki/qrcode/docs/barcodereader.tid +44 -0
  290. package/plugins/tiddlywiki/qrcode/{doc/usage.tid → docs/makeqr.tid} +4 -4
  291. package/plugins/tiddlywiki/qrcode/docs.tid +3 -0
  292. package/plugins/tiddlywiki/qrcode/{MakeContactQR.tid → examples/make/MakeContactQR.tid} +1 -1
  293. package/plugins/tiddlywiki/qrcode/{MakeGenericQR.tid → examples/make/MakeGenericQR.tid} +1 -1
  294. package/plugins/tiddlywiki/qrcode/{MakeWifiQR.tid → examples/make/MakeWifiQR.tid} +1 -1
  295. package/plugins/tiddlywiki/qrcode/examples/make/make.tid +5 -0
  296. package/plugins/tiddlywiki/qrcode/examples/read/BarCodeReader.tid +17 -0
  297. package/plugins/tiddlywiki/qrcode/examples/read/read.tid +5 -0
  298. package/plugins/tiddlywiki/qrcode/examples.tid +3 -0
  299. package/plugins/tiddlywiki/qrcode/files/html5-qrcode/LICENSE +201 -0
  300. package/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md +398 -0
  301. package/plugins/tiddlywiki/qrcode/files/html5-qrcode/html5-qrcode.min.js +1 -0
  302. package/plugins/tiddlywiki/qrcode/files/tiddlywiki.files +20 -4
  303. package/plugins/tiddlywiki/qrcode/makeqr.js +1 -1
  304. package/plugins/tiddlywiki/qrcode/plugin.info +1 -1
  305. package/plugins/tiddlywiki/qrcode/readme.tid +15 -0
  306. package/plugins/tiddlywiki/tiddlyweb/html-json-skinny-tiddler.tid +0 -1
  307. package/plugins/tiddlywiki/tiddlyweb/html-json-tiddler.tid +1 -2
  308. package/plugins/tiddlywiki/upgrade/UpgradeWizard.tid +2 -2
  309. package/plugins/tiddlywiki/upgrade/favicon.png +0 -0
  310. package/plugins/tiddlywiki/upgrade/favicon.png.meta +2 -0
  311. package/readme.md +1 -1
  312. package/themes/tiddlywiki/vanilla/base.tid +37 -7
  313. package/themes/tiddlywiki/vanilla/settings.multids +1 -1
  314. package/editions/de-AT-server/tiddlers/system/favicon.ico +0 -0
  315. package/editions/dev/tiddlers/images/favicon.ico +0 -0
  316. package/editions/es-ES/tiddlers/images/favicon.ico +0 -0
  317. package/editions/es-ES/tiddlers/images/green_favicon.ico +0 -0
  318. package/editions/es-ES-server/tiddlers/system/favicon.ico +0 -0
  319. package/editions/fr-FR/tiddlers/images/favicon.ico +0 -0
  320. package/editions/fr-FR/tiddlers/images/favicon.ico.meta +0 -2
  321. package/editions/fr-FR/tiddlers/images/green_favicon.ico +0 -0
  322. package/editions/fr-FR-server/tiddlers/system/favicon.ico +0 -0
  323. package/editions/fr-FR-server/tiddlers/system/favicon.ico.meta +0 -2
  324. package/editions/ja-JP/tiddlers/images/favicon.ico +0 -0
  325. package/editions/ja-JP/tiddlers/images/favicon.ico.meta +0 -2
  326. package/editions/ja-JP/tiddlers/images/green_favicon.ico +0 -0
  327. package/editions/ko-KR/tiddlers/images/favicon.ico +0 -0
  328. package/editions/ko-KR/tiddlers/images/favicon.ico.meta +0 -2
  329. package/editions/ko-KR/tiddlers/images/green_favicon.ico +0 -0
  330. package/editions/ko-KR-server/tiddlers/system/favicon.ico +0 -0
  331. package/editions/ko-KR-server/tiddlers/system/favicon.ico.meta +0 -2
  332. package/editions/prerelease/tiddlers/system/favicon.ico +0 -0
  333. package/editions/prerelease/tiddlers/system/favicon.ico.meta +0 -2
  334. package/editions/tw5.com/tiddlers/_tw_shared/favicons/classic.tiddlywiki.com.ico +0 -0
  335. package/editions/tw5.com/tiddlers/_tw_shared/favicons/links.tiddlywiki.org.ico +0 -0
  336. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.dev.ico +0 -0
  337. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.ico +0 -0
  338. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.prerelease.ico +0 -0
  339. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.upgrade.ico +0 -0
  340. package/editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.org.ico +0 -0
  341. package/editions/tw5.com/tiddlers/community/editions/TiddlyMemo by oflg.tid +0 -16
  342. package/editions/tw5.com/tiddlers/community/tutorials/Install and run TiddlyWiki on a CentOS 6 VPS using Nginx.tid +0 -16
  343. package/editions/tw5.com/tiddlers/images/favicon.ico +0 -0
  344. package/editions/tw5.com/tiddlers/images/favicon.ico.meta +0 -2
  345. package/editions/tw5.com/tiddlers/images/green_favicon.ico +0 -0
  346. package/editions/tw5.com/tiddlers/images/green_favicon.ico.meta +0 -2
  347. package/editions/tw5.com-server/tiddlers/system/favicon.ico +0 -0
  348. package/editions/tw5.com-server/tiddlers/system/favicon.ico.meta +0 -2
  349. package/editions/zh-Hans/tiddlers/images/favicon.ico +0 -0
  350. package/editions/zh-Hans/tiddlers/images/favicon.ico.meta +0 -2
  351. package/editions/zh-Hans/tiddlers/images/green_favicon.ico +0 -0
  352. package/editions/zh-Hans/tiddlers/images/green_favicon.ico.meta +0 -2
  353. package/editions/zh-Hant/tiddlers/images/favicon.ico +0 -0
  354. package/editions/zh-Hant/tiddlers/images/favicon.ico.meta +0 -2
  355. package/editions/zh-Hant/tiddlers/images/green_favicon.ico +0 -0
  356. package/editions/zh-Hant/tiddlers/images/green_favicon.ico.meta +0 -2
  357. package/plugins/tiddlywiki/qrcode/doc/examples.tid +0 -3
  358. package/plugins/tiddlywiki/qrcode/doc/readme.tid +0 -13
  359. package/plugins/tiddlywiki/upgrade/favicon.ico +0 -0
  360. package/plugins/tiddlywiki/upgrade/favicon.ico.meta +0 -2
  361. /package/editions/tw5.com/tiddlers/_tw_shared/favicons/{tiddlywiki.org.ico.meta → tiddlywiki.org.png.meta} +0 -0
  362. /package/plugins/tiddlywiki/qrcode/files/{LICENSE → qrcode/LICENSE} +0 -0
  363. /package/plugins/tiddlywiki/qrcode/files/{README.md → qrcode/README.md} +0 -0
  364. /package/plugins/tiddlywiki/qrcode/files/{qrcode.js → qrcode/qrcode.js} +0 -0
@@ -5,7 +5,7 @@ on:
5
5
  - master
6
6
  - tiddlywiki-com
7
7
  env:
8
- NODE_VERSION: "12"
8
+ NODE_VERSION: "18"
9
9
  jobs:
10
10
  test:
11
11
  runs-on: ubuntu-latest
@@ -14,7 +14,13 @@ jobs:
14
14
  - uses: actions/setup-node@v1
15
15
  with:
16
16
  node-version: "${{ env.NODE_VERSION }}"
17
- - run: "./bin/test.sh"
17
+ - run: "./bin/ci-test.sh"
18
+ - uses: actions/upload-artifact@v3
19
+ if: always()
20
+ with:
21
+ name: playwright-report
22
+ path: playwright-report/
23
+ retention-days: 30
18
24
  build-prerelease:
19
25
  runs-on: ubuntu-latest
20
26
  if: github.ref == 'refs/heads/master'
@@ -54,6 +60,7 @@ jobs:
54
60
  TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
55
61
  TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
56
62
  TW5_BUILD_OUTPUT: "./output"
63
+ TW5_BUILD_ARCHIVE: "./output"
57
64
  steps:
58
65
  - uses: actions/checkout@v2
59
66
  - uses: actions/setup-node@v1
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.1
8
+ TW5_BUILD_VERSION=v5.3.2
9
9
  fi
10
10
 
11
11
  echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
@@ -84,10 +84,27 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
84
84
 
85
85
  ######################################################
86
86
  #
87
- # Core distribution
87
+ # Core distributions
88
88
  #
89
89
  ######################################################
90
90
 
91
+ # Conditionally build archive if $TW5_BUILD_ARCHIVE variable is set, otherwise do nothing
92
+ #
93
+ # /archive/Empty-TiddlyWiki-<version>.html Empty archived version
94
+ # /archive/TiddlyWiki-<version>.html Full archived version
95
+
96
+ if [ -n "$TW5_BUILD_ARCHIVE" ]; then
97
+
98
+ node $TW5_BUILD_TIDDLYWIKI \
99
+ $TW5_BUILD_MAIN_EDITION \
100
+ --verbose \
101
+ --version \
102
+ --load $TW5_BUILD_OUTPUT/build.tid \
103
+ --output $TW5_BUILD_ARCHIVE \
104
+ --build archive \
105
+ || exit 1
106
+ fi
107
+
91
108
  # /index.html Main site
92
109
  # /favicon.ico Favicon for main site
93
110
  # /static.html Static rendering of default tiddlers
@@ -95,6 +112,7 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
95
112
  # /static/* Static single tiddlers
96
113
  # /static/static.css Static stylesheet
97
114
  # /static/favicon.ico Favicon for static pages
115
+
98
116
  node $TW5_BUILD_TIDDLYWIKI \
99
117
  $TW5_BUILD_MAIN_EDITION \
100
118
  --verbose \
@@ -104,13 +122,15 @@ node $TW5_BUILD_TIDDLYWIKI \
104
122
  --build favicon static index \
105
123
  || exit 1
106
124
 
107
- # /empty.html Empty
108
- # /empty.hta For Internet Explorer
125
+ # /empty.html Empty
126
+ # /empty.hta For Internet Explorer
127
+ # /empty-external-core.html External core empty
128
+ # /tiddlywikicore-<version>.js Core plugin javascript
109
129
  node $TW5_BUILD_TIDDLYWIKI \
110
130
  ./editions/empty \
111
131
  --verbose \
112
132
  --output $TW5_BUILD_OUTPUT \
113
- --build empty \
133
+ --build empty emptyexternalcore \
114
134
  || exit 1
115
135
 
116
136
 
package/bin/ci-test.sh ADDED
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ # test TiddlyWiki5 for tiddlywiki.com
4
+
5
+ node ./tiddlywiki.js \
6
+ ./editions/test \
7
+ --verbose \
8
+ --version \
9
+ --rendertiddler $:/core/save/all test.html text/plain \
10
+ --test \
11
+ || exit 1
12
+
13
+ npm install playwright @playwright/test
14
+ npx playwright install chromium firefox --with-deps
15
+
16
+ npx playwright test
package/boot/boot.js CHANGED
@@ -2674,6 +2674,18 @@ $tw.hooks.addHook = function(hookName,definition) {
2674
2674
  }
2675
2675
  };
2676
2676
 
2677
+ /*
2678
+ Delete hooks from the hashmap
2679
+ */
2680
+ $tw.hooks.removeHook = function(hookName,definition) {
2681
+ if($tw.utils.hop($tw.hooks.names,hookName)) {
2682
+ var p = $tw.hooks.names[hookName].indexOf(definition);
2683
+ if(p !== -1) {
2684
+ $tw.hooks.names[hookName].splice(p, 1);
2685
+ }
2686
+ }
2687
+ };
2688
+
2677
2689
  /*
2678
2690
  Invoke the hook by key
2679
2691
  */
@@ -3,4 +3,4 @@ title: $:/language/Exporters/
3
3
  StaticRiver: Static HTML
4
4
  JsonFile: JSON file
5
5
  CsvFile: CSV file
6
- TidFile: ".tid" file
6
+ TidFile: TID text file
@@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
10
10
  Examples
11
11
 
12
12
  ```
13
- --commands "[enlist{$:/build-commands-as-text}]"
13
+ --commands "[enlist:raw{$:/build-commands-as-text}]"
14
14
  ```
15
15
 
16
16
  ```
@@ -19,7 +19,7 @@ The following options are supported:
19
19
  ** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder
20
20
  ** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder
21
21
 
22
- Note that both ''explodePlugins'' options will produce wiki folders that build the same exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
22
+ Note that both ''explodePlugins'' options will produce wiki folders that build the exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
23
23
 
24
24
  A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
25
25
 
@@ -31,4 +31,4 @@ Save the plugin to the tiddlers directory of the target wiki folder:
31
31
 
32
32
  ```
33
33
  tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder explodePlugins=no
34
- ```
34
+ ```
@@ -1,5 +1,5 @@
1
1
  title: $:/language/Help/server
2
- description: Provides an HTTP server interface to TiddlyWiki (deprecated in favour of the new listen command)
2
+ description: (deprecated: see 'listen' command) Provides an HTTP server interface to TiddlyWiki
3
3
 
4
4
  Legacy command to serve a wiki over HTTP.
5
5
 
@@ -1,5 +1,5 @@
1
1
  title: $:/language/Docs/Types/image/svg+xml
2
- description: Structured Vector Graphics image
2
+ description: SVG image
3
3
  name: image/svg+xml
4
4
  group: Image
5
5
  group-sort: 1
@@ -1,5 +1,5 @@
1
1
  title: $:/language/Docs/Types/image/x-icon
2
- description: ICO format icon file
2
+ description: ICO icon
3
3
  name: image/x-icon
4
4
  group: Image
5
5
  group-sort: 1
@@ -46,7 +46,7 @@ Command.prototype.execute = function() {
46
46
  type = tiddler.fields.type || "text/vnd.tiddlywiki",
47
47
  contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
48
48
  filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
49
- fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
49
+ fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
50
50
  });
51
51
  return null;
52
52
  };
@@ -60,7 +60,7 @@ function FramedEngine(options) {
60
60
  this.domNode.value = this.value;
61
61
  }
62
62
  // Set the attributes
63
- if(this.widget.editType) {
63
+ if(this.widget.editType && this.widget.editTag !== "textarea") {
64
64
  this.domNode.setAttribute("type",this.widget.editType);
65
65
  }
66
66
  if(this.widget.editPlaceholder) {
@@ -34,7 +34,7 @@ function SimpleEngine(options) {
34
34
  this.domNode.value = this.value;
35
35
  }
36
36
  // Set the attributes
37
- if(this.widget.editType) {
37
+ if(this.widget.editType && this.widget.editTag !== "textarea") {
38
38
  this.domNode.setAttribute("type",this.widget.editType);
39
39
  }
40
40
  if(this.widget.editPlaceholder) {
@@ -28,12 +28,8 @@ function getAllFilterOperators() {
28
28
  Export our filter function
29
29
  */
30
30
  exports.all = function(source,operator,options) {
31
- // Get our suboperators
32
- var allFilterOperators = getAllFilterOperators();
33
- // Cycle through the suboperators accumulating their results
34
- var results = new $tw.utils.LinkedList(),
35
- subops = operator.operand.split("+");
36
31
  // Check for common optimisations
32
+ var subops = operator.operand.split("+");
37
33
  if(subops.length === 1 && subops[0] === "") {
38
34
  return source;
39
35
  } else if(subops.length === 1 && subops[0] === "tiddlers") {
@@ -46,6 +42,10 @@ exports.all = function(source,operator,options) {
46
42
  return options.wiki.eachShadowPlusTiddlers;
47
43
  }
48
44
  // Do it the hard way
45
+ // Get our suboperators
46
+ var allFilterOperators = getAllFilterOperators();
47
+ // Cycle through the suboperators accumulating their results
48
+ var results = new $tw.utils.LinkedList();
49
49
  for(var t=0; t<subops.length; t++) {
50
50
  var subop = allFilterOperators[subops[t]];
51
51
  if(subop) {
@@ -18,16 +18,20 @@ Export our filter functions
18
18
 
19
19
  exports.decodebase64 = function(source,operator,options) {
20
20
  var results = [];
21
+ var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
22
+ var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
21
23
  source(function(tiddler,title) {
22
- results.push($tw.utils.base64Decode(title));
24
+ results.push($tw.utils.base64Decode(title,binary,urlsafe));
23
25
  });
24
26
  return results;
25
27
  };
26
28
 
27
29
  exports.encodebase64 = function(source,operator,options) {
28
30
  var results = [];
31
+ var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
32
+ var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
29
33
  source(function(tiddler,title) {
30
- results.push($tw.utils.base64Encode(title));
34
+ results.push($tw.utils.base64Encode(title,binary,urlsafe));
31
35
  });
32
36
  return results;
33
37
  };
@@ -68,6 +68,54 @@ exports["jsontype"] = function(source,operator,options) {
68
68
  return results;
69
69
  };
70
70
 
71
+ exports["jsonset"] = function(source,operator,options) {
72
+ var suffixes = operator.suffixes || [],
73
+ type = suffixes[0] && suffixes[0][0],
74
+ indexes = operator.operands.slice(0,-1),
75
+ value = operator.operands[operator.operands.length - 1],
76
+ results = [];
77
+ if(operator.operands.length === 1 && operator.operands[0] === "") {
78
+ value = undefined; // Prevents the value from being assigned
79
+ }
80
+ switch(type) {
81
+ case "string":
82
+ // Use value unchanged
83
+ break;
84
+ case "boolean":
85
+ value = (value === "true" ? true : (value === "false" ? false : undefined));
86
+ break;
87
+ case "number":
88
+ value = $tw.utils.parseNumber(value);
89
+ break;
90
+ case "array":
91
+ indexes = operator.operands;
92
+ value = [];
93
+ break;
94
+ case "object":
95
+ indexes = operator.operands;
96
+ value = {};
97
+ break;
98
+ case "null":
99
+ indexes = operator.operands;
100
+ value = null;
101
+ break;
102
+ case "json":
103
+ value = $tw.utils.parseJSONSafe(value,function() {return undefined;});
104
+ break;
105
+ default:
106
+ // Use value unchanged
107
+ break;
108
+ }
109
+ source(function(tiddler,title) {
110
+ var data = $tw.utils.parseJSONSafe(title,title);
111
+ if(data) {
112
+ data = setDataItem(data,indexes,value);
113
+ results.push(JSON.stringify(data));
114
+ }
115
+ });
116
+ return results;
117
+ };
118
+
71
119
  /*
72
120
  Given a JSON data structure and an array of index strings, return an array of the string representation of the values at the end of the index chain, or "undefined" if any of the index strings are invalid
73
121
  */
@@ -165,6 +213,18 @@ function getDataItemType(data,indexes) {
165
213
  }
166
214
  }
167
215
 
216
+ function getItemAtIndex(item,index) {
217
+ if($tw.utils.hop(item,index)) {
218
+ return item[index];
219
+ } else if($tw.utils.isArray(item)) {
220
+ index = $tw.utils.parseInt(index);
221
+ if(index < 0) { index = index + item.length };
222
+ return item[index]; // Will be undefined if index was out-of-bounds
223
+ } else {
224
+ return undefined;
225
+ }
226
+ }
227
+
168
228
  /*
169
229
  Given a JSON data structure and an array of index strings, return the value at the end of the index chain, or "undefined" if any of the index strings are invalid
170
230
  */
@@ -177,7 +237,7 @@ function getDataItem(data,indexes) {
177
237
  for(var i=0; i<indexes.length; i++) {
178
238
  if(item !== undefined) {
179
239
  if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
180
- item = item[indexes[i]];
240
+ item = getItemAtIndex(item,indexes[i]);
181
241
  } else {
182
242
  item = undefined;
183
243
  }
@@ -186,5 +246,39 @@ function getDataItem(data,indexes) {
186
246
  return item;
187
247
  }
188
248
 
249
+ /*
250
+ Given a JSON data structure, an array of index strings and a value, return the data structure with the value added at the end of the index chain. If any of the index strings are invalid then the JSON data structure is returned unmodified. If the root item is targetted then a different data object will be returned
251
+ */
252
+ function setDataItem(data,indexes,value) {
253
+ // Ignore attempts to assign undefined
254
+ if(value === undefined) {
255
+ return data;
256
+ }
257
+ // Check for the root item
258
+ if(indexes.length === 0 || (indexes.length === 1 && indexes[0] === "")) {
259
+ return value;
260
+ }
261
+ // Traverse the JSON data structure using the index chain
262
+ var current = data;
263
+ for(var i = 0; i < indexes.length - 1; i++) {
264
+ current = getItemAtIndex(current,indexes[i]);
265
+ if(current === undefined) {
266
+ // Return the original JSON data structure if any of the index strings are invalid
267
+ return data;
268
+ }
269
+ }
270
+ // Add the value to the end of the index chain
271
+ var lastIndex = indexes[indexes.length - 1];
272
+ if($tw.utils.isArray(current)) {
273
+ lastIndex = $tw.utils.parseInt(lastIndex);
274
+ if(lastIndex < 0) { lastIndex = lastIndex + current.length };
275
+ }
276
+ // Only set indexes on objects and arrays
277
+ if(typeof current === "object") {
278
+ current[lastIndex] = value;
279
+ }
280
+ return data;
281
+ }
282
+
189
283
  })();
190
284
 
@@ -58,6 +58,7 @@ Last entry/entries in list
58
58
  exports.last = function(source,operator,options) {
59
59
  var count = $tw.utils.getInt(operator.operand,1),
60
60
  results = [];
61
+ if(count === 0) return results;
61
62
  source(function(tiddler,title) {
62
63
  results.push(title);
63
64
  });
@@ -14,10 +14,12 @@ The plain text parser processes blocks of source text into a degenerate parse tr
14
14
 
15
15
  var TextParser = function(type,text,options) {
16
16
  this.tree = [{
17
- type: "codeblock",
17
+ type: "genesis",
18
18
  attributes: {
19
- code: {type: "string", value: text},
20
- language: {type: "string", value: type}
19
+ $type: {name: "$type", type: "string", value: "$codeblock"},
20
+ code: {name: "code", type: "string", value: text},
21
+ language: {name: "language", type: "string", value: type},
22
+ $remappable: {name: "$remappable", type:"string", value: "no"}
21
23
  }
22
24
  }];
23
25
  this.source = text;
@@ -32,4 +34,3 @@ exports["text/css"] = TextParser;
32
34
  exports["application/x-tiddler-dictionary"] = TextParser;
33
35
 
34
36
  })();
35
-
@@ -0,0 +1,120 @@
1
+ /*\
2
+ title: $:/core/modules/parsers/wikiparser/rules/conditional.js
3
+ type: application/javascript
4
+ module-type: wikirule
5
+
6
+ Conditional shortcut syntax
7
+
8
+ ```
9
+ This is a <% if [{something}] %>Elephant<% elseif [{else}] %>Pelican<% else %>Crocodile<% endif %>
10
+ ```
11
+
12
+ \*/
13
+ (function(){
14
+
15
+ /*jslint node: true, browser: true */
16
+ /*global $tw: false */
17
+ "use strict";
18
+
19
+ exports.name = "conditional";
20
+ exports.types = {inline: true, block: true};
21
+
22
+ exports.init = function(parser) {
23
+ this.parser = parser;
24
+ // Regexp to match
25
+ this.matchRegExp = /\<\%\s*if\s+/mg;
26
+ this.terminateIfRegExp = /\%\>/mg;
27
+ };
28
+
29
+ exports.findNextMatch = function(startPos) {
30
+ // Look for the next <% if shortcut
31
+ this.matchRegExp.lastIndex = startPos;
32
+ this.match = this.matchRegExp.exec(this.parser.source);
33
+ // If not found then return no match
34
+ if(!this.match) {
35
+ return undefined;
36
+ }
37
+ // Check for the next %>
38
+ this.terminateIfRegExp.lastIndex = this.match.index;
39
+ this.terminateIfMatch = this.terminateIfRegExp.exec(this.parser.source);
40
+ // If not found then return no match
41
+ if(!this.terminateIfMatch) {
42
+ return undefined;
43
+ }
44
+ // Return the position at which the construction was found
45
+ return this.match.index;
46
+ };
47
+
48
+ /*
49
+ Parse the most recent match
50
+ */
51
+ exports.parse = function() {
52
+ // Get the filter condition
53
+ var filterCondition = this.parser.source.substring(this.match.index + this.match[0].length,this.terminateIfMatch.index);
54
+ // Advance the parser position to past the %>
55
+ this.parser.pos = this.terminateIfMatch.index + this.terminateIfMatch[0].length;
56
+ // Parse the if clause
57
+ return this.parseIfClause(filterCondition);
58
+ };
59
+
60
+ exports.parseIfClause = function(filterCondition) {
61
+ // Create the list widget
62
+ var listWidget = {
63
+ type: "list",
64
+ tag: "$list",
65
+ isBlock: this.is.block,
66
+ children: [
67
+ {
68
+ type: "list-template",
69
+ tag: "$list-template"
70
+ },
71
+ {
72
+ type: "list-empty",
73
+ tag: "$list-empty"
74
+ }
75
+ ]
76
+ };
77
+ $tw.utils.addAttributeToParseTreeNode(listWidget,"filter",filterCondition);
78
+ $tw.utils.addAttributeToParseTreeNode(listWidget,"variable","condition");
79
+ $tw.utils.addAttributeToParseTreeNode(listWidget,"limit","1");
80
+ // Check for an immediately following double linebreak
81
+ var hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
82
+ // Parse the body looking for else or endif
83
+ var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>|\\<\\%\\s*(else)\\s*\\%\\>|\\<\\%\\s*(elseif)\\s+([\\s\\S]+?)\\%\\>",
84
+ ex;
85
+ if(hasLineBreak) {
86
+ ex = this.parser.parseBlocksTerminatedExtended(reEndString);
87
+ } else {
88
+ var reEnd = new RegExp(reEndString,"mg");
89
+ ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
90
+ }
91
+ // Put the body into the list template
92
+ listWidget.children[0].children = ex.tree;
93
+ // Check for an else or elseif
94
+ if(ex.match) {
95
+ if(ex.match[1] === "endif") {
96
+ // Nothing to do if we just found an endif
97
+ } else if(ex.match[2] === "else") {
98
+ // Check for an immediately following double linebreak
99
+ hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
100
+ // If we found an else then we need to parse the body looking for the endif
101
+ var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>",
102
+ ex;
103
+ if(hasLineBreak) {
104
+ ex = this.parser.parseBlocksTerminatedExtended(reEndString);
105
+ } else {
106
+ var reEnd = new RegExp(reEndString,"mg");
107
+ ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
108
+ }
109
+ // Put the parsed content inside the list empty template
110
+ listWidget.children[1].children = ex.tree;
111
+ } else if(ex.match[3] === "elseif") {
112
+ // Parse the elseif clause by reusing this parser, passing the new filter condition
113
+ listWidget.children[1].children = this.parseIfClause(ex.match[4]);
114
+ }
115
+ }
116
+ // Return the parse tree node
117
+ return [listWidget];
118
+ };
119
+
120
+ })();
@@ -194,6 +194,7 @@ Parse any pragmas at the beginning of a block of parse text
194
194
  WikiParser.prototype.parsePragmas = function() {
195
195
  var currentTreeBranch = this.tree;
196
196
  while(true) {
197
+ var savedPos = this.pos;
197
198
  // Skip whitespace
198
199
  this.skipWhitespace();
199
200
  // Check for the end of the text
@@ -204,6 +205,7 @@ WikiParser.prototype.parsePragmas = function() {
204
205
  var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
205
206
  // If not, just exit
206
207
  if(!nextMatch || nextMatch.matchIndex !== this.pos) {
208
+ this.pos = savedPos;
207
209
  break;
208
210
  }
209
211
  // Process the pragma rule
@@ -223,7 +225,7 @@ Parse a block from the current position
223
225
  terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
224
226
  */
225
227
  WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
226
- var terminatorRegExp = terminatorRegExpString ? new RegExp("(" + terminatorRegExpString + "|\\r?\\n\\r?\\n)","mg") : /(\r?\n\r?\n)/mg;
228
+ var terminatorRegExp = terminatorRegExpString ? new RegExp(terminatorRegExpString + "|\\r?\\n\\r?\\n","mg") : /(\r?\n\r?\n)/mg;
227
229
  this.skipWhitespace();
228
230
  if(this.pos >= this.sourceLength) {
229
231
  return [];
@@ -264,11 +266,21 @@ WikiParser.prototype.parseBlocksUnterminated = function() {
264
266
  };
265
267
 
266
268
  /*
267
- Parse blocks of text until a terminating regexp is encountered
269
+ Parse blocks of text until a terminating regexp is encountered. Wrapper for parseBlocksTerminatedExtended that just returns the parse tree
268
270
  */
269
271
  WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
270
- var terminatorRegExp = new RegExp("(" + terminatorRegExpString + ")","mg"),
271
- tree = [];
272
+ var ex = this.parseBlocksTerminatedExtended(terminatorRegExpString);
273
+ return ex.tree;
274
+ };
275
+
276
+ /*
277
+ Parse blocks of text until a terminating regexp is encountered
278
+ */
279
+ WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpString) {
280
+ var terminatorRegExp = new RegExp(terminatorRegExpString,"mg"),
281
+ result = {
282
+ tree: []
283
+ };
272
284
  // Skip any whitespace
273
285
  this.skipWhitespace();
274
286
  // Check if we've got the end marker
@@ -277,7 +289,7 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
277
289
  // Parse the text into blocks
278
290
  while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
279
291
  var blocks = this.parseBlock(terminatorRegExpString);
280
- tree.push.apply(tree,blocks);
292
+ result.tree.push.apply(result.tree,blocks);
281
293
  // Skip any whitespace
282
294
  this.skipWhitespace();
283
295
  // Check if we've got the end marker
@@ -286,8 +298,9 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
286
298
  }
287
299
  if(match && match.index === this.pos) {
288
300
  this.pos = match.index + match[0].length;
301
+ result.match = match;
289
302
  }
290
- return tree;
303
+ return result;
291
304
  };
292
305
 
293
306
  /*
@@ -330,6 +343,11 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
330
343
  };
331
344
 
332
345
  WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
346
+ var ex = this.parseInlineRunTerminatedExtended(terminatorRegExp,options);
347
+ return ex.tree;
348
+ };
349
+
350
+ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegExp,options) {
333
351
  options = options || {};
334
352
  var tree = [];
335
353
  // Find the next occurrence of the terminator
@@ -349,7 +367,10 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
349
367
  if(options.eatTerminator) {
350
368
  this.pos += terminatorMatch[0].length;
351
369
  }
352
- return tree;
370
+ return {
371
+ match: terminatorMatch,
372
+ tree: tree
373
+ };
353
374
  }
354
375
  }
355
376
  // Process any inline rule, along with the text preceding it
@@ -373,7 +394,9 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
373
394
  this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
374
395
  }
375
396
  this.pos = this.sourceLength;
376
- return tree;
397
+ return {
398
+ tree: tree
399
+ };
377
400
  };
378
401
 
379
402
  /*
@@ -31,7 +31,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
31
31
  headers = {
32
32
  "Accept": "application/vnd.github.v3+json",
33
33
  "Content-Type": "application/json;charset=UTF-8",
34
- "Authorization": "Basic " + window.btoa(username + ":" + password),
34
+ "Authorization": "Basic " + $tw.utils.base64Encode(username + ":" + password),
35
35
  "If-None-Match": ""
36
36
  };
37
37
  // Bail if we don't have everything we need
@@ -40,7 +40,7 @@ exports.startup = function() {
40
40
  variables = $tw.utils.extend({},paramObject,{currentTiddler: title, "tv-window-id": windowID});
41
41
  // Open the window
42
42
  var srcWindow,
43
- srcDocument;
43
+ srcDocument;
44
44
  // In case that popup blockers deny opening a new window
45
45
  try {
46
46
  srcWindow = window.open("","external-" + windowID,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
@@ -52,6 +52,7 @@ exports.startup = function() {
52
52
  $tw.windows[windowID] = srcWindow;
53
53
  // Check for reopening the same window
54
54
  if(srcWindow.haveInitialisedWindow) {
55
+ srcWindow.focus();
55
56
  return;
56
57
  }
57
58
  // Initialise the document