.pre-process-main.pl can be simplified or rolled into Wattsi
domenic opened this issue · 2 comments
I'm idly investigating if we can simplify html-build by removing the Perl scripts. Here's at least one piece of low-hanging fruit.
If you run
HTML_SOURCE=html HTML_CACHE=.cache perl .pre-process-main.pl < html/source > .temp/source-expanded-1
and diff the results, there are only three transformations actually performed:
- Replacing
<!--REPRESENTS article-->
and friends in https://html.spec.whatwg.org/#usage-summary-2 with the values defined elsewhere in the document - Replacing
<!--BOILERPLATE cldr.inc -->
and friends with some files from the build process - Replacing
<pre>EXAMPLE offline/clock/clock.appcache</pre>
and friends with their contents from thedemos/
folder.
All the stuff in parserExpander
and its sub-function expand
appear to be unused.
I think we should add a facility to Wattsi to do arbitrary file insertions, e.g. <!--INSERTFILE filename-->
. Then we can eliminate the <!--BOILERPLATE x-->
and <pre>EXAMPLE x</pre>
specializations of this from the Perl script and leave it doing only the more complicated <!--REPRESENTS -->
business.
The REPRESENTS thing is part of a more general class of problems (basically, substituting text or HTML from one part of the spec into another) that we could try to tackle in Wattsi as a separate effort, after we've done the easier stuff.
👍 yeah, all looks doable — and getting rid of the Perl dependency would be a nice win
One thing I realized is that, unless this is done in a failure-tolerant way (which seems subpar), then this would probably break wattsi-server and thus PR preview :-/.