diff --git a/core/modules/parsers/parseutils.js b/core/modules/parsers/parseutils.js index 18bcdd5164..fff8589cbd 100644 --- a/core/modules/parsers/parseutils.js +++ b/core/modules/parsers/parseutils.js @@ -221,7 +221,7 @@ exports.parseMacroInvocationAsTransclusion = function(source,pos) { orderedAttributes: [] }; // Define our regexps - var reVarName = /([^\s>"'=:]+)/y; + var reVarName = /([^\s>"'=]+)/y; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Look for a double opening angle bracket @@ -269,7 +269,7 @@ exports.parseMVVReferenceAsTransclusion = function(source,pos) { orderedAttributes: [] }; // Define our regexps - var reVarName = /([^\s>"'=:)]+)/y; + var reVarName = /([^\s>"'=)]+)/y; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); // Look for a double opening parenthesis diff --git a/editions/test/tiddlers/tests/data/multi-valued-variables/AttributeColonVarName.tid b/editions/test/tiddlers/tests/data/multi-valued-variables/AttributeColonVarName.tid new file mode 100644 index 0000000000..6b37b5f0b8 --- /dev/null +++ b/editions/test/tiddlers/tests/data/multi-valued-variables/AttributeColonVarName.tid @@ -0,0 +1,15 @@ +title: MultiValuedVariables/AttributeColonVarName +description: ((var)) on a widget attribute may name a variable containing a colon (#10013) +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim +<$let my:list={{{ [range[2]] }}}> +<$text text=((my:list))/> + ++ +title: ExpectedResult + +

1

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname-and-param.tid b/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname-and-param.tid new file mode 100644 index 0000000000..65f6f7ab8e --- /dev/null +++ b/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname-and-param.tid @@ -0,0 +1,16 @@ +title: Parse/BackCompat/MacrocallColonVarNameAndParam +description: A colon-named procedure or macro accepts named parameters with either separator (#10013) +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\procedure object:method(p) COLONPROC(<

>) +\define object:macro(p) COLONMACRO($p$) +<> +<> +<> ++ +title: ExpectedResult + +

COLONPROC(V)

COLONPROC(V)

COLONMACRO(V)

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname-as-value.tid b/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname-as-value.tid new file mode 100644 index 0000000000..b3c608bfcd --- /dev/null +++ b/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname-as-value.tid @@ -0,0 +1,16 @@ +title: Parse/BackCompat/MacrocallColonVarNameAsValue +description: A colon-named procedure or macro may be an =-separated parameter value (#10013) +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\procedure object:method() COLONPROC +\define object:macro() COLONMACRO +\procedure host(a) [a=<>] +<>>> +<>>> ++ +title: ExpectedResult + +

[a=COLONPROC]

[a=COLONMACRO]

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname.tid b/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname.tid new file mode 100644 index 0000000000..08abc9ecc7 --- /dev/null +++ b/editions/test/tiddlers/tests/data/parse-backcompat/macrocall-colon-varname.tid @@ -0,0 +1,13 @@ +title: Parse/BackCompat/MacrocallColonVarName +description: Macro call variable name may contain a colon (#10013) +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\procedure object:method() VAL +<> ++ +title: ExpectedResult + +

VAL

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/parse-backcompat/widget-attr-macro-colon-varname.tid b/editions/test/tiddlers/tests/data/parse-backcompat/widget-attr-macro-colon-varname.tid new file mode 100644 index 0000000000..40abe57715 --- /dev/null +++ b/editions/test/tiddlers/tests/data/parse-backcompat/widget-attr-macro-colon-varname.tid @@ -0,0 +1,13 @@ +title: Parse/BackCompat/WidgetAttrMacroColonVarName +description: Widget attribute macro value may name a variable containing a colon (#10013) +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\procedure object:method() VAL +<$text text=<>/> ++ +title: ExpectedResult + +

VAL

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.5.0/#10014-colon-in-variable-names.tid b/editions/tw5.com/tiddlers/releasenotes/5.5.0/#10014-colon-in-variable-names.tid new file mode 100644 index 0000000000..f39e29308d --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.5.0/#10014-colon-in-variable-names.tid @@ -0,0 +1,34 @@ +title: $:/changenotes/5.5.0/#10014 +created: 20260906223932000 +modified: 20260906223932000 +description: Variable names may contain a colon in call and multi-valued variable syntax +release: 5.5.0 +tags: $:/tags/ChangeNote +change-type: bugfix +change-category: hackability +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/10014 +github-contributors: pmario + +A variable name may contain a colon in the `<<...>>` call syntax: standalone, with named parameters using either separator, as a nested call, and as a widget attribute value. + +``` +\procedure obj:plain() Hello +\procedure greet:person(name) Hello <> +\procedure obj:host(a) [<
>] + +<> +<> +<> +<>>> +
> >
+``` + +An `((...))` multi-valued variable reference used as a widget attribute value accepts the same names as the inline syntax: + +``` +<$let my:list={{{ [range[3]] }}}> +<$text text=((my:list))/> + +``` + +Fixed issue: [[#10013|https://github.com/TiddlyWiki/TiddlyWiki5/issues/10013]]