Hacker News new | past | comments | ask | show | jobs | submit login
Static website generator based on HTML rewriting not template processing (baturin.org)
2 points by davesailer 3 months ago | hide | past | web | favorite | 1 comment

This is definitely a "path not taken", that is, parse HTML documents down to the DOM, manipulate them at that level, then turn them back to HTML.

With that kind of system, you can use a plain ordinary HTML editor to do everything from writing templates to writing content and it is sweet. With all of the semantically-oriented elements in HTML5 the code is nice.

Text-based templating still rules the roost and I think performance is a big part of it. I've tried it in both the Python and Java ecosystems and found that you lose at least a factor of ten in performance if you use X-Soup. In the case of live page generation that is both a latency and a throughput problem, in the case of a static page generator, however, it is not so bad.

One really cool thing about this approach is that you could hypothetically suck in HTML from many different sources and incorporate it into one page. It's a little trickier than that however because of namespace problems; people reuse the same id(s) and classes a lot -- you might give up on forms and Javascript for this and just stick to document-oriented documents, but for this to be completely comprehensive you'd need something that rewrites CSS too.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact