Opened 4 years ago

Closed 4 years ago

#3402 closed defect (fixed)

[CMS] Fix inline tag nesting for translatable strings

Reported by: saroyanm Assignee: kzar
Priority: P3 Milestone:
Module: Sitescripts Keywords: cms
Cc: Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29332956/

Description (last modified by kzar)

Background

Our CMS allows some inline HTML tags (a, em, sup, strong, code, span) inside of translatable strings, they can even be nested.

Unfortunately nesting appears to be broken depending on the order of the tags. For example either <em><sup>example</sup></em> or <sup><em>example</em></sup> will work but not both. For one the outer tags will be HTML escaped. (To make matters worse the whitelisted tags are stored inside an unordered set, so we can't even be sure of which of the two will work!)

What to change

Make relevant changes to cms/converters.py so that nesting of whitelisted HTML tags works despite the order in which they are nested. With the example string Hello world <sup><a href="#ref">1</a></sup> the opening and closing sup tags should not be escaped.

Change History (7)

comment:1 Changed 4 years ago by kzar

  • Description modified (diff)
  • Keywords cms added
  • Owner set to kzar
  • Priority changed from Unknown to P3
  • Ready set
  • Summary changed from Allow nested inline tags in translation string to [CMS] Allow links inside of inline tags for translatable strings

Note: Nested inline tags work generally, as a work around you could do something like this: <a href="#ref"><sup>1</sup></a>

comment:2 Changed 4 years ago by kzar

  • Description modified (diff)

comment:3 Changed 4 years ago by kzar

  • Description modified (diff)
  • Summary changed from [CMS] Allow links inside of inline tags for translatable strings to [CMS] Fix inline tag nesting for translatable strings
  • Type changed from change to defect

comment:4 Changed 4 years ago by kzar

  • Description modified (diff)

comment:5 Changed 4 years ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:6 Changed 4 years ago by abpbot

A commit referencing this issue has landed:
https://hg.adblockplus.org/cms/rev/2749081ea158

comment:7 Changed 4 years ago by kzar

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.