Something went wrong. Try again.
the next generation of the in-browser educational proof assistant
Something went wrong. Try again.
14 kB · 398 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399<?xml version="1.0"?><!-- SPDX-License-Identifier: CC0-1.0 --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:f="http://www.forester-notes.org">
<xsl:key name="tree-with-uri" match="/f:tree/f:mainmatter//f:tree" use="f:frontmatter/f:uri/text()" />
<xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml" data-base-url="{/f:tree/@base-url}"> <head> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/dreampulse/computer-modern-web-font@master/fonts.css"/> <link rel="stylesheet" type="text/css" href="{/f:tree/@base-url}typicons.min.css" /> <link rel="stylesheet" type="text/css" href="{/f:tree/@base-url}holbert.css" /> <script type="module" crossorigin="true" src="{/f:tree/@base-url}holbert.js"></script> <meta name="viewport" content="width=device-width" /> <link rel="stylesheet" href="{/f:tree/@base-url}style.css" /> <link rel="stylesheet" href="{/f:tree/@base-url}katex.min.css" /> <script type="text/javascript"> <xsl:if test="/f:tree/f:frontmatter/f:source-path"> <xsl:text>window.sourcePath = '</xsl:text> <xsl:value-of select="/f:tree/f:frontmatter/f:source-path" /> <xsl:text>'</xsl:text> </xsl:if> </script> <script type="module" src="{/f:tree/@base-url}forester.js"></script> <title> <xsl:value-of select="/f:tree/f:frontmatter/f:title/@text" /> </title> </head> <body> <ninja-keys placeholder="Start typing a note title or ID"></ninja-keys> <xsl:if test="not(/f:tree[@root = 'true'])"> <header class="header"> <nav class="nav"> <div class="logo"> <a href="{/f:tree/@base-url}index.html" title="Home"> <xsl:text>« Home</xsl:text> </a> </div> </nav> </header> </xsl:if> <div id="grid-wrapper"> <article> <xsl:apply-templates select="f:tree" /> </article> <xsl:if test="f:tree/f:mainmatter/f:tree[not(@toc='false')] and not(/f:tree/f:frontmatter/f:meta[@name = 'toc']/.='false')"> <nav id="toc"> <div class="block"> <h1>Table of Contents</h1> <xsl:apply-templates select="f:tree/f:mainmatter" mode="toc" /> </div> </nav> </xsl:if> </div> </body> </html> </xsl:template>
<xsl:template match="f:tree" mode="tree-taxon-with-number"> <xsl:param name="suffix" select="''" /> <xsl:param name="taxon" select="f:frontmatter/f:taxon" /> <xsl:param name="number" select="f:frontmatter/f:number" /> <xsl:param name="fallback-number" /> <xsl:param name="in-backmatter" select="ancestor::f:backmatter" />
<xsl:variable name="tree-is-root" select="not(parent::*)" />
<xsl:variable name="explicitly-unnumbered" select="boolean(ancestor-or-self::f:tree[@numbered='false' or @toc='false'])" /> <xsl:variable name="implicitly-unnumbered" select="count(../f:tree) = 1 and not(count(f:mainmatter/f:tree) > 1)" />
<xsl:variable name="should-number" select="$number != '' or (not($in-backmatter) and not($tree-is-root) and not($explicitly-unnumbered)) and not($implicitly-unnumbered)" />
<xsl:if test="$taxon != ''"> <xsl:value-of select="$taxon" /> <xsl:if test="$should-number or $fallback-number != ''"> <xsl:text> </xsl:text> </xsl:if> </xsl:if>
<xsl:choose> <xsl:when test="$should-number"> <xsl:choose> <xsl:when test="$number != ''"> <xsl:value-of select="$number" /> </xsl:when> <xsl:otherwise> <xsl:number format="1.1" count="f:tree[ancestor::f:tree and (not(@toc='false' or @numbered='false'))]" level="multiple" /> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="$fallback-number != ''"> <xsl:value-of select="$fallback-number" /> </xsl:when> </xsl:choose>
<xsl:if test="$taxon != '' or $fallback-number != '' or $should-number"> <xsl:value-of select="$suffix" /> </xsl:if> </xsl:template>
<xsl:template match="f:tree" mode="contextual-number"> <xsl:param name="suffix" select="''" /> <xsl:param name="number" select="f:frontmatter/f:number" /> <xsl:param name="fallback-number" /> <xsl:param name="in-backmatter" select="ancestor::f:backmatter" />
<xsl:variable name="tree-is-root" select="not(parent::*)" />
<xsl:variable name="explicitly-unnumbered" select="boolean(ancestor-or-self::f:tree[@numbered='false' or @toc='false'])" /> <xsl:variable name="implicitly-unnumbered" select="count(../f:tree) = 1 and not(count(f:mainmatter/f:tree) > 1)" />
<xsl:variable name="should-number" select="$number != '' or (not($in-backmatter) and not($tree-is-root) and not($explicitly-unnumbered)) and not($implicitly-unnumbered)" />
<xsl:choose> <xsl:when test="$should-number"> <xsl:choose> <xsl:when test="$number != ''"> <xsl:value-of select="$number" /> </xsl:when> <xsl:otherwise> <xsl:number format="1.1" count="f:tree[ancestor::f:tree and (not(@toc='false' or @numbered='false'))]" level="multiple" /> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="$fallback-number != ''"> <xsl:value-of select="$fallback-number" /> </xsl:when> </xsl:choose>
<xsl:if test="$fallback-number != '' or $should-number"> <xsl:value-of select="$suffix" /> </xsl:if> </xsl:template>
<xsl:template match="f:tree" mode="toc"> <li> <xsl:for-each select="f:frontmatter"> <a class="bullet"> <xsl:choose> <xsl:when test="f:display-uri and f:route"> <xsl:attribute name="href"> <xsl:value-of select="f:route" /> </xsl:attribute> <xsl:attribute name="title"> <xsl:value-of select="f:title/@text" /> <xsl:text> [</xsl:text> <xsl:value-of select="f:display-uri" /> <xsl:text>]</xsl:text> </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"> <xsl:text>#</xsl:text> <xsl:value-of select="generate-id(..)" /> </xsl:attribute> <xsl:attribute name="title"> <xsl:value-of select="f:title" /> </xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:text>■</xsl:text> </a> <span class="link local" data-target="#{generate-id(..)}"> <span class="taxon"> <xsl:apply-templates select=".." mode="tree-taxon-with-number"> <xsl:with-param name="suffix">. </xsl:with-param> </xsl:apply-templates> </span>
<xsl:apply-templates select="f:title" /> </span> </xsl:for-each> <xsl:apply-templates select="f:mainmatter" mode="toc" /> </li> </xsl:template>
<xsl:template match="f:mainmatter" mode="toc"> <ul class="block"> <xsl:apply-templates select="f:tree[not(@toc='false')]" mode="toc" /> </ul> </xsl:template>
<xsl:template match="f:frontmatter/f:title"> <xsl:apply-templates /> </xsl:template>
<xsl:template match="f:mainmatter"> <xsl:apply-templates /> </xsl:template>
<xsl:template match="f:display-uri[../f:route]"> <a class="slug" href="{../f:route}"> <xsl:text>[</xsl:text> <xsl:value-of select="." /> <xsl:text>]</xsl:text> </a> </xsl:template>
<xsl:template match="f:display-uri[not(../f:route)]"> </xsl:template>
<xsl:template match="f:resource"> <xsl:apply-templates select="f:resource-content" /> </xsl:template>
<xsl:template match="f:resource-content"> <xsl:apply-templates /> </xsl:template>
<xsl:template match="f:source-path"> <a class="edit-button" href="{concat('vscode://file', .)}"> <xsl:text>[edit]</xsl:text> </a> </xsl:template>
<xsl:template match="f:taxon"> <xsl:value-of select="." /> </xsl:template>
<xsl:template match="f:frontmatter"> <header> <h1> <span class="taxon"> <xsl:apply-templates select=".." mode="tree-taxon-with-number"> <xsl:with-param name="suffix">. </xsl:with-param> </xsl:apply-templates> </span>
<xsl:apply-templates select="f:title" /> <xsl:text> </xsl:text> <xsl:apply-templates select="f:display-uri" /> <xsl:text> </xsl:text> <xsl:apply-templates select="f:source-path" /> </h1> <div class="metadata"> <ul> <xsl:apply-templates select="f:date" /> <xsl:if test="not(f:meta[@name = 'author']/.='false')"> <xsl:apply-templates select="f:authors" /> </xsl:if> <xsl:apply-templates select="f:meta[@name='position']" /> <xsl:apply-templates select="f:meta[@name='institution']" /> <xsl:apply-templates select="f:meta[@name='venue']" /> <xsl:apply-templates select="f:meta[@name='source']" /> <xsl:apply-templates select="f:meta[@name='doi']" /> <xsl:apply-templates select="f:meta[@name='orcid']" /> <xsl:apply-templates select="f:meta[@name='external']" /> <xsl:apply-templates select="f:meta[@name='slides']" /> <xsl:apply-templates select="f:meta[@name='video']" /> </ul> </div> </header> </xsl:template>
<xsl:template match="f:ref"> <xsl:variable name="fallback-number"> <xsl:text>[</xsl:text> <xsl:value-of select="@uri" /> <xsl:text>]</xsl:text> </xsl:variable>
<xsl:variable name="taxon"> <xsl:choose> <xsl:when test="@taxon"> <xsl:value-of select="@taxon" /> </xsl:when> <xsl:otherwise> <xsl:text>§</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable>
<a class="link local"> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="key('tree-with-uri',current()/@uri)"> <xsl:text>#</xsl:text> <xsl:value-of select="generate-id(key('tree-with-uri',current()/@uri))" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="@href" /> </xsl:otherwise> </xsl:choose> </xsl:attribute>
<xsl:choose> <xsl:when test="key('tree-with-uri', current()/@uri)"> <xsl:apply-templates select="key('tree-with-uri', current()/@uri)" mode="tree-taxon-with-number"> <xsl:with-param name="in-backmatter" select="boolean(ancestor::f:backmatter)" /> <xsl:with-param name="number" select="@number" /> <xsl:with-param name="fallback-number" select="$fallback-number" /> <xsl:with-param name="taxon" select="$taxon" /> </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:value-of select="$taxon" /> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="@number"> <xsl:value-of select="@number" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$fallback-number" /> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </a> </xsl:template>
<xsl:template match="f:contextual-number[@uri]"> <xsl:variable name="fallback-number"> <xsl:text>[</xsl:text> <xsl:value-of select="@display-uri" /> <xsl:text>]</xsl:text> </xsl:variable>
<xsl:choose> <xsl:when test="key('tree-with-uri', current()/@uri)"> <xsl:apply-templates select="key('tree-with-uri', current()/@uri)" mode="contextual-number"> <xsl:with-param name="in-backmatter" select="boolean(ancestor::f:backmatter)" /> <xsl:with-param name="fallback-number" select="$fallback-number" /> </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:value-of select="$fallback-number" /> </xsl:otherwise> </xsl:choose> </xsl:template>
<xsl:template match="/f:tree[@root='true']/f:backmatter"> </xsl:template>
<xsl:template match="/f:tree[not(@root='true')]/f:backmatter"> <footer> <xsl:apply-templates /> </footer> </xsl:template>
<xsl:template match="f:mainmatter//f:backmatter"> </xsl:template>
<xsl:template match="f:backmatter//f:backmatter"> </xsl:template>
<xsl:template match="f:tree[f:mainmatter[*] or not(@hidden-when-empty = 'true')]"> <section> <xsl:attribute name="lang"> <xsl:choose> <xsl:when test="f:frontmatter/f:meta[@name='lang']"> <xsl:value-of select="f:frontmatter/f:meta[@name='lang']" /> </xsl:when> <xsl:otherwise>en</xsl:otherwise> </xsl:choose> </xsl:attribute>
<xsl:choose> <xsl:when test="@show-metadata = 'false'"> <xsl:attribute name="class">block hide-metadata</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="class">block</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:if test="f:frontmatter/f:taxon"> <xsl:attribute name="data-taxon"> <xsl:value-of select="f:frontmatter/f:taxon" /> </xsl:attribute> </xsl:if>
<xsl:choose> <xsl:when test="not(@show-heading='false')"> <details id="{generate-id(.)}"> <xsl:if test="not(@expanded = 'false')"> <xsl:attribute name="open">open</xsl:attribute> </xsl:if> <summary> <xsl:apply-templates select="f:frontmatter" /> </summary> <xsl:apply-templates select="f:mainmatter" /> <xsl:apply-templates select="f:frontmatter/f:meta[@name='bibtex']" /> </details> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="f:mainmatter" /> </xsl:otherwise> </xsl:choose> </section>
<xsl:apply-templates select="f:backmatter" /> </xsl:template>
<xsl:template match="f:tree"></xsl:template>
</xsl:stylesheet>