Skip to content

Commit f6819d9

Browse files
committed
Edited theme/pdf/pdf.xsl with Atlas code editor
1 parent e4dc2aa commit f6819d9

File tree

1 file changed

+3
-144
lines changed

1 file changed

+3
-144
lines changed

theme/pdf/pdf.xsl

Lines changed: 3 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,12 @@
1212
encoding="UTF-8"/>
1313
<xsl:preserve-space elements="*"/>
1414

15-
<!-- Do add border div for figure images in cookbook series -->
16-
<xsl:param name="figure.border.div" select="1"/>
15+
1716

1817
<!-- Generate separate footnote-call markers, so that we don't
1918
need to rely on AH counters to do footnote numbering -->
2019
<xsl:param name="process.footnote.callouts.only" select="1"/>
2120

22-
<!-- ***************** COOKBOOK PARAMS ***************** -->
23-
<!-- *************** Overrides param.xsl *************** -->
24-
25-
<!-- Recipe format should be "X.1 Title, no second period" -->
26-
<xsl:param name="recipe.number.and.title.separator" select="' '"/>
27-
28-
<!-- This book should show sect2s in TOC -->
29-
<xsl:param name="toc.section.depth" select="2"/>
30-
31-
<!-- ***************** LABEL HANDLING ***************** -->
32-
<!-- ************* Overrides common.xsl *************** -->
33-
34-
<!-- Logic for processing sect1 headings with labels (including section numbers) -->
35-
<xsl:template match="h:section[@data-type='chapter' and not(contains(@class, 'orm:non-recipe'))]/h:section[@data-type='sect1' and not(contains(@class, 'orm:non-recipe'))]/h:h1" mode="process-heading">
36-
<xsl:param name="autogenerate.labels" select="$autogenerate.labels"/>
37-
<!-- Labeled element is typically the parent element of the heading (e.g., <section> or <figure>) -->
38-
<xsl:param name="labeled-element" select="(parent::h:header/parent::*|parent::*[not(self::h:header)])[1]"/>
39-
<!-- Labeled element semantic name is typically the parent element of the heading's @data-type -->
40-
<xsl:param name="labeled-element-semantic-name" select="(parent::h:header/parent::*|parent::*[not(self::h:header)])[1]/@data-type"/>
41-
<!-- Name for output heading element; same as current node name by default -->
42-
<xsl:param name="output-element-name" select="local-name(.)"/>
43-
<xsl:element name="{$output-element-name}" namespace="http://www.w3.org/1999/xhtml">
44-
<xsl:apply-templates select="@*"/>
45-
<!-- BEGIN COOKBOOK OVERRIDE -->
46-
<!-- Recipes should have labels in format #.# -->
47-
<xsl:apply-templates select="$labeled-element" mode="label.markup"/>
48-
<xsl:value-of select="$recipe.number.and.title.separator"/>
49-
<xsl:apply-templates/>
50-
<!-- END COOKBOOK OVERRIDE -->
51-
</xsl:element>
52-
</xsl:template>
5321

5422
<!-- Logic for processing sect2 headings with labels (including section numbers) -->
5523
<xsl:template match="h:section[@data-type='sect2']/h:h2" mode="process-heading">
@@ -62,122 +30,21 @@
6230
<xsl:param name="output-element-name" select="local-name(.)"/>
6331
<xsl:element name="{$output-element-name}" namespace="http://www.w3.org/1999/xhtml">
6432
<xsl:apply-templates select="@*"/>
65-
<!-- BEGIN COOKBOOK OVERRIDE -->
66-
<!-- Recipes should have labels in format #.# -->
67-
<xsl:apply-templates select="$labeled-element" mode="label.markup"/>
68-
<xsl:value-of select="$recipe.number.and.title.separator"/>
69-
<xsl:apply-templates/>
70-
<!-- END COOKBOOK OVERRIDE -->
33+
7134
</xsl:element>
7235
</xsl:template>
7336

7437
<!-- Creating the sect1 labels (read: creating the X.X section numbering) -->
7538
<xsl:template match="h:section[@data-type='sect1']" mode="label.markup">
7639
<xsl:variable name="current-node" select="."/>
77-
<!-- BEGIN COOKBOOK OVERRIDE -->
78-
<!-- Recipes should always be labeled with ancestor chapter -->
79-
<xsl:for-each select="ancestor::h:section[@data-type='chapter']">
80-
<xsl:call-template name="get-label-from-data-type">
81-
<xsl:with-param name="data-type" select="@data-type"/>
82-
</xsl:call-template>
83-
<xsl:apply-templates select="$current-node" mode="intralabel.punctuation"/>
84-
</xsl:for-each>
85-
86-
<!-- Custom Recipe numbering logic:
87-
* Don't number Recipes with class=orm:non-recipe
88-
* Introduction sections at the beginning of chapters have labeling start at #.0
89-
-->
90-
<xsl:variable name="is.numbered">
91-
<xsl:choose>
92-
<xsl:when test="@class='orm:non-recipe'">1</xsl:when>
93-
<xsl:otherwise>0</xsl:otherwise>
94-
</xsl:choose>
95-
</xsl:variable>
96-
97-
<xsl:variable name="chap.has.intro">
98-
<xsl:choose>
99-
<xsl:when test="$is.numbered = 0">
100-
<xsl:call-template name="check.chap.for.intro">
101-
<xsl:with-param name="chapter" select="parent::*"/>
102-
</xsl:call-template>
103-
</xsl:when>
104-
<xsl:otherwise>1</xsl:otherwise>
105-
</xsl:choose>
106-
</xsl:variable>
10740

108-
<xsl:variable name="recipe.level">
109-
<xsl:value-of select="count(preceding-sibling::h:section[@data-type='sect1']) + (1 - $chap.has.intro - $is.numbered)"/>
110-
</xsl:variable>
111-
<xsl:number format="1" value="$recipe.level"/>
112-
113-
<!-- END COOKBOOK OVERRIDE -->
11441
</xsl:template>
11542

11643
<!-- Creating the sect2 labels (read: creating the X.X.X section numbering) -->
11744
<xsl:template match="h:section[@data-type='sect2']" mode="label.markup">
11845
<!-- END OVERRIDE -->
11946
<xsl:variable name="current-node" select="."/>
120-
<!-- BEGIN COOKBOOK OVERRIDE -->
121-
<!-- Recipes should always be labeled with ancestor chapter -->
122-
<xsl:for-each select="ancestor::h:section[@data-type='chapter']">
123-
<xsl:call-template name="get-label-from-data-type">
124-
<xsl:with-param name="data-type" select="@data-type"/>
125-
</xsl:call-template>
126-
<xsl:apply-templates select="$current-node" mode="intralabel.punctuation"/>
127-
</xsl:for-each>
128-
129-
<!-- Custom Recipe numbering logic:
130-
* Don't number Recipes with class=orm:non-recipe
131-
* Introduction sections at the beginning of chapters have labeling start at #.0
132-
-->
133-
<xsl:variable name="is.numbered">
134-
<xsl:choose>
135-
<xsl:when test="parent::h:section/@class='orm:non-recipe'">1</xsl:when>
136-
<xsl:otherwise>0</xsl:otherwise>
137-
</xsl:choose>
138-
</xsl:variable>
139-
140-
<xsl:variable name="chap.has.intro">
141-
<xsl:choose>
142-
<xsl:when test="$is.numbered = 0">
143-
<xsl:call-template name="check.chap.for.intro">
144-
<xsl:with-param name="chapter" select="ancestor::h:section[data-type='chapter']"/>
145-
</xsl:call-template>
146-
</xsl:when>
147-
<xsl:otherwise>1</xsl:otherwise>
148-
</xsl:choose>
149-
</xsl:variable>
15047

151-
<xsl:variable name="sect1.recipe.level">
152-
<xsl:value-of select="count(../preceding-sibling::h:section[@data-type='sect1']) + (1 - $chap.has.intro - $is.numbered)"/>
153-
</xsl:variable>
154-
<xsl:number format="1" value="$sect1.recipe.level"/>
155-
<xsl:text>.</xsl:text>
156-
157-
<xsl:variable name="is.sect1.numbered">
158-
<xsl:choose>
159-
<xsl:when test="@class='orm:non-recipe'">1</xsl:when>
160-
<xsl:otherwise>0</xsl:otherwise>
161-
</xsl:choose>
162-
</xsl:variable>
163-
164-
<xsl:variable name="sect1.has.intro">
165-
<xsl:choose>
166-
<xsl:when test="$is.sect1.numbered = 0">
167-
<xsl:call-template name="check.sect1.for.intro">
168-
<xsl:with-param name="sect1" select="parent::*"/>
169-
</xsl:call-template>
170-
</xsl:when>
171-
<xsl:otherwise>1</xsl:otherwise>
172-
</xsl:choose>
173-
</xsl:variable>
174-
175-
<xsl:variable name="recipe.level">
176-
<xsl:value-of select="count(preceding-sibling::h:section[@data-type='sect2'][not(@class='orm:non-recipe')]) + (1 - $sect1.has.intro - $is.sect1.numbered)"/>
177-
</xsl:variable>
178-
<xsl:number format="1" value="$recipe.level"/>
179-
180-
<!-- END COOKBOOK OVERRIDE -->
18148
</xsl:template>
18249
<!-- Utility template -->
18350
<xsl:template name="check.chap.for.intro">
@@ -280,15 +147,7 @@
280147
<xsl:with-param name="object" select="."/>
281148
</xsl:call-template>
282149
</xsl:attribute>
283-
<!-- BEGIN COOKBOOK OVERRIDE -->
284-
<xsl:if test="(self::h:section[@data-type='sect1'] and ancestor::h:section[@data-type='chapter'] or self::h:section[@data-type='sect2'] and ancestor::h:section[@data-type='sect1']) and not(ancestor-or-self::h:section[contains(@class, 'orm:non-recipe')])">
285-
<xsl:variable name="toc-entry-label">
286-
<xsl:apply-templates select="." mode="label.markup"/>
287-
</xsl:variable>
288-
<xsl:value-of select="normalize-space($toc-entry-label)"/>
289-
<xsl:value-of select="$recipe.number.and.title.separator"/>
290-
</xsl:if>
291-
<!-- END COOKBOOK OVERRIDE -->
150+
292151
<xsl:apply-templates select="." mode="title.markup"/>
293152
</a>
294153
<!-- Make sure there are descendants that conform to $toc.section.depth restrictions before generating nested TOC <ol> -->

0 commit comments

Comments
 (0)