I’m creating this topic in order to inform other users who might struggle as I did, so less people have so suffer figuring this out.
One of the features of the Smart-Typography plugin is automatically turning standard double quotes into curly double quotes (“” → ““). This is a very subtle change that is hard to notice, and I didn’t even know about this until I discovered my issue (I initially downloaded the plugin just for em-dashes).
At some point I started setting up the plugin Templater and encountered an issue where, when creating simple templates (for example, just inserting the creation date <% tp.file.creation_date(“D MMMM YYYY“)%>
), while processing the template, Templater crashed with a parsing error
Templater Error: Template parsing error, aborting.
Bad template syntax
and an error message in the console that is not interpretable
Invalid or unexpected token
===========================
var tR='',__l,__lP,include=E.include.bind(E),includeFile=E.includeFile.bind(E)
function layout(p,d){__l=p;__lP=d}
const _prs = [];
_prs.push(tp.file.creation_date(“D MMMM YYYY“));
tR+='rJ2KqXzxQg'
tR+='\n\n'
const _rst = await Promise.all(_prs);
tR = tR.replace(/rJ2KqXzxQg/g, () => _rst.shift());
if(__l)tR=await includeFile(__l,Object.assign(tp,{body:tR},__lP))
if(cb){cb(null,tR)} return tR
After some digging around, I finally discovered that the issue was in Templater not being able to parse the curly quotes, and everything was, of course, fixed by using the standard quotes.
Preventive measures?
I posted my thoughts on both sides to Github issues of both of the plugins
opened 04:37PM - 07 Oct 22 UTC
One of the features of the Smart-Typography plugin is automatically turning stan… dard double quotes into curly double quotes ("" → ““). This is a very subtle change that is hard to notice, and I didn't even know about this until I discovered my issue (I initially downloaded the plugin just for em-dashes).
At some point I started setting up the plugin Templater and encountered an issue where, when creating simple templates (for example, just inserting the creation date `<% tp.file.creation_date(“D MMMM YYYY“)%>`), while processing the template, Templater crashed with a parsing error
```
Templater Error: Template parsing error, aborting.
Bad template syntax
```
and an error message in the console that is not interpretable
```
Invalid or unexpected token
===========================
var tR='',__l,__lP,include=E.include.bind(E),includeFile=E.includeFile.bind(E)
function layout(p,d){__l=p;__lP=d}
const _prs = [];
_prs.push(tp.file.creation_date(“D MMMM YYYY“));
tR+='rJ2KqXzxQg'
tR+='\n\n'
const _rst = await Promise.all(_prs);
tR = tR.replace(/rJ2KqXzxQg/g, () => _rst.shift());
if(__l)tR=await includeFile(__l,Object.assign(tp,{body:tR},__lP))
if(cb){cb(null,tR)} return tR
```
After some digging around, I finally discovered that the issue was in Templater not being able to parse the curly quotes, and everything was, of course, fixed by using the standard quotes.
## Preventive measures?
Would it make sense to implement a check for whether currently the cursor is located inside brackets like <\%\%> or other variations, and turn off the quote conversion when that is true?
I understand that the user might start typing the Templater command outside of the <\%\%> brackets and add them afterwards. But still, some countermeasures might prevent baffled users like me.
opened 04:49PM - 07 Oct 22 UTC
enhancement
One of the features of the Smart-Typography plugin is automatically turning stan… dard double quotes into curly double quotes ("" → ““). This is a very subtle change that is hard to notice, and I didn't even know about this until I discovered my issue (I initially downloaded the plugin just for em-dashes).
At some point I started setting up the plugin Templater and encountered an issue where, when creating simple templates (for example, just inserting the creation date `<% tp.file.creation_date(“D MMMM YYYY“)%>`), while processing the template, Templater crashed with a parsing error
```
Templater Error: Template parsing error, aborting.
Bad template syntax
```
and an error message in the console that is not interpretable
```
Invalid or unexpected token
===========================
var tR='',__l,__lP,include=E.include.bind(E),includeFile=E.includeFile.bind(E)
function layout(p,d){__l=p;__lP=d}
const _prs = [];
_prs.push(tp.file.creation_date(“D MMMM YYYY“));
tR+='rJ2KqXzxQg'
tR+='\n\n'
const _rst = await Promise.all(_prs);
tR = tR.replace(/rJ2KqXzxQg/g, () => _rst.shift());
if(__l)tR=await includeFile(__l,Object.assign(tp,{body:tR},__lP))
if(cb){cb(null,tR)} return tR
```
After some digging around, I finally discovered that the issue was in Templater not being able to parse the curly quotes, and everything was, of course, fixed by using the standard quotes.
## Preventive measures?
1. The error message is very hard to interpret. At least it should be able to better pinpoint the lines where the error lies? Instead of giving lots of code that I don't recognize at all and get no useful info from.
2. Maybe something can be done specifically against cases like this? For example, inform the user their Templater code blocks include unparseable characters.