Page MenuHomePhabricator

Complete Parsoid TOC implementation
Closed, ResolvedPublic

Description

A few missing things (sorry for lumping them all together into one task):

  • ParserOutputFlags::SHOW_TOC isn't set on the parsoid side
    • This involves (among other things) determining whether there are "enough" sections present in order to set SHOW_TOC
  • Parsoid should add a "synthetic" __TOC__ marker if none is present in the input wikitext
    • https://github.com/wikimedia/mediawiki/blob/master/includes/parser/Parser.php#L4470-L4475 (core side version of this)
    • presumably we'll mark this <meta> in some way to indicate that it is not present in the input wikitext (the same way we mark missing end tags which we supply?) so that it is not round-tripped back to a literal __TOC__ in the wikitext.
    • whatever markup we add should match Parser::TOC_PLACEHOLDER_REGEX in core, although that was written to be pretty broad (aka should permit arbitrary additional attributes to be added for disambiguation of the automatically-inserted case on the parsoid side).
    • probably need to check that VE knows to leave this marker alone (or strip it, like it does <section> tags?)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
cscott updated the task description. (Show Details)
cscott updated the task description. (Show Details)

Change 903797 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] WIP: Add synthetic TOC if necessary

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

Change 903797 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Add synthetic TOC if necessary

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

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

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.18.0-a7

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

Change 914008 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.18.0-a7

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

We may need to look at other magic words like NOTOC and FORCETOC and see Parsoid's handling is compatible with those magic words. We may not be handling them correctly yet. So, moving this back to In Progress.

Patch https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/913204 (linked to T332243) fixed some of these issues and made us pass some more tests. As @ssastry says we just need to take a close look and make sure we're not missing anything else.

I am going to close this and if we find any bugs / gaps, we can file new tasks.