BUG: Lex \ ParsingException in .md content b/c {{ "literals" == fail }}

Could be my bad, but I oft-times toss some HTML below the yaml front matter of .md content files. I also sometimes use {{ is_admin }} and other globals, conditionals, etc. Yet, some code that would work in my layouts and partials, etc. just went ker-flooey when pasted inside my markdown. Took me qui-i-i-i-te a while to figure this puppy out.

Turns out this blows up:

---
title: DEMO
---

{{ if "two" == "two" }}Right!{{ else }}Wrong!{{ endif }}

but this works:

---
title: DEMO
---

<code>{{ if "two" == "two" }}Right!{{ else }}Wrong!{{ endif }}</code>

What's going on in the first case is the markdown parser is changing those nice straight quotes around the literal into left and right curly-quotes, which, needless to say, greatly annoys our pal Slim:

You have a syntax error in your Lex tags. The offending code: <p>if (&#8220;null&#8221; == &#8220;null&#8221;): Right!else: Wrong!endif; </p>

Just off the top of my head, I'm not sure what I'm going to do about this, near term. I got a postcard from Work-Around Land saying that creating a global var in _config/settings.yaml, like _literal for "literal" does work, but... yeuck.

Answered by Jason Varga!
>>>>>>> Answered <<<<<<<
5 Replies
2 Followers