From 6f038e362e517606b3037a3f8b2e411e4418c16d Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Sun, 12 Mar 2023 17:49:15 +0100 Subject: [PATCH 1/5] External-js: fix index.html overwrites external wiki (#7356) --- editions/tw5.com/tiddlywiki.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlywiki.info b/editions/tw5.com/tiddlywiki.info index 1de8bdc87..7379908ee 100644 --- a/editions/tw5.com/tiddlywiki.info +++ b/editions/tw5.com/tiddlywiki.info @@ -52,7 +52,7 @@ "--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html", "--render","$:/core/templates/static.template.css","static/static.css","text/plain"], "external-js": [ - "--render","$:/core/save/offline-external-js","index.html","text/plain", + "--render","$:/core/save/offline-external-js","[[external-]addsuffixaddsuffix[.html]]","text/plain", "--render","$:/core/templates/tiddlywiki5.js","[[tiddlywikicore-]addsuffixaddsuffix[.js]]","text/plain"] }, "config": { From aa5a6627e65f46d534397753e79f2e577a951003 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sun, 12 Mar 2023 17:02:16 +0000 Subject: [PATCH 2/5] Revert "Use sticky flag to improve regexp search performance (#7297)" This reverts commit e313857822879187cda8ea1681a73b4a65ef845f. --- core/modules/parsers/parseutils.js | 17 ++++++++--------- core/modules/parsers/wikiparser/rules/html.js | 6 +++--- core/modules/parsers/wikiparser/rules/image.js | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/core/modules/parsers/parseutils.js b/core/modules/parsers/parseutils.js index 1c7525588..925674056 100644 --- a/core/modules/parsers/parseutils.js +++ b/core/modules/parsers/parseutils.js @@ -84,8 +84,7 @@ exports.parseTokenString = function(source,pos,token) { }; /* -Look for a token matching a regex at a specified position. Returns null if not found, otherwise returns {type: "regexp", match:, start:, end:,} -Use the "Y" (sticky) flag to avoid searching the entire rest of the string +Look for a token matching a regex. Returns null if not found, otherwise returns {type: "regexp", match:, start:, end:,} */ exports.parseTokenRegExp = function(source,pos,reToken) { var node = { @@ -146,7 +145,7 @@ exports.parseMacroParameter = function(source,pos) { start: pos }; // Define our regexp - var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|((?:(?:>(?!>))|[^\s>"'])+)))/y; + var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|((?:(?:>(?!>))|[^\s>"'])+)))/g; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Look for the parameter @@ -185,7 +184,7 @@ exports.parseMacroInvocation = function(source,pos) { params: [] }; // Define our regexps - var reMacroName = /([^\s>"'=]+)/y; + var reMacroName = /([^\s>"'=]+)/g; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Look for a double less than sign @@ -222,7 +221,7 @@ exports.parseFilterVariable = function(source) { params: [], }, pos = 0, - reName = /([^\s"']+)/y; + reName = /([^\s"']+)/g; // If there is no whitespace or it is an empty string then there are no macro parameters if(/^\S*$/.test(source)) { node.name = source; @@ -247,10 +246,10 @@ exports.parseAttribute = function(source,pos) { start: pos }; // Define our regexps - var reAttributeName = /([^\/\s>"'=]+)/y, - reUnquotedAttribute = /([^\/\s<>"'=]+)/y, - reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/y, - reIndirectValue = /\{\{([^\}]+)\}\}/y; + var reAttributeName = /([^\/\s>"'=]+)/g, + reUnquotedAttribute = /([^\/\s<>"'=]+)/g, + reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g, + reIndirectValue = /\{\{([^\}]+)\}\}/g; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Get the attribute name diff --git a/core/modules/parsers/wikiparser/rules/html.js b/core/modules/parsers/wikiparser/rules/html.js index fdaae03ba..7fc4bb96e 100644 --- a/core/modules/parsers/wikiparser/rules/html.js +++ b/core/modules/parsers/wikiparser/rules/html.js @@ -48,7 +48,7 @@ exports.parse = function() { // Advance the parser position to past the tag this.parser.pos = tag.end; // Check for an immediately following double linebreak - var hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/y); + var hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g); // Set whether we're in block mode tag.isBlock = this.is.block || hasLineBreak; // Parse the body if we need to @@ -78,7 +78,7 @@ exports.parseTag = function(source,pos,options) { orderedAttributes: [] }; // Define our regexps - var reTagName = /([a-zA-Z0-9\-\$]+)/y; + var reTagName = /([a-zA-Z0-9\-\$]+)/g; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Look for a less than sign @@ -129,7 +129,7 @@ exports.parseTag = function(source,pos,options) { pos = token.end; // Check for a required line break if(options.requireLineBreak) { - token = $tw.utils.parseTokenRegExp(source,pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/y); + token = $tw.utils.parseTokenRegExp(source,pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g); if(!token) { return null; } diff --git a/core/modules/parsers/wikiparser/rules/image.js b/core/modules/parsers/wikiparser/rules/image.js index 9bfce99d2..6b379d9c5 100644 --- a/core/modules/parsers/wikiparser/rules/image.js +++ b/core/modules/parsers/wikiparser/rules/image.js @@ -116,7 +116,7 @@ exports.parseImage = function(source,pos) { // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Get the source up to the terminating `]]` - token = $tw.utils.parseTokenRegExp(source,pos,/(?:([^|\]]*?)\|)?([^\]]+?)\]\]/y); + token = $tw.utils.parseTokenRegExp(source,pos,/(?:([^|\]]*?)\|)?([^\]]+?)\]\]/g); if(!token) { return null; } From 308e207a6778a3b6fe9544df20d637f23efa3d98 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sun, 12 Mar 2023 17:03:19 +0000 Subject: [PATCH 3/5] Remove reference to #7297 from release note --- editions/prerelease/tiddlers/Release 5.2.6.tid | 1 - 1 file changed, 1 deletion(-) diff --git a/editions/prerelease/tiddlers/Release 5.2.6.tid b/editions/prerelease/tiddlers/Release 5.2.6.tid index 3e4410a6a..f2c0ef4b3 100644 --- a/editions/prerelease/tiddlers/Release 5.2.6.tid +++ b/editions/prerelease/tiddlers/Release 5.2.6.tid @@ -100,7 +100,6 @@ Improvements to the following translations: ! Performance Improvements -* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7297">> wikitext parsing to use "sticky" flag for improved performance * <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7299">> field indexer to more efficiently process lookups ! Acknowledgements From 95f987544cf13c2acc9e1664db1f42eba5a9cc55 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 14 Mar 2023 14:50:52 +0000 Subject: [PATCH 4/5] Update save wiki "dirty" state icon See https://talk.tiddlywiki.org/t/now-is-the-time-to-help-with-testing-the-tiddlywiki-v5-2-6-prerelease/6405/60 Addendum to #7232 --- core/images/save-button-dynamic.tid | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/images/save-button-dynamic.tid b/core/images/save-button-dynamic.tid index d0aa13f83..02e66df17 100644 --- a/core/images/save-button-dynamic.tid +++ b/core/images/save-button-dynamic.tid @@ -5,8 +5,7 @@ tags: $:/tags/Image - - - + + \ No newline at end of file From c9e1b91099bbb2e93544433c04a26857f802a296 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sat, 18 Mar 2023 16:02:55 +0000 Subject: [PATCH 5/5] Simplify save wiki button dirty state Thanks to Thomas_Chuffart at https://talk.tiddlywiki.org/t/now-is-the-time-to-help-with-testing-the-tiddlywiki-v5-2-6-prerelease/6405/66 Addendum to #7232 --- core/images/save-button-dynamic.tid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/images/save-button-dynamic.tid b/core/images/save-button-dynamic.tid index 02e66df17..e88312aac 100644 --- a/core/images/save-button-dynamic.tid +++ b/core/images/save-button-dynamic.tid @@ -5,7 +5,7 @@ tags: $:/tags/Image - - + + \ No newline at end of file