* 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
* Short-circuit the import option; only show it when you click a button
* Add aira-label
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* perf(import): lazy evaluate import options panel, shortcircuit when no options, and flatten let widgets
- Only parse $:/Import JSON when user expands the import options panel
- Skip all import option logic if no $:/tags/ImportOptions tiddlers exist
- Merge nested let widgets into single multi-variable let for better performance and readability
- Add lingo for import options panel and no-match message
This greatly improves import speed for large wikis, especially when no import options are present.
* fix(import): use correct transclusion for aria-label on import options panel buttons\n\nBind aria-label using {{$:/language/Import/Listing/ImportOptions/Caption}} instead of macro literal, matching TiddlyWiki convention and ensuring accessibility tools read the correct label.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 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
* Implement translations and indentation fixes for Advanced Info tab
* update change note
* Update CascadeInfo hint for current tiddler context
Clarified hint for cascade info in TiddlerInfo.
* docs: update github-links in release note #9634