Nick Bowler [Thu, 10 Jan 2019 03:00:58 +0000 (22:00 -0500)]
Add a postprocess hook to gzip output text items.
This enables the use of nginx gzip_static functionality, reducing
per-request processing. This is only done if GZIP_SITE is set to
a nonempty value in the environment so it can be run only when
publishing to avoid noise when authoring.
Nick Bowler [Wed, 9 Jan 2019 01:23:36 +0000 (20:23 -0500)]
Work around Nokogiri pretty-print issues.
In general, pretty-printing XHTML will change its meaning because
whitespace added or removed can affect the results. Instead of using
the xsl:strip-space functionality which is quite limited, use a normal
template to remove unwanted whitespace-only text nodes which can be
manually tweaked as required.
Then we explicitly add dummy nodes to prevent Nokogiri from reindenting
problematic cases, and finally clean those out just before publishing
(after all XSLT processing is finished).