* feat: enhance makepatches function to support multiple suffixes and JSON output format
* feat: add release notes for makepatches JSON output enhancement
* doc: update makepatches operator documentation to document new json output
* doc: add JSON output examples to makepatches and applypatches documentation
* chore: convert space indentations to tabs
* test: add tests for makepatches operator with JSON output support
* chore: change space to tab indentation
* test: add DiffMergePatch4 integration test for testing makepatches json output
* fix: remove superfluous heading character
* refactor the parsing of the makepatches suffixes
Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
* refactor: improve makepatches function for better readability and performance
* chore: apply style guide by collapsing consecutive variable assignments
* chore: remove extraneous tabs
---------
Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
* Fix regex for code block end detection in wikiparser
* Anchor the codeblock end fence to its own line
Close an empty code block without consuming the tiddler, while a fence
only counts when it stands alone on its line.
* Match the end fence with (^|\r?\n) so the empty block case closes at
the line start and a code line ending in ``` stays inside the block
* Add test-codeblock-parser.js covering empty blocks with language and
CRLF, delimiter newline handling, mid-line fences and a missing fence
* Move background action log inside platforms check
* Add change note for #9891
* Shorten change note
* Release notes: move #9891 from 5.4.1 to 5.5.0
PR #9891 is still open, so the background-action log change is planned for 5.5.0 instead of 5.4.1.
* Fix change-category for #9891 release note
is not a valid category; use instead.
* Fix the CSV parser blanking a table
getCellInfo read the loop variable i before its declaration, so hoisting made
it undefined and charAt(undefined) read the first character of the whole text.
Any CSV opening with a separator therefore returned every cell empty.
- Test the cell against the start of the cell rather than the hoisted i
- Keep a separator inside a quoted cell literal
- Cover the parser with tests
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Add a change note for the CSV fix
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Skip system tiddlers in back-indexer updates
Fix#9916: editing a system tiddler that links or transcludes another
tiddler made it a backlinks[]/backtranscludes[] source until the next
index rebuild (shipped since v5.3.4).
* Guard BackSubIndexer.update() with isSystemTiddler() on both sides,
matching the initial scan; this also skips parsing $:/StoryList on
every navigation
* Add test-back-indexer.js: regression guards plus adversarial probes
for shadow reveals and hostile __proto__ titles
* Add ChangeNote
* Fakedom: uppercase tagName for HTML elements per DOM spec
Browsers uppercase tagName for HTML elements. Other namespaces (SVG,
MathML, XML) preserve case. Fakedom now matches, so widget code can use
the natural `node.tagName === "OPTGROUP"` form in both environments.
https://dom.spec.whatwg.org/#dom-element-tagname
* Tests: cover fakedom tagName spec compliance
Three specs pin the DOM contract for tagName: uppercase for HTML
elements, case preservation for other namespaces, and non-mutating
reads. Includes the OPTGROUP predicate the select widget will rely on
once it can drop its defensive .toUpperCase() call.
https://dom.spec.whatwg.org/#dom-element-tagname
* Fakedom: empty or null namespace creates a no-namespace element
Per DOM spec, createElementNS("") and createElementNS(null) have to produce
elements with no namespace. Fakedom previously defaults both to HTML,
which made tagName incorrectly uppercase non-HTML elements.
createElement without arguments still defaults to HTML.
https://dom.spec.whatwg.org/#dom-document-createelementns
* Add ChangeNote
01d3cde96 refactored parseMacroParameterAsAttribute to use a
do/while(false) construct with break statements - this updates
parseAttribute with an analogous refactoring for consistency
* Fix invalid source positions in parse tree nodes
Several wikitext rules recorded start and end offsets that did not match
the source they represent. The offsets are only used for source position
mapping, not rendering or serialization, so output is unchanged and
source.slice(start, end) now equals the node text.
* import: the filter attribute start was set to the whole source string
instead of the numeric offset. It used this.parser.source where it
meant this.parser.pos, so every \import node carried a copy of the
entire source as its start.
* codeinline: the text node end pointed past the closing backtick, so the
span included the closing delimiter and could read one or two characters
too far. It now ends where the content ends.
* wikilinkprefix and extlink: a suppressed link such as ~SomeLink or
~http://example.com produced a text node whose span included the
leading ~ while its text did not. The span now starts after the ~.
* Add 5.4.1 change note for #9882
Document the parse tree source position fixes: inline code, suppressed
external links, suppressed wikilinks, and the import filter rule.
* Add tests for parse tree source positions
Cover the four wikitext parser rules whose `start` and `end` offsets are
corrected in this PR: codeinline, extlink, wikilinkprefix, and import.
* Fix RSOD when $tw.utils.addClass receives a class string with whitespace
PR #9251 replaced the manual setAttribute("class", ...) implementation of
$tw.utils.addClass/removeClass/toggleClass with direct Element.classList
calls. Unlike setAttribute, classList.add/remove/toggle throws
InvalidCharacterError on any token containing whitespace, so callers that
pass a whole class string (e.g. modal.js passing tiddler.fields.class)
now crash.
Manual repro on tw5-com: open SampleWizard, set the `class` field to
"aaa bbb", Done, open popup -> OK -> open nested popup -> RSOD.
Fix: split the className argument on whitespace in deprecated.js and feed
individual tokens to classList. A small splitClasses() helper keeps the
three functions symmetrical.
Adds adversarial regression tests in test-utils.js covering:
- ASCII whitespace variants (space, tab, CR, LF, mixed runs, padding)
- Unicode whitespace (U+00A0 non-breaking space)
- de-duplication across single and multiple calls
- remove/toggle no-op on missing tokens
- toggle with status undefined / true / false
- silent no-op for whitespace-only / empty / non-string / null input
- silent no-op when the element has no classList
* Move new tests to their own file
* Add backwards-compat regression tests for deprecated.js
Locks in pre-5.4.0 tolerant behaviour of $:/core/modules/utils/
deprecated.js helpers that regressed in PR #9251. Each spec targets an
edge-case input the current one-line modern equivalents reject:
- repeat: negative count / null / undefined str
- startsWith / endsWith: RegExp search arg
- stringifyNumber: null / undefined
- domContains: boolean return, self-check
- hasClass: null element, classless element
- getLocationPath: query preservation, hash stripping
(browser-only; pends in Node because the TW5 sandbox has no `window`)
Also picks up the addClass/removeClass/toggleClass whitespace specs
moved out of test-utils.js by the previous commit, so all deprecated.js
coverage lives together.
Fails 8 specs on current HEAD; the follow-up deprecated.js restoration
commit turns them green.
* Restore pre-5.4.0 behaviour of deprecated.js utilities
PR #9251 replaced several helpers in $:/core/modules/utils/deprecated.js
with one-line ES2017 equivalents that diverge from the originals on
edge-case inputs. Follow-up PRs fixed the most visible cases
(getLocationHash #9622, isDate #9771, addClass empty-string #9561 and
whitespace 005e17537); this commit closes the rest:
- repeat: manual loop tolerates negative count / null / undefined str
- startsWith / endsWith: substring compare tolerates RegExp search arg
- stringifyNumber: `num + ""` coercion tolerates null / undefined
- domContains: `a !== b && a.contains(b)` returns boolean, handles self
- hasClass: null-element guard, strict-false return
- getLocationPath: `toString().split("#")[0]` preserves the query
string in permalinks (startup/story.js:214, 217) -- the most visible
user-facing regression, causing ?lang=de etc. to silently drop.
IE-only fallbacks in Math.sign, strEndsWith, domContains, and
domMatchesSelector are removed; TW5 no longer supports IE.
Covered by the regression specs added in the previous commit.
* make comments more refined
PR #8093 used `child.children.length === 0` to distinguish a plain <option> from an <optgroup>. This test misfires when an <option> contains inline HTML.
E.g. tc-tiddlylink anchors auto-generated for "$:/..." titles.
So on refresh the option's `selected` state was never restored.
- This change switches to a tagName check.
- Adds a regression test plus a guard for the original PR #8092 optgroup
behaviour.
* fix: limit macro call parser to need >> to work, prevent > in regex
* test: add malformed macro parameter regression coverage
The parser fix on this branch only changes parseMacroParameterAsAttribute() when an unquoted value starts with <<, so the previous broader parser tests did not prove the regression. Add a focused structural test that fails without the guard and passes with it.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* Revert "fix: limit macro call parser to need >> to work, prevent > in regex"
This reverts commit f96b062902.
* lint: test
* Reapply "fix: limit macro call parser to need >> to work, prevent > in regex"
This reverts commit 075f7cc282.
---------
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
The reAttributeName regexp in parseMacroParameterAsAttribute was too
permissive, allowing single-character names like dollar sign followed by
colon. This caused values such as dollar-colon-slash-plugins-foo to be
mis-parsed as a named parameter dollar with value slash-plugins-foo.
Fix: when the separator is colon (legacy syntax), require the parameter
name to match [A-Za-z0-9-_]+ (same as the historic parseMacroParameter).
When the separator is equals (new-style dynamic parameters from #9055),
the wide character set is preserved so that names like double-dollar-one
continue to work.
Adds regression test Transclude/Procedures/Dollar/Param.
* wip: non-existent variables as attributes should be undefined
* wip: non-existent variables as attributes should be undefined
* tests: added missing test
* fix: restore mistakenly commited files
* fix: whitespace
* fix: apply automatic eslint fixes
* lint: allow hashbang comment for tiddlywiki.js
* lint: first back of manual lint fixes for unused vars
* lint: added more fixes for unused vars
* lint: missed files
* lint: updated eslint config with selected rules from #9669
* Add ((var)) syntax for passing multi-valued variables through transclude pipeline
Introduce ((var)) attribute syntax to explicitly pass
MVVs to procedures and functions via $transclude, solving the limitation
where <<var>> always resolves to the first value only for backwards
compatibility. Also adds ((var||sep)) and (((filter||sep))) inline display
syntax for debugging MVV values, and multivalued defaults for parameter attributes
* Create pr-draft.md
* Revert "Create pr-draft.md"
This reverts commit dd116af41b.
* Update change note
* Fix linting errors
* feat: eventcatcher with pointer capture support
* fix: various cleanups and improvements
* chore: lint
* chore: lint
* docs: updated eventcatcher docs
* docs: added changenote
* feat: provide access to event properties via JSON blob
* fix: added updated utils file
* fix: guard against missing nodes and not element nodes
* Initial commit
The idea is to extend the macro call syntax to accept dynamic parameter values (ie thing:{{more}} etc). Eventually, this will work in all the contexts in which the double angle bracket syntax is valid.
This initial commit gets the tests passing, but doesn't yet activate the new functionality.
* Test for standalone macro calls with dynamic parameters
* Parse attribute macros with the new parser
This fixes the tests
* Test for attribute macros
* Add some examples
* Tweak examples
* Fix test
* Temporarily disable a broken serializer test
* Fix/dynamic macro calls test (#9459)
* Revert "Temporarily disable a broken serializer test"
This reverts commit b3144300ee.
* restore synamic parameter parse result
* lint
* lint
* remove duplicate
* Update core/modules/parsers/parseutils.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update editions/test/tiddlers/tests/data/serialize/DynamicWidgetAttribute.tid
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update editions/test/tiddlers/tests/data/serialize/DynamicWidgetAttribute.tid
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: mixed qouted and unquoted
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix unneeded diff
* Minor docs update
* Genuflecting to the linter
* Remove debug logging
* Add change note
* Allow single closing square brackets within double square brackets quoted strings
* Only allow new style parameter values if the separator is an equals sign
* On reflection, new style values should not be allowed for anonymous parameters
Backwards compatibility
* Docs updates
* Docs updates
---------
Co-authored-by: lin onetwo <linonetwo012@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Make draft title translatable
* Update change note
* Improve number handling
Now generates "Draft of '...' 2" instead of "Draft 2 of '...'"
* Improve whitespace handling
We no longer needs to add whitespace in languages. We now handle it in javascript.
* Update language naming
* Update zh-Hans translation
* Update change note
* Refactor logic to make it less complex
Since we don't need to care about draft numbers, we can have two different templates for draft title with and without attribution. No need to trim the string now.
Also, we can reuse the getSubstitutedText method
* Update translators edition
* fixup! Update translators edition
* Switch to transclude and variable mechanism
* Adapt translators to the new mechanism
* Update change note
* Further simplify the logic
$tw.language.getString can already wikify translatable strings. No need for this.renderText
* Introduced preliminary idea for infinite recurse exception
* Better handling of infinite recursion
But it could be better still...
* the TransclusionError is a proper error
Moved the magic number to be on the error's class. Not sure if that's
a great idea.
* Fixed minor minor issue that came up in conflict
The minor fix to the jasmine regexp that escaped a '+' somehow
broke some random test.
* Removing patch fix for recursion errors
* Fixed issue where buttton and other widgets don't clean up
* Added release notes for #9548
* Update test-widget.js
If I don't fix those indentations, the entire TW codebase will explode or soemthing.
* Update test-widget.js
These lint problems are wasting my time.
* Fixed all core widgets to not leak when renderChildren fails
* Updated release notes to reflect what I'm actually fixing
* Update test-widget.js
Added warning not to use for-of loop for defining tests. The iterating variable needs to have its own method scope, or it risks being the same value for all tests.
* feat: support for data-attributes and on load actions
* feat: support for data-attributes and on load actions
* fix: typo
* fix: simplify variable assignment
* docs: added changenote
* Fix: bug in multivalue default params
* Enhance release notes for version 5.4.0
Updated GitHub links and contributors for release notes.
* Add FunctionDefaultValues test for default parameters
* Update function default values in FunctionDefaultValues.tid
* Update #8972.tid
* fix: correctly resolve default values for functions
* Update #8972.tid
* Fixes#8092 SelectWidget does not work with multiple options organised into group
* Consolidate variables
* Apply suggestion from @saqimtiaz
* Update core/modules/widgets/select.js
Co-authored-by: Mario Pietsch <pmariojo@gmail.com>
* added release note
* chore: lint fixes
---------
Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
Co-authored-by: Mario Pietsch <pmariojo@gmail.com>