Topic on Talk:Page Previews/Flow

Brackets () in chemical formula breaks it

4
DePiep (talkcontribs)

So Hovercards removes anything between and including () brackets. OK. However, when a chemical formula is presented with brackets, is gets broken into nonsense. Example in case: en:RDX has opening line:

RDX is the organic compound with the formula (O2NNCH2)3.

In Hovercards it shows:

RDX is the organic compound with the formula3.

(A space has gone too btw). Any solution, here or in the article? Adding:

en:4-Phenyl-4-(1-piperidinyl)cyclohexanol has brackets in the titleword, resulting in Hovercards:
4-Phenyl-4-cyclohexanol
Nihiltres (talkcontribs)

Probably worth mentioning at T91344 or elsewhere on the TextExtracts workboard.

It's probably also worth looking into if the <chem> markup could work with Hovercards (don't know offhand)—even if it's currently borked, making an exception to render chemical formulas that use the tag would probably be easier than tweaking broad code related to removing parenthetical content.

Personally, I think the responsible thing's to disable the removal of parenthetical content, and certain bits of HTML (in your example the remaining "3" gets unwrapped from its <sub> element), until that can be done reliably—there are too many edge cases like this where meaning is broken by aggressively simplifying the code.

OVasileva (WMF) (talkcontribs)

Hi - thanks @DePiep for pointing this out. Currently the issue is with most HTML. We're tracking it here, but let us know if there's any edge cases that we might be missing.

DePiep (talkcontribs)

The tracking OVasileva (WMF) mentions covers this well. It already says 'mathematical'. Maybe Unicode has other () brackets with math semantics (i.e., "use U+9xxy, U+9xxz pair to denote math () brackets"). No need to disable the function for this minor issue. imo, close-able.

Reply to "Brackets () in chemical formula breaks it"