Skip to content

Commit

Permalink
HTML: incorporate Diagcess viewer for accessible PreFigure diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
rbeezer committed Nov 6, 2024
1 parent 3acd5af commit 7a52bb2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/diagcess/diagcess.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions xsl/pretext-html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<xsl:variable name="b-has-mermaid" select="boolean($document-root//image[mermaid]|/image[mermaid])"/>
<!-- 2018-04-06: jsxgraph deprecated -->
<xsl:variable name="b-has-jsxgraph" select="boolean($document-root//jsxgraph)"/>
<!-- Plural "annotations" is a child of "diagram" -->
<xsl:variable name="b-has-prefigure-annotations" select="boolean($document-root//pf:prefigure/pf:diagram/pf:annotations)"/>
<xsl:variable name="b-dynamics-static-seed" select="false()"/>
<!-- Every page has an index button, with a link to the index -->
<!-- Here we assume there is at most one -->
Expand Down Expand Up @@ -6470,6 +6472,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<xsl:call-template name="knowl" />
<xsl:call-template name="fonts" />
<xsl:call-template name="font-awesome" />
<xsl:call-template name="diagcess-header" />
<xsl:call-template name="css" />
<xsl:call-template name="runestone-header"/>
<xsl:call-template name="font-awesome" />
Expand Down Expand Up @@ -6548,6 +6551,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<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"/>
</body>
</html>
Expand Down Expand Up @@ -10295,6 +10299,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<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" />
Expand Down Expand Up @@ -10405,6 +10410,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<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"/>
</body>
</html>
Expand Down Expand Up @@ -10448,6 +10454,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<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" />
Expand All @@ -10465,6 +10472,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
<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"/>
</body>
</html>
Expand Down Expand Up @@ -12608,6 +12616,20 @@ TODO:
</xsl:if>
</xsl:template>

<!-- Diagcess header library -->
<xsl:template name="diagcess-header">
<xsl:if test="$b-has-prefigure-annotations">
<script src="_static/pretext/js/diagcess/diagcess.js"></script>
</xsl:if>
</xsl:template>

<!-- Diagcess footer initialization -->
<xsl:template name="diagcess-footer">
<xsl:if test="$b-has-prefigure-annotations">
<script>diagcess.Base.init()</script>
</xsl:if>
</xsl:template>

<!-- CSS header -->
<xsl:template name="css">
<xsl:if test="not($b-debug-react)">
Expand Down

0 comments on commit 7a52bb2

Please sign in to comment.