quickadd
quickadd copied to clipboard
Resolution of Templater syntax doesn't work in Captures as expected
The paradigm of capturing the "{{VALUE}}" and then manipulating the string with JavaScript inside the Templater brackets (between "<%" and "%>") doesn't work (see the example below).
> [!INFO]- Used abbreviations
> - <% String.prototype.replace.call("{{VALUE:Abbreviations}}", /\r?\n/g, " ") %>
To Reproduce
- Create a Capture
- Insert the capture template similar to the one above or any of the variations, e.g.
<% abbr = "{{VALUE:Abbreviations}}" %>
<% "{{VALUE.Abbreviations}}".replace(/\r?\n/g, " ") %>
- Run the capture, see error: plugin:quickadd:17470 QuickAdd: (ERROR) Error: Template syntax error: Invalid or unexpected token
Expected behavior Similar to The Templater, when new files are created, the values in {{ }} are captured and then processed like string literals. E.g.:
<%*
c_abbr = "{{VALUE: Abbreviation}}".toUpperCase().trim();
c_abbr = (c_abbr == "~") ? "" : c_abbr;
%>