diff --git a/boot/boot.js b/boot/boot.js index 4e99d4836..23c9fc1bb 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -596,11 +596,11 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) { // Add the code prologue and epilogue code = [ "(function(" + contextNames.join(",") + ") {", - " (function(){\n" + code + "\n;})();", + " (function(){" + code + "\n;})();\n", (!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "", - " return exports;\n", + "\nreturn exports;\n", "})" - ].join("\n"); + ].join(""); // Compile the code into a function var fn; diff --git a/core/modules/parsers/wikiparser/rules/fnprocdef.js b/core/modules/parsers/wikiparser/rules/fnprocdef.js index 5d0a8878b..3f21b8da7 100644 --- a/core/modules/parsers/wikiparser/rules/fnprocdef.js +++ b/core/modules/parsers/wikiparser/rules/fnprocdef.js @@ -35,7 +35,7 @@ Instantiate parse rule exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /^\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg; + this.matchRegExp = /\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg; }; /* @@ -53,7 +53,7 @@ exports.parse = function() { var reEnd; if(this.match[5]) { // If so, the end of the body is marked with \end - reEnd = new RegExp("(\\r?\\n\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg"); + reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg"); } else { // Otherwise, the end of the definition is marked by the end of the line reEnd = /($|\r?\n)/mg; diff --git a/core/modules/parsers/wikiparser/rules/parameters.js b/core/modules/parsers/wikiparser/rules/parameters.js index f288740aa..60bbd8901 100644 --- a/core/modules/parsers/wikiparser/rules/parameters.js +++ b/core/modules/parsers/wikiparser/rules/parameters.js @@ -26,7 +26,7 @@ Instantiate parse rule exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /^\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg; + this.matchRegExp = /\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg; }; /* diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 3b9a1de25..1e6beae25 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -13,7 +13,7 @@ Widget base class "use strict"; /* Maximum permitted depth of the widget tree for recursion detection */ -var MAX_WIDGET_TREE_DEPTH = 500; +var MAX_WIDGET_TREE_DEPTH = 1000; /* Create a widget object for a parse tree node diff --git a/editions/prerelease/tiddlers/Release 5.3.1.tid b/editions/prerelease/tiddlers/Release 5.3.1.tid index dcea04fb5..b950ef3f7 100644 --- a/editions/prerelease/tiddlers/Release 5.3.1.tid +++ b/editions/prerelease/tiddlers/Release 5.3.1.tid @@ -1,6 +1,6 @@ caption: 5.3.1 -created: 20230701133439630 -modified: 20230701133439630 +created: 20230720215100983 +modified: 20230720215100983 tags: ReleaseNotes title: Release 5.3.1 type: text/vnd.tiddlywiki @@ -27,7 +27,7 @@ Improvements to the following translations: ! Widget Improvements -* +* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7594">> ''tabindex'' attribute to SelectWidget ! Filter improvements @@ -35,23 +35,37 @@ Improvements to the following translations: ! Hackability Improvements -* +* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7611">> ImportVariablesWidget and [[Pragma: \import]] to trim whitespace when parsing tiddlers +* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/commit/9b2af1359614f4ad5afd05be7cf9853909334592"> [[WidgetMessage: tm-http-request]] to handle binary responses ([[demo|WidgetMessage: tm-http-request Example - Random Dog]]) ! Bug Fixes -* +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7595">> bindStatus and bindProgress parameters of [[WidgetMessage: tm-http-request]] +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7606">> attribute substitution to handle variables containing non-word characters ! Node.js Improvements * -! Performance Improvements +! Developer Improvements -* +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/6c7c21a87bdb0d8a00df1c14eea18912164e0b57">> overeager onload handler in Jasmine plugin +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/08bad90e51c45233a196333e101bbbf6ecf702ce">> ordering of shadow tiddler listings to not reflect order of insertion + +Currently shadow tiddler ordering depends upon the order in which the shadows appear in the plugin JSON ! Acknowledgements [[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki: <<.contributors """ +AnthonyMuscio +btheado +CrossEye +flibbles +hffqyd +pmario +saqimtiaz +stevesunypoly +twMat """>> diff --git a/editions/test/tiddlers/tests/data/functions/IndentedFunctions.tid b/editions/test/tiddlers/tests/data/functions/IndentedFunctions.tid new file mode 100644 index 000000000..206a8958e --- /dev/null +++ b/editions/test/tiddlers/tests/data/functions/IndentedFunctions.tid @@ -0,0 +1,24 @@ +title: Functions/Function/Indented +description: Indented function definition +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + + \whitespace trim + \function .dividebysomething(factor:0.5) + [divide] + \end + + \function multiplebysomething(first:ignored,factor:2) + [multiplymultiply[2].dividebysomething[0.25]] + \end + +<$text text={{{ [[4]function[multiplebysomething]] }}}/> +| +<$text text={{{ [[6]function[multiplebysomething],[ignored],[4]] }}}/> + ++ +title: ExpectedResult + +

64|192

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/procedures/Nested-indented.tid b/editions/test/tiddlers/tests/data/procedures/Nested-indented.tid new file mode 100644 index 000000000..75aaadb4c --- /dev/null +++ b/editions/test/tiddlers/tests/data/procedures/Nested-indented.tid @@ -0,0 +1,20 @@ +title: Procedures/Nested/Indented +description: Nested Procedures that are indented +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim +\procedure alpha(x) + \procedure beta(y) + <$text text=<>/> + \end beta +<$transclude $variable="beta" y={{{ [addprefix] }}}/> +\end alpha + +<> ++ +title: ExpectedResult + +

ElephantElephant

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/procedures/TrailingNewlines.tid b/editions/test/tiddlers/tests/data/procedures/TrailingNewlines.tid new file mode 100644 index 000000000..467235876 --- /dev/null +++ b/editions/test/tiddlers/tests/data/procedures/TrailingNewlines.tid @@ -0,0 +1,22 @@ +title: Procedures/TrailingNewlines +description: Trailing newlines in procedures must not be dropped +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\procedure inner() +Paragraph 1 + +Paragraph 2 +\end +\procedure outer() +<$macrocall $name=inner /> + +\end +<> + ++ +title: ExpectedResult + +

Paragraph 1

Paragraph 2

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/transclude/CustomWidget-Simple-Indented.tid b/editions/test/tiddlers/tests/data/transclude/CustomWidget-Simple-Indented.tid new file mode 100644 index 000000000..19945e6ea --- /dev/null +++ b/editions/test/tiddlers/tests/data/transclude/CustomWidget-Simple-Indented.tid @@ -0,0 +1,33 @@ +title: Transclude/CustomWidget/Simple/Indented +description: Custom widget definition indented +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim +<$transclude $tiddler='TiddlerOne' one='Ferret'> + ++ +title: TiddlerOne + +\whitespace trim + + \widget $my.widget(one:'Jaguar') + \whitespace trim + <$text text=<>/> + <$slot $name="ts-raw"> + Whale + + \end +<$my.widget one="Dingo"> + Crocodile + +<$my.widget one="BumbleBee"> + Squirrel + +<$my.widget/> ++ +title: ExpectedResult + +

DingoCrocodileBumbleBeeSquirrelJaguarWhale

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/transclude/Parameterised-Shortcut-ParametersIndented.tid b/editions/test/tiddlers/tests/data/transclude/Parameterised-Shortcut-ParametersIndented.tid new file mode 100644 index 000000000..90e9a90aa --- /dev/null +++ b/editions/test/tiddlers/tests/data/transclude/Parameterised-Shortcut-ParametersIndented.tid @@ -0,0 +1,20 @@ +title: Transclude/Parameterised/Shortcut/ParametersIndented +description: Simple parameterised transclusion using the parameters pragma (indented) +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim +<$transclude $tiddler='TiddlerOne' one='Ferret'/> +<$transclude $tiddler='TiddlerOne'/> ++ +title: TiddlerOne + +\whitespace trim + \parameters(one:'Jaguar') +<$text text=<>/> ++ +title: ExpectedResult + +

FerretJaguar

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/Saving on Browser with TiddlyStow.tid b/editions/tw5.com/tiddlers/Saving on Browser with TiddlyStow.tid index 870936ffc..5823ca30d 100644 --- a/editions/tw5.com/tiddlers/Saving on Browser with TiddlyStow.tid +++ b/editions/tw5.com/tiddlers/Saving on Browser with TiddlyStow.tid @@ -1,4 +1,4 @@ -caption: TiddlyStow (experimental) +caption: ~TiddlyStow (experimental) color: #FF8A65 created: 20230403170650008 delivery: Saver @@ -13,4 +13,4 @@ url: https://github.com/btheado/tiddlystow ''Link:'' {{!!url}} Tiddlystow saves TiddlyWiki files locally using the browser file system API (Chrome-based browsers currently). -This is a simple web page for loading a local TiddlyWiki file and storing it back to the same local file requiring no plugins or extensions. \ No newline at end of file +This is a simple web page for loading a local TiddlyWiki file and storing it back to the same local file requiring no plugins or extensions. diff --git a/editions/tw5.com/tiddlers/filters/substitute Operator.tid b/editions/tw5.com/tiddlers/filters/substitute Operator.tid index 85da915da..c7f98384e 100644 --- a/editions/tw5.com/tiddlers/filters/substitute Operator.tid +++ b/editions/tw5.com/tiddlers/filters/substitute Operator.tid @@ -18,9 +18,9 @@ The <<.op substitute>> operator replaces any placeholders in the input titles in # variables |placeholder syntax|description|h -|`$n$`|Text substitution of a parameter provided to the operator, where n is the position of the parameter starting with 1 for the first parameter. Unmatched placeholders pass through unchanged.| -|`$(varname)$`|Text substitution of a variable. Undefined variables are replaced with an empty string.| -|`${ filter expression }$`|Text substitution with the first result of evaluating the filter expression. | +|`$n$`|Text substitution of a parameter provided to the operator, where n is the position of the parameter starting with 1 for the first parameter. Unmatched placeholders pass through unchanged. | +|`$(varname)$`|Text substitution of a variable. Undefined variables are replaced with an empty string. | +|`${ filter expression }$`|Text substitution of the first result of evaluating a filter expression. In other words, if the filter returns multiple titles only the first one will be used. | <<.tip """Placeholders that contain square bracket characters are not valid filter syntax when used directly in a filter expression. However they can be provided as input to the <$macrocall $name=".op" _="substitute"/> operator as text references or variables""">> diff --git a/editions/tw5.com/tiddlers/images/New Release Banner.png b/editions/tw5.com/tiddlers/images/New Release Banner.png index 17925343e..fd859e411 100644 Binary files a/editions/tw5.com/tiddlers/images/New Release Banner.png and b/editions/tw5.com/tiddlers/images/New Release Banner.png differ diff --git a/editions/tw5.com/tiddlers/pragmas/Pragmas.tid b/editions/tw5.com/tiddlers/pragmas/Pragmas.tid index 46981c51e..0f18df7b6 100644 --- a/editions/tw5.com/tiddlers/pragmas/Pragmas.tid +++ b/editions/tw5.com/tiddlers/pragmas/Pragmas.tid @@ -1,5 +1,5 @@ created: 20220917112416666 -modified: 20230419103154329 +modified: 20230721064409436 tags: Concepts [[WikiText Parser Modes]] title: Pragmas type: text/vnd.tiddlywiki @@ -8,6 +8,8 @@ A <<.def pragma>> is a special component of WikiText that provides control over Pragmas occupy lines that start with `\`. They can only appear at the start of the text of a tiddler, but blank lines and comments are allowed between them. If a pragma appears in the main body of the text, it is treated as if it was ordinary text. +<<.from-version "5.2.6">> Pragmas can have preceding optional whitespace characters. + The following pragmas are available: <> diff --git a/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid b/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid index 5bbf79485..a625627be 100644 --- a/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid +++ b/editions/tw5.com/tiddlers/saving/Saving via a Minimal Web Server.tid @@ -1,4 +1,4 @@ -caption: tw5-server +caption: tw5server color: #70c9a0 community-author: hffqyd created: 20230302011710789 @@ -10,27 +10,23 @@ tags: Android Chrome Firefox [[Internet Explorer]] Linux Mac Opera Safari Saving title: Saving via a Minimal Web Server type: text/vnd.tiddlywiki -A local server for TiddlyWiki5 that saves and backups wikis, inspired by +A local mini binary server for TiddlyWiki5 that saves and backups wikis and uploads files for TiddlyWiki, inspired by [[tw5-server.rb | https://gist.github.com/jimfoltz/ee791c1bdd30ce137bc23cce826096da]]. -tw5-server provides features of: +tw5server provides features of: * Server for TiddlyWiki5, as well as other files (e.g. images used in TW5 `[img[images/*.png]]`); * Easy to save wiki via browsers; * Backup wiki in compress format (.gz), to save disk space; * Auto clean backups: keep one newest per previous month, keep all backups in current month. -* Upload files/images to server, for use in tiddlywiki as external links. -* Offer binary executable for Linux, macos and windows. +* Upload files/images to server via pressing button or drag-and-drop, for use in tiddlywiki as external links. +* Offer binary executable for Linux, macos, Android and windows. -Download executable script and binary at the github.com [[tw5-server|https://github.com/hffqyd/tw5-server]]. +Download executable binary at the github.com [[tw5-server|https://github.com/hffqyd/tw5-server]]. ! Usage ```bash -# python script: -python tw5-server.py -p 8000 -d ./ -b backup_dir - -# binary file: tw5server -a:192.168.0.10 -p:8000 -d:./ -b:backup -h usage help @@ -44,6 +40,7 @@ Backups auto-clean strategy: Keep all backups in current month, keep only the newest one for previous months. ``` -In Unix/Linux, just excute `./tw5-server.py` (with `chmod +x tw5-server.py`). +In Unix/Linux, maybe first `chmod +x tw5server`), then run it. +For Android version, run it in Termux, or some other terminals. Then go to http://localhost:8000 (or other address:port specified in command) in your web browser, and click on your wiki html file. diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index dcf4a1697..0feb2582e 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1172,6 +1172,11 @@ button.tc-btn-invisible.tc-remove-tag-button { margin-right: .1em; } +.tc-tiddler-title-icon svg { + width: 0.9em; + height: 0.9em; +} + .tc-system-title-prefix { color: <>; }