Page MenuHomePhabricator

Rewrite the section-wrap logic
Closed, ResolvedPublic

Description

The section wrapping is done in Parser.js using the sax events. This has a fundamental disadvantage that you won't know what is the next tag while processing a tag. This has created many issues in the past and the patched up code to do section-wrap is very fragile. There are lot of tracking variables and every now and then we discover we need more contextual information to decide section-wrap.

For example, a template can be multi-part with

<div data-mw={} about=x></div>
<table about=x>...</table>

Since div is block tag, we will need to wrap <section><div data-mw={} about=x></div></section>. But immediately after that we get table, and we see that it is the next part of same template. So we need to wrap both the div and table in single section. This is very difficult in sax parsing.

I am proposing to write the section-wrap similar to segment() where we can iterate the linear model of the HTML and full struture of HTML is known.

Event Timeline

santhosh created this task.Sep 7 2018, 10:54 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 7 2018, 10:54 AM
santhosh claimed this task.Sep 7 2018, 10:54 AM
santhosh triaged this task as High priority.
santhosh updated the task description. (Show Details)

Change 458780 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/services/cxserver@master] Rewrite the section-wrap logic

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

Change 458780 merged by jenkins-bot:
[mediawiki/services/cxserver@master] Rewrite the section-wrap logic

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

Stashbot added a subscriber: Stashbot.

Mentioned in SAL (#wikimedia-operations) [2018-09-24T04:10:54Z] <kartik@deploy1001> Started deploy [cxserver/deploy@3e2d668]: Update cxserver to d913793 (T203551, T203780, T202716, T203947)

Mentioned in SAL (#wikimedia-operations) [2018-09-24T04:15:13Z] <kartik@deploy1001> Finished deploy [cxserver/deploy@3e2d668]: Update cxserver to d913793 (T203551, T203780, T202716, T203947) (duration: 04m 20s)

Petar.petkovic removed a project: Patch-For-Review.
Petar.petkovic moved this task from In Review to QA on the Language-2018-July-September board.
Petar.petkovic removed subscribers: Stashbot, gerritbot.
Arrbee closed this task as Resolved.Oct 1 2018, 2:33 PM