Page MenuHomePhabricator

Annotation nesting detection is not well handled when annotations span over an attribute
Open, Needs TriagePublicBUG REPORT

Description

The current handling of attributes doesn't allow for good annotation nesting detection:

  • the start tag is an arbitrary tag with a typeof attribute, and not a <meta> tag
  • the end tag disappears if it's well-nested in the attributes, but not if it is inserted as a later tag.

This has the following consequences:

  • nested annotations are not detected if the first opening tag is in an attribute:
$ echo '[[<tvar>plop|plop]] <tvar>nested</tvar> hello</tvar>' | php ./bin/parse.php --wt2wt
[[<tvar>plop|plop]] <tvar>nested</tvar> hello</tvar>
  • if the opening tag is outside an attribute and the closing tag is inside an attribute, the corresponding annotation is not seen as closed, which can lead to bad removal of (actually non-)nested annotations:
$ echo '<tvar>[[plop</tvar>|plop]] <tvar> not nested</tvar>' | php ./bin/parse.php --wt2wt
<tvar>[[plop</tvar>|plop]]  not nested

Whether we want to handle these corner case situations in Parsoid is debatable (since the markup wouldn't be recommended either), but we may want to consider linter rules for them.