⚓ T203780 Rewrite the section-wrap logic (original) (raw)

Rewrite the section-wrap logic

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

...

Since div is block tag, we will need to wrap

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

Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL · Credits