Page MenuHomePhabricator

Parsoid should support section editing links
Closed, ResolvedPublic

Description

The core parser emits links to edit every section; right now we emit both 'edit' and 'edit source' links, but it (AIUI) depends on some user and wiki configuration as to how many edit links we emit, whether we emit links to visual editor, etc. But in any case, Parsoid needs to be compatible & emit these before it can replace the legacy parser for read views.

This would (likely) be a post-processing pass, as the exact links emitted is user-dependent. It would also ensure we don't clutter/invalidate parser tests every time we decide to tweak how the section edit links look or what editor they link to, like the legacy parser does.

A simple test case: https://en.wikipedia.org/wiki/User:Cscott/Parsoid_section_test

Note that transcluded sections also have direct links to edit the page on the transcluded section. On the example page these look something like:

https://en.wikipedia.org/w/index.php?title=User:Cscott/SectionTemplate&veaction=edit&section=T-1

Note that we don't currently make any guaranteees about content inside a transclusion. Properly emitting the above links would probably require us *not* to strip some Parsoid info from the transclusion and come closer to guaranteeing that the contents of a transclusion are a valid Parsoid document with its own data-mw and data-parsoid that can be interpreted to reconstruct the template tree. See T269629: Generalize rules about rendering-transparent content before sections, T260169: Parsoid API to "expand page X with parameter Y and Z", and T259824: DiscussionTools's reply tool doesn't work when the comments are transcluded from another page using a template (not directly) (where DiscussionTools has to chase down recursive transclusions to find the "true" page holding a given discussion topic/reply/etc).

See also: T270199: Table of contents in Parsoid output.

Related Objects

StatusSubtypeAssignedTask
OpenReleaseNone
OpenNone
OpenNone
OpenNone
OpenFeatureNone
OpenNone
OpenNone
Resolvedcscott
OpenNone
Resolvedcscott
OpenNone
OpenNone
OpenNone
Resolved ssastry
Resolvedcscott
ResolvedNone

Event Timeline

ssastry moved this task from Needs Triage to Missing Functionality on the Parsoid board.

This is probably Just Another Postprocessing pass. It would be great if we could refactor this to share code between core and Parsoid, so we don't have to keep updating to chase changes here. Even better would be if we could turn this postprocessiing option *off* (for both legacy and Parsoid) when running parser tests, as it is almost always "just noise" when evalutating parser test results.

It occurs to me that the legacy ID tags (with the alternate encoding) could also be added in read views, they are just stripped by VE as far as I know.

MSantos raised the priority of this task from Medium to High.Sep 19 2023, 3:51 PM

Change 975362 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Add styles for new heading HTML

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

Change 857766 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/CologneBlue@master] Add styles for new heading HTML

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

Change 857767 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/MinervaNeue@master] Add styles for new heading HTML

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

Change 857768 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/Modern@master] Add styles for new heading HTML

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

Change 857769 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/Nostalgia@master] Add styles for new heading HTML

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

Change 842860 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/Vector@master] Add styles for new heading HTML

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

Change 857770 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/Timeless@master] Add styles for new heading HTML

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

Change 975362 merged by jenkins-bot:

[mediawiki/core@master] Add styles for new heading HTML

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

Change 857767 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Add styles for new heading HTML

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

Change 857770 merged by jenkins-bot:

[mediawiki/skins/Timeless@master] Add styles for new heading HTML

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

Change 857769 merged by jenkins-bot:

[mediawiki/skins/Nostalgia@master] Add styles for new heading HTML

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

Change 857768 merged by jenkins-bot:

[mediawiki/skins/Modern@master] Add styles for new heading HTML

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

Change 857766 merged by jenkins-bot:

[mediawiki/skins/CologneBlue@master] Add styles for new heading HTML

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

Change 842860 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Add styles for new heading HTML

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

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

[mediawiki/core@master] [OutputTransform] Add section edit links to Parsoid output

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

Change 1000083 merged by jenkins-bot:

[mediawiki/core@master] [OutputTransform] Add section edit links to Parsoid output

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

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

[mediawiki/extensions/DiscussionTools@master] Prevent double-wrapping headings when using Parsoid

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

Change rMW100422962586 abandoned by C. Scott Ananian:

[mediawiki/extensions/DiscussionTools@master] Prevent double-wrapping headings when using Parsoid

Reason:

Abandoned in favor of I8cd28a3b42e55844be1258d639e605862952806f

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

cscott claimed this task.