Single quotes in template calls converted to double quotes after save, breaking page



6 years ago
a year ago


(Reporter: gaubugzilla, Unassigned)





6 years ago
I tried invoking a template like this:

{{ note("foo <a href='#bar'>bar</a>.") }}

Note that the tag uses single quotation marks which avoids syntax errors. This works fine if I click "preview changes". However, if I save the page like this I get a syntax error: apparently, there is HTML Tidy or something like this running when the page is saved but not for preview. This step will unify quotation marks and change to double quotation marks for the tag - which breaks the template invocation.
Hey Wladimir. Just noticed your email address. Thanks for all of your hard work, and for using the MDN.

I will be sure we look into this.
Summary: Kuma: Preview is not identical to the resulting page → Single quotes in template calls converted to double quotes after save, breaking page
Priority: -- → P1
Duplicate of this bug: 789353
Version: Kuma → unspecified
Component: Docs Platform → Editing
Product: Mozilla Developer Network → Mozilla Developer Network
Duplicate of this bug: 811003
Here's an example working around this issue:

Some further notes:

* There also exist {{ NoteStart }} and {{ NoteEnd }} macros which help with more complex content in notes that need markup. This was not possible in dekiscript, but we should be able to split more template-driven markup conventions this way

* You can also use single quotes in macros, like so:

    {{ note('foo <a href="#bar">bar</a>.') }}

* You can also also escape double quotes (or single quotes):

    {{ note("foo <a href=\"#bar\">bar</a>.") }}

I'm not sure how that last one interacts with HTML processing in Kuma, though. Which means this may still be a bug worth addressing. (ie. don't mess with HTML inside templates when doing markup processing on content submssion)
Yeah, we need to use the start/end template form more for this, I think, as it's much less insane. :)
I think need document.
And I think this is better:

  <div>{{ note('foo <a href="cake.html">tom&apos;s cake</a>' ) }}</div>

Maybe Some people will feel this is difficult, but it can't be helped.
Priority: P1 → --
You need to log in before you can comment on or make changes to this bug.