Page MenuHomePhabricator

Rewrite the section-wrap logic
Closed, ResolvedPublic


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 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

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

Stashbot subscribed.

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)