diff options
-rw-r--r-- | .config/pancake/unclutter/hackage-haddock.xsl | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/.config/pancake/unclutter/hackage-haddock.xsl b/.config/pancake/unclutter/hackage-haddock.xsl index e10b66c..daa0a02 100644 --- a/.config/pancake/unclutter/hackage-haddock.xsl +++ b/.config/pancake/unclutter/hackage-haddock.xsl @@ -4,22 +4,34 @@ <xsl:template match="/"> <html> <body> - <!-- Mostly copying, just inserting horizontal rules before - function descriptions. --> + <!-- Copy metadata and ToC --> <xsl:copy-of select="//div[@id='package-header']" /> <xsl:copy-of select="//div[@id='module-header']" /> <xsl:copy-of select="//div[@id='description']" /> <xsl:copy-of select="//div[@id='table-of-contents']" /> <xsl:copy-of select="//div[@id='synopsis']" /> - <div id="interface"> - <xsl:for-each select="//div[@id='interface']/node()"> - <xsl:if test="@class = 'top'"> - <hr /> - </xsl:if> - <xsl:copy-of select="." /> - </xsl:for-each> - </div> + <xsl:apply-templates select="//div[@id='interface']" /> </body> </html> </xsl:template> + + <!-- Function declarations: add <hr /> before them. --> + <xsl:template match="div[@class='top']"> + <hr /> + <xsl:copy> + <xsl:copy-of select="@*" /> + <xsl:apply-templates /> + </xsl:copy> + </xsl:template> + + <!-- Don't show all the class methods for each instance. --> + <xsl:template match="div[@class='subs methods']" /> + + <!-- Catch-all: copy and apply templates --> + <xsl:template match="node()" priority="0"> + <xsl:copy> + <xsl:copy-of select="@*" /> + <xsl:apply-templates /> + </xsl:copy> + </xsl:template> </xsl:stylesheet> |