From a899aac92cb5ae4ebf9a623e0f39cae6cd682a3f Mon Sep 17 00:00:00 2001 From: Maurycy Zarzycki Date: Thu, 8 Dec 2022 14:48:45 +0100 Subject: [PATCH 1/8] Change first letter in two plugin-related buttons to be uppercase to be consistent with the button that appears earlier (#7103) --- core/language/en-GB/ControlPanel.multids | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index ca1739b76..d8321edbf 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -90,8 +90,8 @@ Plugins/Languages/Caption: Languages Plugins/Languages/Hint: Language pack plugins Plugins/NoInfoFound/Hint: No ''"<$text text=<>/>"'' found Plugins/NotInstalled/Hint: This plugin is not currently installed -Plugins/OpenPluginLibrary: open plugin library -Plugins/ClosePluginLibrary: close plugin library +Plugins/OpenPluginLibrary: Open plugin library +Plugins/ClosePluginLibrary: Close plugin library Plugins/PluginWillRequireReload: (requires reload) Plugins/Plugins/Caption: Plugins Plugins/Plugins/Hint: Plugins From c2d82ccb32a5638a98c5e8702a8c5e3041c551fe Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Fri, 9 Dec 2022 10:17:31 +0000 Subject: [PATCH 2/8] Update release note --- editions/prerelease/tiddlers/Release 5.2.4.tid | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editions/prerelease/tiddlers/Release 5.2.4.tid b/editions/prerelease/tiddlers/Release 5.2.4.tid index e21fe7d98..9f941cdcd 100644 --- a/editions/prerelease/tiddlers/Release 5.2.4.tid +++ b/editions/prerelease/tiddlers/Release 5.2.4.tid @@ -27,6 +27,7 @@ Improvements to the following translations: * Chinese * French +* German * Polish * Spanish * Japanese @@ -75,16 +76,19 @@ Improvements to the translation features of TiddlyWiki: * <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7043">> support for Unix epoch timestamps in [[date format strings|DateFormat]] * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7064">> the "big green download button" to use the defined palette colour * <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7063">> new hidden setting [[to use horizontal tabs for the "more" sidebar tab|Hidden Setting: More Tabs Horizontal]] - +* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/commit/bef11fe6a25fb849dee40c4aa4337d6a30daf0b4">> the [[external JavaScript templates|]] to allow the URL of the external script file to be configured ! Bug Fixes +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7099">> truncated search results on small screens +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7010">> table contents overflow on small screens * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/fb34df84ed41882c1c2a6ff54f0e908b43ef95a3">> "new image" keyboard shortcut not to assign journal tags * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/6987">> SelectWidget class to update if it uses a filter * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7017">> issue with wikification within the advanced search filter dropdown * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7057">> the table in $:/Import to avoid creating hidden empty rows * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7008">> advanced search keyboard shortcut not navigating correctly * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7083">> erroneous display of drafts within the advanced search filter dropdown +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7092">> backwards compatibility of new field editor cascade introduced in v5.2.3 ! Node.js Improvements @@ -111,7 +115,7 @@ AnthonyMuscio bestony btheado BramChen -carlo-columbo +carlo-colombo EvidentlyCube FlashSystems flibbles @@ -127,6 +131,7 @@ rmunn roma0104 saqimtiaz talha131 +Telumire tw-FRed twMat xcazin From 1118de319e4753eefe453025aebecb1ba3a910f2 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Fri, 9 Dec 2022 10:43:13 +0000 Subject: [PATCH 3/8] Update prerelease warning --- .../prerelease/tiddlers/system/TiddlyWiki Pre-release.tid | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid b/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid index 7dd4e1f01..96aee607c 100644 --- a/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid +++ b/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid @@ -1,7 +1,11 @@ title: TiddlyWiki Pre-release modified: 20150428204930183 -This is a pre-release build of TiddlyWiki, [[also available in empty form|https://tiddlywiki.com/prerelease/empty.html]]. It is provided for testing purposes. ''Please don't try to use it for anything important'' -- you should use the latest official release from https://tiddlywiki.com. +This is a pre-release build of TiddlyWiki provided for testing and review purposes. ''Please don't try to depend on the pre-release for anything important'' -- you should use the latest official release from https://tiddlywiki.com. + +All of the changes in this pre-release are provisional until it is released and they become frozen by our backwards compatibility policies. This is the perfect time to raise questions or make suggestions. Please [[open a ticket at GitHub|https://github.com/Jermolene/TiddlyWiki5/issues/new/choose]] or make a post at https://talk.tiddlywiki.org/. + +The pre-release is also available as an [[empty wiki|https://tiddlywiki.com/prerelease/empty.html]] ready for reuse. <$list filter="[tag[ReleaseNotes]!has[released]!sort[created]]">
From 0ce5788747571c29c659808f56508470e148450c Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 9 Dec 2022 18:31:23 +0000 Subject: [PATCH 4/8] Fixes for JSON operators (#7105) --- core/modules/filters/json-ops.js | 61 +++++++++++++---- .../prerelease/tiddlers/Release 5.2.4.tid | 2 +- .../test/tiddlers/tests/test-json-filters.js | 29 ++++++-- .../tiddlers/features/JSON in TiddlyWiki.tid | 2 +- .../tw5.com/tiddlers/filters/jsonextract.tid | 66 +++++++++++++++++++ editions/tw5.com/tiddlers/filters/jsonget.tid | 15 +++-- .../tw5.com/tiddlers/filters/jsonindexes.tid | 1 + .../tw5.com/tiddlers/filters/jsontype.tid | 1 + .../Reading data from JSON tiddlers.tid | 11 +++- 9 files changed, 161 insertions(+), 27 deletions(-) create mode 100644 editions/tw5.com/tiddlers/filters/jsonextract.tid diff --git a/core/modules/filters/json-ops.js b/core/modules/filters/json-ops.js index d5e8c33af..eabf6433e 100644 --- a/core/modules/filters/json-ops.js +++ b/core/modules/filters/json-ops.js @@ -17,9 +17,23 @@ exports["jsonget"] = function(source,operator,options) { source(function(tiddler,title) { var data = $tw.utils.parseJSONSafe(title,title); if(data) { - var item = getDataItemValueAsString(data,operator.operands); + var items = getDataItemValueAsStrings(data,operator.operands); + if(items !== undefined) { + results.push.apply(results,items); + } + } + }); + return results; +}; + +exports["jsonextract"] = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + var data = $tw.utils.parseJSONSafe(title,title); + if(data) { + var item = getDataItem(data,operator.operands); if(item !== undefined) { - results.push(item); + results.push(JSON.stringify(item)); } } }); @@ -31,9 +45,9 @@ exports["jsonindexes"] = function(source,operator,options) { source(function(tiddler,title) { var data = $tw.utils.parseJSONSafe(title,title); if(data) { - var item = getDataItemKeysAsStrings(data,operator.operands); - if(item !== undefined) { - results.push.apply(results,item); + var items = getDataItemKeysAsStrings(data,operator.operands); + if(items !== undefined) { + results.push.apply(results,items); } } }); @@ -57,11 +71,11 @@ exports["jsontype"] = function(source,operator,options) { /* 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 */ -function getDataItemValueAsString(data,indexes) { +function getDataItemValueAsStrings(data,indexes) { // Get the item var item = getDataItem(data,indexes); - // Return the item as a string - return convertDataItemValueToString(item); + // Return the item as a string list + return convertDataItemValueToStrings(item); } /* @@ -77,15 +91,34 @@ function getDataItemKeysAsStrings(data,indexes) { /* Return an array of the string representation of the values of a data item, or "undefined" if the item is undefined */ -function convertDataItemValueToString(item) { +function convertDataItemValueToStrings(item) { // Return the item as a string if(item === undefined) { - return item; + return undefined; + } else if(item === null) { + return ["null"] + } else if(typeof item === "object") { + var results = [],i,t; + if($tw.utils.isArray(item)) { + // Return all the items in arrays recursively + for(i=0; i> new GenesisWidget that allows the dynamic construction of another widget, where the name and attributes of the new widget can be dynamically determined, without needing to be known in advance -<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/6936">> new operators for reading and formatting JSON data: [[jsonget Operator]], [[jsonindexes Operator]], [[jsontype Operator]] and [[format Operator]] +<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/6936">> new operators for reading and formatting JSON data: [[jsonget Operator]], [[jsonindexes Operator]], [[jsontype Operator]], [[jsonextract Operator]] and [[format Operator]] ! Translation improvement diff --git a/editions/test/tiddlers/tests/test-json-filters.js b/editions/test/tiddlers/tests/test-json-filters.js index c892c2419..b7f4836d9 100644 --- a/editions/test/tiddlers/tests/test-json-filters.js +++ b/editions/test/tiddlers/tests/test-json-filters.js @@ -23,7 +23,7 @@ describe("json filter tests", function() { type: "application/json" },{ title: "Second", - text: '["une","deux","trois"]', + text: '["une","deux","trois",["quatre","cinq"]]', type: "application/json" },{ title: "Third", @@ -38,14 +38,14 @@ describe("json filter tests", function() { it("should support the jsonget operator", function() { expect(wiki.filterTiddlers("[{Third}jsonget[]]")).toEqual(["This is not JSON"]); - expect(wiki.filterTiddlers("[{First}jsonget[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']); + expect(wiki.filterTiddlers("[{Second}jsonget[]]")).toEqual(["une","deux","trois","quatre","cinq"]); + expect(wiki.filterTiddlers("[{First}jsonget[]]")).toEqual(["one","","1.618","four","five","six","true","false","null"]); expect(wiki.filterTiddlers("[{First}jsonget[a]]")).toEqual(["one"]); expect(wiki.filterTiddlers("[{First}jsonget[b]]")).toEqual([""]); expect(wiki.filterTiddlers("[{First}jsonget[missing-property]]")).toEqual([]); - expect(wiki.filterTiddlers("[{First}jsonget[d]]")).toEqual(['{"e":"four","f":["five","six",true,false,null]}']); - expect(wiki.filterTiddlers("[{First}jsonget[d]jsonget[f]]")).toEqual(['["five","six",true,false,null]']); + expect(wiki.filterTiddlers("[{First}jsonget[d]]")).toEqual(["four","five","six","true","false","null"]); expect(wiki.filterTiddlers("[{First}jsonget[d],[e]]")).toEqual(["four"]); - expect(wiki.filterTiddlers("[{First}jsonget[d],[f]]")).toEqual(['["five","six",true,false,null]']); + expect(wiki.filterTiddlers("[{First}jsonget[d],[f]]")).toEqual(["five","six","true","false","null"]); expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[0]]")).toEqual(["five"]); expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[1]]")).toEqual(["six"]); expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[2]]")).toEqual(["true"]); @@ -53,8 +53,25 @@ describe("json filter tests", function() { expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[4]]")).toEqual(["null"]); }); + it("should support the jsonextract operator", function() { + expect(wiki.filterTiddlers("[{Third}jsonextract[]]")).toEqual(['"This is not JSON"']); + expect(wiki.filterTiddlers("[{First}jsonextract[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']); + expect(wiki.filterTiddlers("[{First}jsonextract[a]]")).toEqual(['"one"']); + expect(wiki.filterTiddlers("[{First}jsonextract[b]]")).toEqual(['""']); + expect(wiki.filterTiddlers("[{First}jsonextract[missing-property]]")).toEqual([]); + expect(wiki.filterTiddlers("[{First}jsonextract[d]]")).toEqual(['{"e":"four","f":["five","six",true,false,null]}']); + expect(wiki.filterTiddlers("[{First}jsonextract[d]jsonextract[f]]")).toEqual(['["five","six",true,false,null]']); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[e]]")).toEqual(['"four"']); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[f]]")).toEqual(['["five","six",true,false,null]']); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[0]]")).toEqual(['"five"']); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[1]]")).toEqual(['"six"']); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[2]]")).toEqual(["true"]); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[3]]")).toEqual(["false"]); + expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[4]]")).toEqual(["null"]); + }); + it("should support the jsonindexes operator", function() { - expect(wiki.filterTiddlers("[{Second}jsonindexes[]]")).toEqual(["0","1","2"]); + expect(wiki.filterTiddlers("[{Second}jsonindexes[]]")).toEqual(["0","1","2","3"]); expect(wiki.filterTiddlers("[{First}jsonindexes[]]")).toEqual(["a","b","c","d"]); expect(wiki.filterTiddlers("[{First}jsonindexes[a]]")).toEqual([]); expect(wiki.filterTiddlers("[{First}jsonindexes[b]]")).toEqual([]); diff --git a/editions/tw5.com/tiddlers/features/JSON in TiddlyWiki.tid b/editions/tw5.com/tiddlers/features/JSON in TiddlyWiki.tid index 2f2edd09f..cd827ddb6 100644 --- a/editions/tw5.com/tiddlers/features/JSON in TiddlyWiki.tid +++ b/editions/tw5.com/tiddlers/features/JSON in TiddlyWiki.tid @@ -2,7 +2,7 @@ title: JSON in TiddlyWiki tags: Features type: text/vnd.tiddlywiki created: 20220427174702859 -modified: 20220427174702859 +modified: 20220611104737314 !! Introduction diff --git a/editions/tw5.com/tiddlers/filters/jsonextract.tid b/editions/tw5.com/tiddlers/filters/jsonextract.tid new file mode 100644 index 000000000..15517e110 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/jsonextract.tid @@ -0,0 +1,66 @@ +created: 20220611104737314 +modified: 20220611104737314 +tags: [[Filter Operators]] [[JSON Operators]] +title: jsonextract Operator +caption: jsonextract +op-purpose: retrieve the JSON string of a property from JSON strings +op-input: a selection of JSON strings +op-parameter: one or more indexes of the property to retrieve +op-output: the JSON string values of each of the retrieved properties + +<<.from-version "5.2.4">> See [[JSON in TiddlyWiki]] for background. + +The <<.op jsonextract>> operator is used to retrieve values from JSON data as JSON substrings. See also the following related operators: + +* <<.olink jsonget>> to retrieve the values of a property in JSON data +* <<.olink jsontype>> to retrieve the type of a JSON value +* <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array + +Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`. + +``` +{ + "a": "one", + "b": "", + "c": "three", + "d": { + "e": "four", + "f": [ + "five", + "six", + true, + false, + null + ], + "g": { + "x": "max", + "y": "may", + "z": "maize" + } + } +} +``` + +The following examples assume that this JSON data is contained in a variable called `jsondata`. + +The <<.op jsonextract>> operator uses multiple operands to specify the indexes of the property to retrieve. Values are returned as literal JSON strings: + +``` +[jsonextract[a]] --> "one" +[jsonextract[d],[e]] --> "four" +[jsonextract[d],[f],[0]] --> "five" +[jsonextract[d],[f]] --> ["five","six",true,false,null] +[jsonextract[d],[g]] --> {"x":"max","y":"may","z":"maize"} +``` + +Indexes can be dynamically composed from variables and transclusions: + +``` +[jsonextract,{!!field},[0]] +``` + +A subtlety is that the special case of a single blank operand is used to identify the root object. Thus: + +``` +[jsonextract[]] --> {"a":"one","b":"","c":"three","d":{"e":"four","f":["five","six",true,false,null],"g":{"x":"max","y":"may","z":"maize"}}} +``` diff --git a/editions/tw5.com/tiddlers/filters/jsonget.tid b/editions/tw5.com/tiddlers/filters/jsonget.tid index dbc247d7b..d9caa680e 100644 --- a/editions/tw5.com/tiddlers/filters/jsonget.tid +++ b/editions/tw5.com/tiddlers/filters/jsonget.tid @@ -10,10 +10,11 @@ op-output: the values of each of the retrieved properties <<.from-version "5.2.4">> See [[JSON in TiddlyWiki]] for background. -The <<.op jsonget>> operator is used to retrieve values from JSON data. See also the following related operators: +The <<.op jsonget>> operator is used to retrieve values from JSON data as strings. See also the following related operators: * <<.olink jsontype>> to retrieve the type of a JSON value * <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array +* <<.olink jsonextract>> to retrieve a JSON value as a string of JSON Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`. @@ -65,11 +66,11 @@ Boolean values and null are returned as normal strings. The <<.olink jsontype>> [jsontype[d],[f],[2]] --> "boolean" ``` -Using the <<.op jsonget>> operator to retrieve an object or an array returns a JSON string of the values. For example: +Using the <<.op jsonget>> operator to retrieve an object or an array returns a list of the values. For example: ``` -[jsonget[d],[f]] --> `["five","six",true,false,null]` -[jsonget[d],[g]] --> `{"x": "max","y": "may","z": "maize"}` +[jsonget[d],[f]] --> "five","six","true","false","null" +[jsonget[d],[g]] --> "max","may","maize" ``` The <<.olink jsonindexes>> operator retrieves the corresponding indexes: @@ -79,6 +80,12 @@ The <<.olink jsonindexes>> operator retrieves the corresponding indexes: [jsonindexes[d],[g]] --> "x", "y", "z" ``` +If the object or array contains nested child objects or arrays then the values are retrieved recursively and returned flattened into a list. For example: + +``` +[jsonget[d]] --> "four","five","six","true","false","null","max","may","maize" +``` + A subtlety is that the special case of a single blank operand is used to identify the root object. Thus: ``` diff --git a/editions/tw5.com/tiddlers/filters/jsonindexes.tid b/editions/tw5.com/tiddlers/filters/jsonindexes.tid index 933f0f101..605936a2f 100644 --- a/editions/tw5.com/tiddlers/filters/jsonindexes.tid +++ b/editions/tw5.com/tiddlers/filters/jsonindexes.tid @@ -14,6 +14,7 @@ The <<.op jsonindexes>> operator is used to retrieve the property names of JSON * <<.olink jsonget>> to retrieve the values of a property in JSON data * <<.olink jsontype>> to retrieve the type of a JSON value +* <<.olink jsonextract>> to retrieve a JSON value as a string of JSON Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`. diff --git a/editions/tw5.com/tiddlers/filters/jsontype.tid b/editions/tw5.com/tiddlers/filters/jsontype.tid index 766757af0..b88f865dd 100644 --- a/editions/tw5.com/tiddlers/filters/jsontype.tid +++ b/editions/tw5.com/tiddlers/filters/jsontype.tid @@ -14,6 +14,7 @@ The <<.op jsontype>> operator is used to retrieve the type of a property in JSON * <<.olink jsonget>> to retrieve the values of a property in JSON data * <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array +* <<.olink jsonextract>> to retrieve a JSON value as a string of JSON JSON supports the following data types: diff --git a/editions/tw5.com/tiddlers/howtos/Reading data from JSON tiddlers.tid b/editions/tw5.com/tiddlers/howtos/Reading data from JSON tiddlers.tid index acf482789..8f7968de0 100644 --- a/editions/tw5.com/tiddlers/howtos/Reading data from JSON tiddlers.tid +++ b/editions/tw5.com/tiddlers/howtos/Reading data from JSON tiddlers.tid @@ -1,11 +1,20 @@ created: 20220427174702859 -modified: 20220427171449102 +modified: 20220611104737314 tags: [[JSON in TiddlyWiki]] Learning title: Reading data from JSON tiddlers type: text/vnd.tiddlywiki See [[JSON in TiddlyWiki]] for an overview of using JSON in TiddlyWiki. +!! Filter Operators for Accessing JSON Data + +The following filter operators allow values to be read from JSON data: + +* <<.olink jsonget>> to retrieve the values of a property in JSON data +* <<.olink jsontype>> to retrieve the type of a JSON value +* <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array +* <<.olink jsonextract>> to retrieve a JSON value as a string of JSON + !! Text References for Accessing JSON Data [[Text references|TextReference]] are a simple shortcut syntax to look up the value of a named property. For example, if a [[DictionaryTiddler|DictionaryTiddlers]] called `MonthDays` contains: From cc47bb0330dc0c8facd829ea5fa5477373cfeb2a Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Sat, 10 Dec 2022 15:10:54 +0100 Subject: [PATCH 5/8] Improve readability for: Using the external JavaScript template (#7097) * Improve readability for: Using the external JavaScript template * remove the extra button --- ...Using the external JavaScript template.tid | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid b/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid index df21e9b16..918878b0d 100644 --- a/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid +++ b/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid @@ -1,22 +1,22 @@ created: 20180905075846391 -modified: 20210611055708739 +modified: 20221207112242775 tags: [[WebServer Guides]] title: Using the external JavaScript template type: text/vnd.tiddlywiki -You can use a special template to externalise TiddlyWiki's core code into a separate file. This configuration allows the browser to cache the core for improved efficiency. +You can use a special template to externalise ~TiddlyWiki's core code into a separate file. This configuration allows the browser to cache the core for improved efficiency. ! Background -TiddlyWiki in the single file configuration ordinarily packs everything into a single file: your data, and the ~JavaScript, CSS and HTML comprising TiddlyWiki itself. This lack of dependencies is usually very convenient: it means that it is impossible for the parts of a TiddlyWiki to become separated, and enormously improves the chances of it still functioning in the future. +~TiddlyWiki in the single file configuration ordinarily packs everything into a single file: your data, and the ~JavaScript, CSS and HTML comprising ~TiddlyWiki itself. This lack of dependencies is usually very convenient: it means that it is impossible for the parts of a ~TiddlyWiki to become separated, and enormously improves the chances of it still functioning in the future. However, there is some inefficiency in this arrangement because the core code is repeatedly loaded and saved every time the content of the wiki is saved. This inefficiency is partially ameliorated when working in the client server configuration because once the wiki is loaded by the browser the synchronisation process only transmits individual tiddlers back and forth to the server. -The remaining inefficiency when working in the client server configuration is that the single page wiki that is initially loaded will contain a copy of the entire core code of TiddlyWiki, making it impossible for the browser to cache it. +The remaining inefficiency when working in the client server configuration is that the single page wiki that is initially loaded will contain a copy of the entire core code of ~TiddlyWiki, making it impossible for the browser to cache it. -! Using the external JavaScript template with the client-server configuration +! Using the external ~JavaScript template with the client-server configuration -The mechanism is activated by setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js`. This template externalises TiddlyWiki's core JavaScript into a separate file. For example, the following command will start your server with caching enabled. It will transfer the wiki with two GET requests, and the core can be cached by the browser. +The mechanism is activated by setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js`. This template externalises ~TiddlyWiki's core ~JavaScript into a separate file. For example, the following command will start your server with caching enabled. It will transfer the wiki with two GET requests, and the core can be cached by the browser. ``` tiddlywiki YOUR_WIKI_FOLDER --listen 'root-tiddler=$:/core/save/all-external-js' use-browser-cache=yes @@ -38,11 +38,11 @@ tiddlywiki ./myNewWiki --build listen The above commands perform the following: * Create a new wiki with external JavaScript customization included. -* Start the server with external JavaScript enabled. The server listens on port 8080. Visit http://localhost:8080 in your browser. +* Start the server with external ~JavaScript enabled. The server listens on port 8080. Visit http://localhost:8080 in your browser. To customize your `--build listen` command, see [[tiddlywiki.info Files]] and [[ListenCommand]]. -! Using the external JavaScript template with the single file configuration +! Using the external ~JavaScript template with the single file configuration You can use the "external-js" template with your single file wiki, but this requires that you have ~TiddlyWiki's core ~JavaScript saved alongside your HTML file. You may prefer this configuration, for example, if you have several wikis on a ~WebDav server. (See: [[Saving via WebDAV]]) @@ -64,7 +64,7 @@ The files `index.html` and `tiddlywikicore-5.x.x.js` will be saved in your wiki !! Obtaining the ~TiddlyWiki core in the browser -To download a copy of the TiddlyWiki core JavaScript file from any existing TiddlyWiki, visit the system tiddler $:/core/ui/ExportTiddlyWikiCore and click the download button. (You can search for ''~ExportTiddlyWikiCore'' in the ''Shadows'' tab of $:/AdvancedSearch). +{{$:/core/ui/ExportTiddlyWikiCore}} !! Obtaining the ~TiddlyWiki core with Node.js @@ -87,7 +87,7 @@ tiddlywiki YOUR_WIKI_FOLDER --build tiddlywikicore <<.warning "This procedure is experimental, please take care to backup your data">> -Before you proceed, backup your wiki first! Follow the steps below to upgrade a single-file wiki with the external JavaScript template: +Before you proceed, backup your wiki first! Follow the steps below to upgrade a single-file wiki with the external ~JavaScript template: # Proceed with the [[Upgrade Process for Standalone TiddlyWikis|Upgrading]]. Your wiki will be converted to a full standalone HTML. From 3c81558d7487d66fe7c502cbf0c8c5be3182414d Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sat, 10 Dec 2022 14:23:28 +0000 Subject: [PATCH 6/8] Add introduction message to "Saving" tiddler Fixes #7095 --- editions/tw5.com/tiddlers/saving/Saving.tid | 13 ++++++++++--- editions/tw5.com/tiddlers/system/tw5.com-styles.tid | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/editions/tw5.com/tiddlers/saving/Saving.tid b/editions/tw5.com/tiddlers/saving/Saving.tid index 9b55b1d1d..85c5d47ae 100644 --- a/editions/tw5.com/tiddlers/saving/Saving.tid +++ b/editions/tw5.com/tiddlers/saving/Saving.tid @@ -32,9 +32,16 @@ type: text/vnd.tiddlywiki \define checkactions(item:"Linux") <$action-listops $tiddler=<> $subfilter="[[$item$]]"/> \end -<$vars stateTiddler=<> > -Available methods for saving changes with ~TiddlyWiki: +\define introduction-message() +
+
+Use the checkboxes to explore the methods of saving that work with your platform(s) +
+
+\end + +<$vars stateTiddler=<> >
@@ -56,7 +63,7 @@ Available methods for saving changes with ~TiddlyWiki:
<$wikify text=<> name="alltagsfilterwikified"> -<$list filter=<>> +<$list filter=<> emptyMessage=<>> {{||$:/_tw5.com-card-template}} diff --git a/editions/tw5.com/tiddlers/system/tw5.com-styles.tid b/editions/tw5.com/tiddlers/system/tw5.com-styles.tid index b446b363b..9818d3c30 100644 --- a/editions/tw5.com/tiddlers/system/tw5.com-styles.tid +++ b/editions/tw5.com/tiddlers/system/tw5.com-styles.tid @@ -122,6 +122,15 @@ type: text/vnd.tiddlywiki margin-left: 10px; } +.tc-saving-introduction { + display: flex; + justify-content: center; + text-align: center; + align-items: center; + padding: 4em; + font-style: italic; +} + .tc-cards { display: flex; flex-wrap: wrap; From 6e6efcafc9676332f8eed62984a197951b5c28f3 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Mon, 12 Dec 2022 08:45:38 +0000 Subject: [PATCH 7/8] Reword Grok TiddlyWiki card --- .../hellothere/thumbnails/HelloThumbnail - Grok TiddlyWiki.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/hellothere/thumbnails/HelloThumbnail - Grok TiddlyWiki.tid b/editions/tw5.com/tiddlers/hellothere/thumbnails/HelloThumbnail - Grok TiddlyWiki.tid index f076ced60..1fd773caa 100644 --- a/editions/tw5.com/tiddlers/hellothere/thumbnails/HelloThumbnail - Grok TiddlyWiki.tid +++ b/editions/tw5.com/tiddlers/hellothere/thumbnails/HelloThumbnail - Grok TiddlyWiki.tid @@ -5,4 +5,4 @@ image: Grok TiddlyWiki Banner caption: Grok ~TiddlyWiki link: "Grok TiddlyWiki" by Soren Bjornstad -A guided tutorial through ~TiddlyWiki \ No newline at end of file +Everything you need to know to get the best out of ~TiddlyWiki \ No newline at end of file From ed9cc84fb282123b9cfe09772dfe12bd57236520 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 13 Dec 2022 09:36:10 +0000 Subject: [PATCH 8/8] Remove erroneous references to en-GB language plugin en-GB is built into the core, and so does not have a separate language plugin --- editions/de-AT-server/tiddlywiki.info | 1 - editions/de-AT/tiddlywiki.info | 1 - editions/de-DE/tiddlywiki.info | 1 - editions/full/tiddlywiki.info | 1 - editions/introduction/tiddlywiki.info | 1 - editions/translators/tiddlywiki.info | 1 - 6 files changed, 6 deletions(-) diff --git a/editions/de-AT-server/tiddlywiki.info b/editions/de-AT-server/tiddlywiki.info index c09be1db8..ae2f709a1 100644 --- a/editions/de-AT-server/tiddlywiki.info +++ b/editions/de-AT-server/tiddlywiki.info @@ -11,7 +11,6 @@ "tiddlywiki/snowwhite" ], "languages": [ - "en-GB", "de-AT", "de-DE" ], diff --git a/editions/de-AT/tiddlywiki.info b/editions/de-AT/tiddlywiki.info index 7dc946416..55c72204f 100755 --- a/editions/de-AT/tiddlywiki.info +++ b/editions/de-AT/tiddlywiki.info @@ -13,7 +13,6 @@ "tiddlywiki/internals" ], "languages": [ - "en-GB", "de-AT", "de-DE" ], diff --git a/editions/de-DE/tiddlywiki.info b/editions/de-DE/tiddlywiki.info index 0cabd3f28..e1806f4a8 100755 --- a/editions/de-DE/tiddlywiki.info +++ b/editions/de-DE/tiddlywiki.info @@ -13,7 +13,6 @@ "tiddlywiki/internals" ], "languages": [ - "en-GB", "de-AT", "de-DE" ], diff --git a/editions/full/tiddlywiki.info b/editions/full/tiddlywiki.info index 0a716f60e..e5dc0b0f9 100644 --- a/editions/full/tiddlywiki.info +++ b/editions/full/tiddlywiki.info @@ -37,7 +37,6 @@ "de-AT", "de-DE", "el-GR", - "en-GB", "en-US", "es-ES", "fa-IR", diff --git a/editions/introduction/tiddlywiki.info b/editions/introduction/tiddlywiki.info index a638ec142..14c629414 100644 --- a/editions/introduction/tiddlywiki.info +++ b/editions/introduction/tiddlywiki.info @@ -24,7 +24,6 @@ "de-CH", "de-DE", "el-GR", - "en-GB", "en-US", "es-ES", "fa-IR", diff --git a/editions/translators/tiddlywiki.info b/editions/translators/tiddlywiki.info index b08c5ceda..b2cc4f7ba 100644 --- a/editions/translators/tiddlywiki.info +++ b/editions/translators/tiddlywiki.info @@ -12,7 +12,6 @@ "de-CH", "de-DE", "el-GR", - "en-GB", "en-US", "es-ES", "fa-IR",