Page MenuHomePhabricator

Investigate whether Cite rollback / redo mechanism can be avoided
Closed, ResolvedPublic

Description

The point of this task is to find whether the "rollback" step can be avoided during parsing. This logic exists to handle the case when a <ref> tag is processed as if it's on the top level of the document, but later we discover that it was inside of a disguised <references> block written as {{#tag|references. The rollback adds significant complexity to Cite and it would be worthwhile to rewrite this in a simpler way if possible.

Since we already use the same formatter for footnote marks in the article body and in the footnote block, it's a good target for giving authority over numbering. Upstream callers are released of responsibility.

Abandoned patch moving numbering from ReferenceStack to FootnoteMarkFormatter: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cite/+/553478

Event Timeline

awight moved this task from Doing to Sprint Backlog on the WMDE-TechWish-Sprint-2023-12-06 board.
awight updated the task description. (Show Details)
awight renamed this task from Shift responsibility for numbering down to the FootnoteMarkFormatter to Investigate whether Cite rollback / redo mechanism can be avoided.Dec 19 2023, 8:35 AM
awight updated the task description. (Show Details)

Suppressing the #tag expansion of inner content by hacking it out of CoreParserFunctions results in identical output and all Cite parser regression tests passing, and gives a sequential parse order which would simplify Cite in the ways we desire. Unfortunately, I don't see any existing mechanisms which would allow Cite to avoid parsing in this context.

I got curious about whether the inner content expansion can be skipped altogether, since the result will continue to be expanded in any case. Running the full parser test suite shows two new failures if we try this. Test cases are:

  • Preprocessor precedence 11: found during visual diff testing
  • Parsoid: unknown parser function (T314524)

But the way these fail could be more of a technicality and not something that editors rely on... maybe?

Okay it's not quite that easy. The inner content does need to be expanded when it's transformed into XML-ified wikitext but the outer tag isn't handled by an extension. In that case, {{#tag:b|This is a known parser function}} becomes <b><part><name index="1"/><value>This is a known parser function</value></part> </b> for example.

Not much to show for my trouble.

thiemowmde assigned this task to awight.