Skip to content

Commit

Permalink
variable to hold common head and end of body content for HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
ascholerChemeketa committed Dec 13, 2024
1 parent c3ebad9 commit b789e74
Showing 1 changed file with 64 additions and 69 deletions.
133 changes: 64 additions & 69 deletions xsl/pretext-html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10464,6 +10464,57 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<!-- Web Page Infrastructure -->
<!-- -->

<!-- Build a cache of the head elements that are constant across all pages in a book -->
<xsl:variable name="file-wrap-simple-head-cache"> <!-- Add keywords, including those in bibinfo -->
<xsl:call-template name="keywords-meta-element"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!-- more "meta" elements for discovery -->
<xsl:call-template name="open-graph-info"/>
<xsl:call-template name="sagecell-code" />
<xsl:call-template name="favicon"/>
<xsl:call-template name="mathjax" />
<xsl:call-template name="webwork-js"/>
<xsl:call-template name="myopenmath-js"/>
<xsl:call-template name="syntax-highlight"/>
<xsl:call-template name="pretext-js" />
<xsl:call-template name="knowl" />
<xsl:call-template name="fonts" />
<xsl:call-template name="hypothesis-annotation" />
<xsl:call-template name="geogebra" />
<xsl:call-template name="jsxgraph" />
<xsl:call-template name="diagcess-header" />
<xsl:call-template name="css" />
<xsl:call-template name="runestone-header"/>
<xsl:call-template name="font-awesome" />
<xsl:call-template name="mermaid-header" />
<!-- Custom styles for li where parent ol has @marker specified -->
<style>
<xsl:text>&#xa;</xsl:text>
<xsl:apply-templates select="$document-root//ol" mode="ol-marker-style"/>
</style>
</xsl:variable>

<xsl:variable name="file-wrap-full-head-cache">
<xsl:copy-of select="$file-wrap-simple-head-cache"/>
<xsl:call-template name="google-search-box-js" />
<xsl:call-template name="native-search-box-js" />
</xsl:variable>

<!-- Build a cache of the stuff inserted at the end of the body -->
<xsl:variable name="file-wrap-simple-endbody-cache">
<xsl:call-template name="statcounter"/>
<xsl:call-template name="google-classic"/>
<xsl:call-template name="google-universal"/>
<xsl:call-template name="google-gst"/>
<xsl:call-template name="diagcess-footer"/>
<xsl:call-template name="extra-js-footer"/>
</xsl:variable>

<xsl:variable name="file-wrap-full-endbody-cache">
<xsl:copy-of select="$file-wrap-simple-endbody-cache"/>
<xsl:call-template name="runestone-ethical-ads"/>
</xsl:variable>

<!-- An individual page: -->
<!-- Inputs: -->
<!-- * page content (exclusive of banners, navigation etc) -->
Expand Down Expand Up @@ -10509,44 +10560,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
</xsl:if>
<xsl:apply-templates select="." mode="title-plain" />
</title>
<!-- Add keywords, including those in bibinfo -->
<xsl:call-template name="keywords-meta-element"/>
<!-- http://webdesignerwall.com/tutorials/responsive-design-in-3-steps -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!-- canonical link for better SEO -->
<xsl:call-template name="canonical-link">
<xsl:with-param name="filename" select="$the-filename"/>
</xsl:call-template>
<!-- more "meta" elements for discovery -->
<xsl:call-template name="open-graph-info"/>
<!-- favicon -->
<xsl:call-template name="favicon"/>
<!-- jquery used by sage, webwork, knowls -->
<xsl:call-template name="sagecell-code" />
<xsl:call-template name="mathjax" />
<!-- webwork's iframeResizer needs to come before sage -->
<xsl:call-template name="webwork-js"/>
<xsl:call-template name="myopenmath-js"/>
<!-- grab the contents every page gets -->
<xsl:copy-of select="$file-wrap-full-head-cache"/>
<!-- now do anything that is page-specific and comes after cache -->
<!-- webwork's iframeResizer needs to come before sagecell template -->
<xsl:apply-templates select="." mode="sagecell" />
<xsl:call-template name="syntax-highlight"/>
<xsl:call-template name="google-search-box-js" />
<xsl:call-template name="native-search-box-js" />
<xsl:call-template name="pretext-js" />
<xsl:call-template name="knowl" />
<xsl:call-template name="fonts" />
<xsl:call-template name="hypothesis-annotation" />
<xsl:call-template name="geogebra" />
<xsl:call-template name="jsxgraph" />
<xsl:call-template name="diagcess-header" />
<xsl:call-template name="css" />
<xsl:call-template name="runestone-header"/>
<xsl:call-template name="font-awesome" />
<xsl:call-template name="mermaid-header" />
<!-- Custom styles for li where parent ol has @marker specified -->
<style>
<xsl:text>&#xa;</xsl:text>
<xsl:apply-templates select="$document-root//ol" mode="ol-marker-style"/>
</style>
</head>
<body>
<!-- potential document-id per-page -->
Expand Down Expand Up @@ -10642,14 +10664,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<xsl:call-template name="runestone-link"/>
<xsl:call-template name="mathjax-link" />
</div>
<xsl:call-template name="runestone-ethical-ads"/>
<!-- analytics services, if requested -->
<xsl:call-template name="statcounter"/>
<xsl:call-template name="google-classic"/>
<xsl:call-template name="google-universal"/>
<xsl:call-template name="google-gst"/>
<xsl:call-template name="diagcess-footer"/>
<xsl:call-template name="extra-js-footer"/>
<xsl:copy-of select="$file-wrap-full-endbody-cache"/>
</body>
</html>
</exsl:document>
Expand All @@ -10658,7 +10673,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<!-- A minimal individual page: -->
<!-- Inputs: -->
<!-- * page content (exclusive of banners, navigation etc) -->
<!-- Maybe a page title -->
<xsl:template match="*" mode="simple-file-wrap">
<xsl:param name="content" />
<xsl:variable name="filename">
Expand All @@ -10672,31 +10686,17 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<xsl:call-template name="language-attributes"/>
<!-- Open Graph Protocol only in "meta" elements, within "head" -->
<head xmlns:og="http://ogp.me/ns#" xmlns:book="https://ogp.me/ns/book#">
<!-- keywords, including those from bibinfo -->
<xsl:call-template name="keywords-meta-element" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>
<xsl:apply-templates select="." mode="title-plain" />
</title>
<!-- canonical link for better SEO -->
<xsl:call-template name="canonical-link">
<xsl:with-param name="filename" select="$filename"/>
</xsl:call-template>
<!-- more "meta" elements for discovery -->
<xsl:call-template name="open-graph-info"/>
<!-- jquery used by sage, webwork, knowls -->
<xsl:call-template name="sagecell-code" />
<xsl:call-template name="mathjax" />
<!-- webwork's iframeResizer needs to come before sage -->
<xsl:call-template name="webwork-js"/>
<xsl:call-template name="myopenmath-js"/>
<!-- grab the contents every page gets -->
<xsl:copy-of select="$file-wrap-simple-head-cache"/>
<!-- now do anything that is page-specific and comes after cache -->
<xsl:apply-templates select="." mode="sagecell" />
<xsl:call-template name="knowl" />
<xsl:call-template name="fonts" />
<xsl:call-template name="hypothesis-annotation" />
<xsl:call-template name="geogebra" />
<xsl:call-template name="jsxgraph" />
<xsl:call-template name="diagcess-header" />
<xsl:call-template name="css" />
<xsl:call-template name="runestone-header"/>
<xsl:call-template name="font-awesome" />
</head>
<!-- TODO: needs some padding etc -->
<!-- ignore MathJax signals everywhere, then enable selectively -->
Expand All @@ -10706,13 +10706,8 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<!-- React flag -->
<xsl:call-template name="react-in-use-flag"/>
<xsl:copy-of select="$content" />
<!-- analytics services, if requested -->
<xsl:call-template name="statcounter"/>
<xsl:call-template name="google-classic"/>
<xsl:call-template name="google-universal"/>
<xsl:call-template name="google-gst"/>
<xsl:call-template name="diagcess-footer"/>
<xsl:call-template name="extra-js-footer"/>

<xsl:copy-of select="$file-wrap-simple-endbody-cache"/>
</body>
</html>
</exsl:document>
Expand Down

0 comments on commit b789e74

Please sign in to comment.