aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-04-14 00:30:55 +0200
committerAdrian Kummerlaender2019-04-14 00:30:55 +0200
commit5cf39944c597767301e69cd80b7e7c79f48d876c (patch)
tree0374e568abead714e5985c14e16daf5697eb6e0a
parent037a1f4d4fc1a67158ab0c6aa99608e6fae85ed2 (diff)
downloadOverview-5cf39944c597767301e69cd80b7e7c79f48d876c.tar
Overview-5cf39944c597767301e69cd80b7e7c79f48d876c.tar.gz
Overview-5cf39944c597767301e69cd80b7e7c79f48d876c.tar.bz2
Overview-5cf39944c597767301e69cd80b7e7c79f48d876c.tar.lz
Overview-5cf39944c597767301e69cd80b7e7c79f48d876c.tar.xz
Overview-5cf39944c597767301e69cd80b7e7c79f48d876c.tar.zst
Overview-5cf39944c597767301e69cd80b7e7c79f48d876c.zip
Update formatter and styling to match blog generator
-rw-r--r--source/99_result/main.css1
-rw-r--r--utility/formatter.xsl67
2 files changed, 67 insertions, 1 deletions
diff --git a/source/99_result/main.css b/source/99_result/main.css
index 5b907a4..9b140fe 100644
--- a/source/99_result/main.css
+++ b/source/99_result/main.css
@@ -28,6 +28,7 @@ sub{vertical-align:baseline;position:relative;top:0.4em}
#introduction img{border-radius:0.5em;margin-right:1.5em;float:left;width:12em;height:12em}
#introduction p{width:31.5em;float:right}
#introduction .greeting{font:bold 1.1em 'Oswald',sans-serif;display:inline-block}
+#content img{padding:.2em;border:.1em solid #e3e8e8;display:block;margin-left:auto;margin-right:auto;max-width:95%}
.info{font:normal .8em 'Oswald',sans-serif;margin-bottom:.5em;display:block}
.info a{margin:0 .1em 0 .1em}
diff --git a/utility/formatter.xsl b/utility/formatter.xsl
index 57edf2d..606a764 100644
--- a/utility/formatter.xsl
+++ b/utility/formatter.xsl
@@ -18,6 +18,23 @@
)/self::command/node()"/>
</xsl:template>
+<xsl:template name="math_highlighter">
+ <xsl:param name="source"/>
+ <xsl:param name="arguments"/>
+
+ <xsl:variable name="formatted_expression">
+ <xsl:call-template name="plain_formatter">
+ <xsl:with-param name="format">
+ <xsl:text>katex </xsl:text>
+ <xsl:value-of select="$arguments"/>
+ </xsl:with-param>
+ <xsl:with-param name="source" select="$source"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:copy-of select="xalan:nodeset($formatted_expression)/node()"/>
+</xsl:template>
+
<xsl:template name="code_highlighter">
<xsl:param name="source"/>
<xsl:param name="language"/>
@@ -43,6 +60,18 @@
</xsl:copy>
</xsl:template>
+<xsl:template match="h2" mode="embellish">
+ <h3>
+ <xsl:apply-templates select="node()" mode="embellish"/>
+ </h3>
+</xsl:template>
+
+<xsl:template match="h3" mode="embellish">
+ <h4>
+ <xsl:apply-templates select="node()" mode="embellish"/>
+ </h4>
+</xsl:template>
+
<xsl:template match="pre" mode="embellish">
<xsl:call-template name="code_highlighter">
<xsl:with-param name="source" select="code/text()"/>
@@ -59,12 +88,48 @@
</xsl:call-template>
</xsl:template>
+<xsl:template match="div[@class = 'figure']" mode="embellish">
+ <p>
+ <xsl:apply-templates select="img" mode="embellish"/>
+ </p>
+</xsl:template>
+
+<xsl:template match="div[@class = 'footnotes']/hr" mode="embellish"/>
+
+<xsl:template match="div[@class = 'footnotes']//a[contains(@href, '#fnref')]" mode="embellish">
+ <a href="{@href}" class="more">
+ <xsl:apply-templates select="node()" mode="embellish"/>
+ </a>
+</xsl:template>
+
+<xsl:template match="span[contains(@class, 'math')]" mode="embellish">
+ <xsl:choose>
+ <xsl:when test="contains(@class, 'display')">
+ <p class="math">
+ <xsl:call-template name="math_highlighter">
+ <xsl:with-param name="source" select="substring(text(),3,string-length(text())-4)"/>
+ <xsl:with-param name="arguments">
+ <xsl:text>--display-mode</xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </p>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="math">
+ <xsl:call-template name="math_highlighter">
+ <xsl:with-param name="source" select="substring(text(),3,string-length(text())-4)"/>
+ </xsl:call-template>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template name="formatter">
<xsl:param name="source"/>
<xsl:variable name="content">
<xsl:call-template name="plain_formatter">
- <xsl:with-param name="format">pandoc -f markdown -t html --no-highlight</xsl:with-param>
+ <xsl:with-param name="format">pandoc -f markdown -t html4 --katex --no-highlight -fmarkdown-implicit_figures</xsl:with-param>
<xsl:with-param name="source" select="$source"/>
</xsl:call-template>
</xsl:variable>