Special characters are being incorrectly escaped

REOPENED
Unassigned

Status

Developer Documentation
Macros/Templates
P5
normal
REOPENED
a year ago
a year ago

People

(Reporter: tGDA, Unassigned)

Tracking

Details

(URL)

(Reporter)

Description

a year ago
:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

This template escapes special xml chars (<>&), as you can see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#Bitwise_shift_operators

I tried editing the template, it won't let me, tried creating another to experiment, same issue
(Reporter)

Updated

a year ago
Component: General → Macros/Templates
(Reporter)

Updated

a year ago
OS: Other → All
https://github.com/mozilla/kumascript/blob/12839b2f36bfd9ae10215e65ac6a81c08aef5658/macros/jsxref.ejs#L54
> var str = $1 || $0;
> ...
> %><a href="<%- URL + $2 %>" title="<%-summary%>"><%- code %><%= str %><%- endcode %></a>

for example, & operator, |str| contains "&amp;", and it's escaped again by |<%= str %>|, so it becomes "&amp;amp;" and shown as "&amp;" instead of "&".
if |str| is always escaped, we could use <%- str %> instead
(haven't checked if it's really always escaped tho)


(In reply to tGDA from comment #0)
> I tried editing the template, it won't let me, tried creating another to
> experiment, same issue

macro is moved to https://github.com/mozilla/kumascript/tree/master/macros
(Reporter)

Comment 2

a year ago
I checked again and the problem is not with the template itself, but with the page. Apparently it was edited in WYSIWYG that escaped the characters.

I edited it in source mode (no WYSIWYG) and fixed the issue:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#Bitwise_shift_operators
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → INVALID
no, the source gets escaped on server side while publishing.

looks like there's some difference between preview and published page,
since even preview page shows correctly for unescaped source, published page shows them as escaped.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
(Reporter)

Comment 4

a year ago
Hmmm... The problem still persists! Although it showed correctly on preview page, when saved nothing changed, even history log says so:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators$compare?locale=en-US&to=1178909&from=1138607
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators$compare?locale=en-US&to=1179827&from=1178909

I am removing resolved flag.
See Also: → bug 1334887
You need to log in before you can comment on or make changes to this bug.