Page MenuHomePhabricator

Parsoid Language Converter doesn't convert rules inside -{ ... }- markup
Closed, ResolvedPublic

Description

https://crh.wikipedia.org/wiki/Paris?useparsoid=0&variant=crh-latn
vs
https://crh.wikipedia.org/wiki/Paris?useparsoid=1&variant=crh-latn

image.png (516×235 px, 47 KB)

The paris.fr wikilink disappears because the wikitext is -{[http:///.... -{paris.fr}-]}- and Parsoid doesn't convert the -{paris.fr}- inside the outer -{..}-.

Event Timeline

Change #1277186 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] ParsoidLanguageConverter: fix behavior of nested -{R|...}- rules

https://gerrit.wikimedia.org/r/1277186

Bewfip subscribed.

I still wonder what is the intended behaviour for nested LC markup. It appears undocumented.

Winston_Sung subscribed.

The current behavior (as far as I know) is:

-{[http://... -{paris.fr}-]}-

-{                   // Prevent any "display text" being converted
    [                // External link syntax
        http://...   // The link itself never being converted, even as the link display text
                     // The whitespace separator between the link target and the link display text
        -{           // Prevent the link display text being converted
            paris.fr // The original link display text
        }-
    ]
}-

image.png (776×183 px, 26 KB)

The current behavior should be some kind of "unwrapping", so the "outer" unwrapping comes first, then the "inner".

In a nutshell: Just like the inline CSS styles.

-{                                 [        https://...  -{                                 Text     }-   ]     }-
<span style="background: #6a60b0;"><a href="https://,,,"><span style="background: #177860;">Text</span></a></span>

image.png (898×62 px, 14 KB)

Change #1277186 merged by jenkins-bot:

[mediawiki/core@master] ParsoidLanguageConverter: fix behavior of nested -{R|...}- rules

https://gerrit.wikimedia.org/r/1277186

As described in the commit message:

Previously we were skipping the contents of "raw" rules entirely, but
we are expected to convert rules inside them, just not convert text.

Tests added to demonstrate this behavior.