1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-29 23:40:45 +00:00

Merge branch 'master' into demo-alternate-store

This commit is contained in:
Jeremy Ruston 2023-07-22 11:06:06 +01:00
commit 7eeaa20e7e
16 changed files with 168 additions and 31 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
};
/*

View File

@ -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

View File

@ -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
""">>

View File

@ -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<factor>]
\end
\function multiplebysomething(first:ignored,factor:2)
[multiply<factor>multiply[2].dividebysomething[0.25]]
\end
<$text text={{{ [[4]function[multiplebysomething]] }}}/>
|
<$text text={{{ [[6]function[multiplebysomething],[ignored],[4]] }}}/>
+
title: ExpectedResult
<p>64|192</p>

View File

@ -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=<<y>>/>
\end beta
<$transclude $variable="beta" y={{{ [<x>addprefix<x>] }}}/>
\end alpha
<<alpha "Elephant">>
+
title: ExpectedResult
<p>ElephantElephant</p>

View File

@ -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
<<outer>>
+
title: ExpectedResult
<p>Paragraph 1</p><p>Paragraph 2</p>

View File

@ -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'>
</$transclude>
+
title: TiddlerOne
\whitespace trim
<!-- Define the <$my.widget> widget by defining a transcludable variable with that name -->
\widget $my.widget(one:'Jaguar')
\whitespace trim
<$text text=<<one>>/>
<$slot $name="ts-raw">
Whale
</$slot>
\end
<$my.widget one="Dingo">
Crocodile
</$my.widget>
<$my.widget one="BumbleBee">
Squirrel
</$my.widget>
<$my.widget/>
+
title: ExpectedResult
<p>DingoCrocodileBumbleBeeSquirrelJaguarWhale</p>

View File

@ -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=<<one>>/>
+
title: ExpectedResult
<p>FerretJaguar</p>

View File

@ -1,4 +1,4 @@
caption: TiddlyStow (experimental)
caption: ~TiddlyStow (experimental)
color: #FF8A65
created: 20230403170650008
delivery: Saver

View File

@ -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""">>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -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:
<<list-links "[tag[Pragmas]]">>

View File

@ -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.

View File

@ -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: <<colour muted-foreground>>;
}