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
* 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
* UI: Show details on cascade filters in the "Advanced info" tab
* Update CascadeInfo.tid with new formatting
* Remove codeblock for conciseness
* Add change note for #9634
* Refactor CascadeInfo.tid for active filters
Improve filter logic and names of variable
* Change heading names
Updated the CascadeInfo.tid to change 'Active Filter Condition' to 'Active Cascade Filter' and adjusted the corresponding variables.
* Allow title, tags, text as focus for editing existing tiddlers
* Add release note
* Update description field
* refresh select widget, it .default parameter is changed
* remove default variable, because it is not needed anymore. select widget refresh handling deals with it
* Undo select widget changes