@@ -9689,7 +9689,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
96899689 <iframe src="https://www.desmos.com/calculator/{@desmos}">
96909690 <xsl:apply-templates select="." mode="html-id-attribute"/>
96919691 <xsl:apply-templates select="." mode="iframe-dark-mode-attribute" />
9692- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9692+ <xsl:apply-templates select="." mode="interactive-sizing-style-attribute " />
96939693 </iframe>
96949694</xsl:template>
96959695
@@ -9771,7 +9771,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
97719771 <iframe src="https://www.geogebra.org/material/iframe/id/{@geogebra}/scaleContainerClass/interactive-iframe-container/width/{$ggbMaterialWidth}/height/{$ggbMaterialHeight}/allowUpscale/true/autoHeight/true/border/888888/smb/false/stb/{$ggbToolBar}/stbh/{$ggbToolBar}/ai/{$ggbAlgebraInput}/asb/false/sri/{$ggbResetIcon}/rc/false/ld/false/sdz/{$ggbShiftDragZoom}/ctl/false">
97729772 <xsl:apply-templates select="." mode="html-id-attribute"/>
97739773 <xsl:apply-templates select="." mode="iframe-dark-mode-attribute" />
9774- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9774+ <xsl:apply-templates select="." mode="interactive-sizing-style-attribute " />
97759775 </iframe>
97769776</xsl:template>
97779777
@@ -9805,7 +9805,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
98059805 <xsl:variable name="full-url" select="concat($cp3d-endpoint, '?', @calcplot3d)" />
98069806 <iframe src="{$full-url}">
98079807 <xsl:apply-templates select="." mode="html-id-attribute"/>
9808- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9808+ <xsl:apply-templates select="." mode="interactive-sizing-style-attribute " />
98099809 <xsl:apply-templates select="." mode="iframe-dark-mode-attribute" />
98109810 </iframe>
98119811</xsl:template>
@@ -9839,7 +9839,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
98399839 </xsl:variable>
98409840 <iframe src="https://www.falstad.com/circuit/circuitjs.html?cct='{$url-string}'">
98419841 <xsl:apply-templates select="." mode="html-id-attribute"/>
9842- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9842+ <xsl:apply-templates select="." mode="interactive-sizing-style-attribute " />
98439843 <xsl:apply-templates select="." mode="iframe-dark-mode-attribute" />
98449844 </iframe>
98459845</xsl:template>
@@ -9862,7 +9862,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
98629862 </xsl:variable>
98639863 <iframe src="{$location}">
98649864 <xsl:apply-templates select="." mode="html-id-attribute"/>
9865- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9865+ <xsl:apply-templates select="." mode="interactive-sizing-style-attribute " />
98669866 <xsl:apply-templates select="." mode="iframe-dark-mode-attribute" />
98679867 </iframe>
98689868</xsl:template>
@@ -9871,7 +9871,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
98719871<xsl:template match="interactive[@platform]" mode="iframe-interactive">
98729872 <iframe>
98739873 <xsl:apply-templates select="." mode="html-id-attribute"/>
9874- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9874+ <xsl:apply-templates select="." mode="interactive-sizing-style-attribute " />
98759875 <xsl:attribute name="src">
98769876 <xsl:apply-templates select="." mode="iframe-filename" />
98779877 </xsl:attribute>
@@ -9917,8 +9917,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
99179917 <xsl:call-template name="latex-macros"/>
99189918 <div>
99199919 <!-- the actual interactive bit -->
9920- <xsl:apply-templates select="." mode="get- interactive-sizing-styles " />
9920+ <!-- < xsl:apply-templates select="." mode="interactive-sizing-style-attribute " /> -- >
99219921 <!-- <xsl:apply-templates select="." mode="size-pixels-style-attribute" /> -->
9922+
99229923 <!-- stack, else use a layout -->
99239924 <xsl:apply-templates select="slate|sidebyside|sbsgroup" />
99249925 <!-- accumulate script tags *after* HTML elements -->
@@ -10048,7 +10049,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1004810049 <xsl:attribute name="id">
1004910050 <xsl:value-of select="@xml:id" />
1005010051 </xsl:attribute>
10051- <xsl:apply-templates select="." mode="size-pixels-style-attribute" />
10052+ <!-- < xsl:apply-templates select="." mode="size-pixels-style-attribute" /> -- >
1005210053 </div>
1005310054</xsl:template>
1005410055
@@ -10071,15 +10072,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1007110072</xsl:template>
1007210073
1007310074<xsl:template match="slate[@surface = 'canvas']">
10074- <!-- display:block allows precise sizes, without -->
10075- <!-- having inline content with extra line height, -->
10076- <!-- or whatever, inducing scroll bars -->
10077- <canvas style="display:block">
10075+ <canvas>
1007810076 <xsl:attribute name="id">
1007910077 <xsl:value-of select="@xml:id" />
1008010078 </xsl:attribute>
1008110079 <xsl:apply-templates select="." mode="size-pixels-attributes" />
10082- <!-- <xsl:apply-templates select="." mode="get-interactive-sizing-styles" /> -->
10080+ <!-- <xsl:apply-templates select="." mode="interactive-sizing-style-attribute" /> -->
10081+ <xsl:attribute name="class">
10082+ <xsl:text>interactive--slate</xsl:text>
10083+ </xsl:attribute>
1008310084 </canvas>
1008410085</xsl:template>
1008510086
@@ -10455,32 +10456,19 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1045510456</xsl:template>
1045610457
1045710458<!-- Sizing styles for interactives -->
10458- <!-- Two major modes based on how to resize: responsive or fixed -->
10459- <!-- fixed applies aspect ratio at build as css height -->
10459+ <!-- Two major modes based on how to resize: responsive or fixed-height -->
10460+ <!-- fixed-height applies aspect ratio at build as css height -->
1046010461<!-- responsive dynamically applies aspect ratio via css -->
10461- <xsl:template match="interactive" mode="get- interactive-sizing-styles ">
10462+ <xsl:template match="interactive" mode="interactive-sizing-style-attribute ">
1046210463 <xsl:variable name="resize-behavior">
1046310464 <xsl:apply-templates select="." mode="get-resize-behavior"/>
1046410465 </xsl:variable>
10465- <!-- width in either mode will either come from supplied design-width -->
10466- <!-- or be calculated from width % and global design-width -->
10467- <xsl:variable name="has-design-width" select="@design-width != ''"/>
10468- <xsl:variable name="width-pixels">
10469- <xsl:choose>
10470- <xsl:when test="$has-design-width">
10471- <xsl:value-of select="@design-width"/>
10472- </xsl:when>
10473- <xsl:otherwise>
10474- <xsl:apply-templates select="." mode="get-width-pixels"/>
10475- </xsl:otherwise>
10476- </xsl:choose>
10477- </xsl:variable>
1047810466 <xsl:attribute name="style">
1047910467 <xsl:choose>
1048010468 <xsl:when test="$resize-behavior = 'responsive'">
1048110469 <xsl:text>max-width: </xsl:text>
1048210470 <xsl:choose>
10483- <xsl:when test="$has- design-width">
10471+ <xsl:when test="@ design-width != '' ">
1048410472 <xsl:value-of select="@design-width"/>
1048510473 <xsl:text>px; </xsl:text>
1048610474 </xsl:when>
@@ -10497,35 +10485,23 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1049710485 <xsl:text>;</xsl:text>
1049810486 </xsl:when>
1049910487 <xsl:otherwise>
10500- <!-- resize-behavior: fixed -->
10488+ <!-- resize-behavior: fixed-height -->
1050110489 <xsl:text>width:</xsl:text>
10502- <xsl:choose>
10503- <xsl:when test="$has-design-width">
10504- <xsl:value-of select="@design-width"/>
10505- </xsl:when>
10506- <xsl:otherwise>
10507- <xsl:apply-templates select="." mode="get-width-pixels"/>
10508- </xsl:otherwise>
10509- </xsl:choose>
10490+ <xsl:apply-templates select="." mode="get-width-pixels"/>
1051010491 <xsl:text>px;</xsl:text>
10511- <xsl:text>max-width: 100%;</xsl:text>
10492+ <!-- < xsl:text>max-width: 100%;</xsl:text> -- >
1051210493 <xsl:text>height:</xsl:text>
10513- <xsl:choose>
10514- <xsl:when test="$has-design-width">
10515- <xsl:apply-templates select="." mode="get-height-pixels">
10516- <xsl:with-param name="local-design-width-pixels" select="@design-width"/>
10517- </xsl:apply-templates>
10518- </xsl:when>
10519- <xsl:otherwise>
10520- <xsl:apply-templates select="." mode="get-height-pixels"/>
10521- </xsl:otherwise>
10522- </xsl:choose>
10494+ <xsl:apply-templates select="." mode="get-height-pixels"/>
1052310495 <xsl:text>px;</xsl:text>
1052410496 </xsl:otherwise>
1052510497 </xsl:choose>
1052610498 </xsl:attribute>
1052710499</xsl:template>
1052810500
10501+ <xsl:template match="slate" mode="interactive-sizing-style-attribute">
10502+ <xsl:apply-templates select="ancestor::interactive" mode="interactive-sizing-style-attribute"/>
10503+ </xsl:template>
10504+
1052910505<xsl:template match="interactive" mode="get-resize-behavior">
1053010506 <xsl:variable name="platform" select="@interactive-platform"/>
1053110507 <xsl:choose>
@@ -10541,6 +10517,18 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1054110517 </xsl:choose>
1054210518</xsl:template>
1054310519
10520+ <xsl:template match="slate" mode="get-resize-behavior">
10521+ <xsl:choose>
10522+ <xsl:when test="@resize-behavior != ''">
10523+ <xsl:value-of select="@resize-behavior"/>
10524+ </xsl:when>
10525+ <xsl:otherwise>
10526+ <xsl:varaible name="container" select="ancestor::interactive"/>
10527+ <xsl:apply-templates select="$container/@interactive-platform" mode="get-resize-behavior"/>
10528+ </xsl:otherwise>
10529+ </xsl:choose>
10530+ </xsl:template>
10531+
1054410532<!-- Next two utilities write attributes, so cannot go in -common -->
1054510533
1054610534<!-- iframes, etc, need size as a pair of attributes in pixels -->
0 commit comments