Closed Bug 1334887 Opened 7 years ago Closed 5 years ago

Preview and published page shows different result for special characters (<, >, &)

Categories

(developer.mozilla.org Graveyard :: KumaScript, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: arai, Unassigned)

References

()

Details

discovered by bug 1334713.

Unescaped special characters like <, >, & are not escaped in preview page, but escaped in published page.

Steps to reproduce:
  1. create a new page
  2. choose "Source" in editor
  3. enter the following
       {{jsxref("Operators/Comparison_Operators", "<", "#Less_than_operator")}}
  4. preview
  5. publish

Actual result:
  preview page shows "<"
  published page shows "&lt;"

Expected result:
  both page shows same thing

  there are related bug in jsxref that it escapes $1
  that's why published page shows "&lt;"
  once both gets fixed, expected result is to showing "<"
Component: Macros/Templates → Wiki pages
Product: Developer Documentation → Mozilla Developer Network
Component: Wiki pages → KumaScript

Note to self, see if this is still an issue, and move this to mdn/kumascript

Flags: needinfo?(jwhitlock)

I've tested this page, which uses the jsxref macro, and copied it to stage:

https://developer.allizom.org/en-US/docs/user:jwhitlock/bug1334887

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#Relational_operators

In the rendered as well as the preview version, it shows "<", ">=", etc. The call uses the escaped HTML:

{{jsxref("Operators/Comparison_Operators", "&gt;=", "#Greater_than_or_equal_operator")}}

I attempted to add unescaped symbols, like "<=", and had trouble doing it. I can add them in Source mode, and CKEditor then escapes them to "gt;" and "lt;".

I think there was an issue where jsxref double-escaped the HTML, which was fixed as part of bug 1335006:

https://github.com/mdn/kumascript/pull/108
https://github.com/mdn/kumascript/commit/9724b1c989d319019270ee9504df4631183382e0#diff-982cbf7ca044fee856084553f15c2ff2

I then believe the page was updated to send HTML-escaped strings to KumaScript, which now does the right thing.

Status: NEW → RESOLVED
Closed: 5 years ago
Depends on: 1335006
Flags: needinfo?(jwhitlock)
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.