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
```lang=html
<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 than 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.