Skip to content

Commit 5f77d6f

Browse files
author
Sarah Schneider
committed
committing oneoffs for all formats to handle top-level callouts directory
1 parent 0bac874 commit 5f77d6f

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

theme/epub/epub.xsl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<xsl:stylesheet version="1.0"
2+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:h="http://www.w3.org/1999/xhtml"
4+
xmlns="http://www.w3.org/1999/xhtml"
5+
exclude-result-prefixes="h">
6+
7+
<!-- Do add border div for figure images in animal series -->
8+
<xsl:param name="figure.border.div" select="1"/>
9+
10+
<xsl:template name="string-replace-all">
11+
<xsl:param name="text"/>
12+
<xsl:param name="replace"/>
13+
<xsl:param name="by"/>
14+
<xsl:choose>
15+
<xsl:when test="contains($text, $replace)">
16+
<xsl:value-of select="substring-before($text,$replace)"/>
17+
<xsl:value-of select="$by"/>
18+
<xsl:call-template name="string-replace-all">
19+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
20+
<xsl:with-param name="replace" select="$replace"/>
21+
<xsl:with-param name="by" select="$by"/>
22+
</xsl:call-template>
23+
</xsl:when>
24+
<xsl:otherwise>
25+
<xsl:value-of select="$text"/>
26+
</xsl:otherwise>
27+
</xsl:choose>
28+
</xsl:template>
29+
30+
<xsl:template match="h:img/@src">
31+
<xsl:choose>
32+
<xsl:when test="contains(., 'callouts/')">
33+
<xsl:variable name="new-path">
34+
<xsl:call-template name="string-replace-all">
35+
<xsl:with-param name="text" select="."/>
36+
<xsl:with-param name="replace" select="'callouts'"/>
37+
<xsl:with-param name="by" select="'../../callouts'"/>
38+
</xsl:call-template>
39+
</xsl:variable>
40+
<xsl:attribute name="src">
41+
<xsl:value-of select="$new-path"/>
42+
</xsl:attribute>
43+
</xsl:when>
44+
<xsl:otherwise>
45+
<xsl:copy>
46+
<xsl:apply-templates select="@*|node()"/>
47+
</xsl:copy>
48+
</xsl:otherwise>
49+
</xsl:choose>
50+
</xsl:template>
51+
52+
</xsl:stylesheet>

theme/html/html.xsl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<xsl:stylesheet version="1.0"
2+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:h="http://www.w3.org/1999/xhtml"
4+
xmlns="http://www.w3.org/1999/xhtml"
5+
exclude-result-prefixes="h">
6+
7+
<!-- Do add border div for figure images in animal series -->
8+
<xsl:param name="figure.border.div" select="1"/>
9+
10+
<xsl:template name="string-replace-all">
11+
<xsl:param name="text"/>
12+
<xsl:param name="replace"/>
13+
<xsl:param name="by"/>
14+
<xsl:choose>
15+
<xsl:when test="contains($text, $replace)">
16+
<xsl:value-of select="substring-before($text,$replace)"/>
17+
<xsl:value-of select="$by"/>
18+
<xsl:call-template name="string-replace-all">
19+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
20+
<xsl:with-param name="replace" select="$replace"/>
21+
<xsl:with-param name="by" select="$by"/>
22+
</xsl:call-template>
23+
</xsl:when>
24+
<xsl:otherwise>
25+
<xsl:value-of select="$text"/>
26+
</xsl:otherwise>
27+
</xsl:choose>
28+
</xsl:template>
29+
30+
<xsl:template match="h:img/@src">
31+
<xsl:choose>
32+
<xsl:when test="contains(., 'callouts/')">
33+
<xsl:variable name="new-path">
34+
<xsl:call-template name="string-replace-all">
35+
<xsl:with-param name="text" select="."/>
36+
<xsl:with-param name="replace" select="'callouts'"/>
37+
<xsl:with-param name="by" select="'../../callouts'"/>
38+
</xsl:call-template>
39+
</xsl:variable>
40+
<xsl:attribute name="src">
41+
<xsl:value-of select="$new-path"/>
42+
</xsl:attribute>
43+
</xsl:when>
44+
<xsl:otherwise>
45+
<xsl:copy>
46+
<xsl:apply-templates select="@*|node()"/>
47+
</xsl:copy>
48+
</xsl:otherwise>
49+
</xsl:choose>
50+
</xsl:template>
51+
52+
</xsl:stylesheet>

theme/mobi/mobi.xsl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<xsl:stylesheet version="1.0"
2+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:h="http://www.w3.org/1999/xhtml"
4+
xmlns="http://www.w3.org/1999/xhtml"
5+
exclude-result-prefixes="h">
6+
7+
<!-- Do add border div for figure images in animal series -->
8+
<xsl:param name="figure.border.div" select="1"/>
9+
10+
<xsl:template name="string-replace-all">
11+
<xsl:param name="text"/>
12+
<xsl:param name="replace"/>
13+
<xsl:param name="by"/>
14+
<xsl:choose>
15+
<xsl:when test="contains($text, $replace)">
16+
<xsl:value-of select="substring-before($text,$replace)"/>
17+
<xsl:value-of select="$by"/>
18+
<xsl:call-template name="string-replace-all">
19+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
20+
<xsl:with-param name="replace" select="$replace"/>
21+
<xsl:with-param name="by" select="$by"/>
22+
</xsl:call-template>
23+
</xsl:when>
24+
<xsl:otherwise>
25+
<xsl:value-of select="$text"/>
26+
</xsl:otherwise>
27+
</xsl:choose>
28+
</xsl:template>
29+
30+
<xsl:template match="h:img/@src">
31+
<xsl:choose>
32+
<xsl:when test="contains(., 'callouts/')">
33+
<xsl:variable name="new-path">
34+
<xsl:call-template name="string-replace-all">
35+
<xsl:with-param name="text" select="."/>
36+
<xsl:with-param name="replace" select="'callouts'"/>
37+
<xsl:with-param name="by" select="'../../callouts'"/>
38+
</xsl:call-template>
39+
</xsl:variable>
40+
<xsl:attribute name="src">
41+
<xsl:value-of select="$new-path"/>
42+
</xsl:attribute>
43+
</xsl:when>
44+
<xsl:otherwise>
45+
<xsl:copy>
46+
<xsl:apply-templates select="@*|node()"/>
47+
</xsl:copy>
48+
</xsl:otherwise>
49+
</xsl:choose>
50+
</xsl:template>
51+
52+
</xsl:stylesheet>

0 commit comments

Comments
 (0)