Skip to content

fix(#184): keep dollar signs in special variable values - #185

Open
VanshajPoonia wants to merge 1 commit into
joplin:masterfrom
VanshajPoonia:fix/184-dollar-in-special-variables
Open

VanshajPoonia wants to merge 1 commit into
joplin:masterfrom
VanshajPoonia:fix/184-dollar-in-special-variables

Conversation

@VanshajPoonia

Copy link
Copy Markdown

Fixes #184

What

wrapInQuotes now passes a replacer function to String.replace when it writes the quoted line back, instead of the string itself.

Why

With a string replacement, String.replace reads $$, $&, $` and $' as replacement patterns. A $ sequence in a special variable value was therefore rewritten before the frontmatter was parsed: template_title: Budget $$ and $& report created a note titled Budget $ and template_title: Budget $$ and $& report report. A replacer function's return value is inserted as is.

Testing

AI Assistance Disclosure

I used an AI coding assistant to investigate the issue, write the fix and the test, and draft this description. The tests and lint pass locally, and the fix was checked end to end in a Joplin desktop dev build.

wrapInQuotes wrote the quoted line back with String.replace and a string
replacement, so "$$", "$&" and similar sequences in a special variable
value were read as replacement patterns. A title such as
"Budget $$ report" came out as "Budget $ report", and "$&" pasted the
whole original line into the value.

Pass a replacer function so the quoted line is inserted as is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$ sequences in special variable values are mangled by preProcessTemplateBody

1 participant