Repository navigation
fix(#184): keep dollar signs in special variable values - #185
Open
VanshajPoonia wants to merge 1 commit into
Open
VanshajPoonia wants to merge 1 commit into
VanshajPoonia wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #184
What
wrapInQuotesnow passes a replacer function toString.replacewhen it writes the quoted line back, instead of the string itself.Why
With a string replacement,
String.replacereads$$,$&,$`and$'as replacement patterns. A$sequence in a special variable value was therefore rewritten before the frontmatter was parsed:template_title: Budget $$ and $& reportcreated a note titledBudget $ and template_title: Budget $$ and $& report report. A replacer function's return value is inserted as is.Testing
$$and$&intemplate_title. It fails on master with the title above and passes with the change.devbranch, with the plugin loaded through--dev-plugins: on master the note gets the mangled title, with the change it getsBudget $$ and $& report.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.