Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sane bookmap defaults to default template #114

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/generator/com/elovirta/pdf/commons.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@
</axsl:call-template>
<axsl:text><xsl:text> </xsl:text></axsl:text>

<axsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="getTitle"/>
<!-- <axsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="getTitle"/>-->
<axsl:apply-templates select="*[contains(@class,' topic/title ')]/node()"/>
</fo:block>

<!-- <axsl:apply-templates select="* except(*[contains(@class, ' topic/title ') or-->
Expand Down Expand Up @@ -416,7 +417,8 @@
</axsl:call-template>
<axsl:text><xsl:text> </xsl:text></axsl:text>

<axsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="getTitle"/>
<!-- <axsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="getTitle"/>-->
<axsl:apply-templates select="*[contains(@class,' topic/title ')]/node()"/>
</fo:block>

<axsl:choose>
Expand Down
8 changes: 2 additions & 6 deletions src/generator/com/elovirta/pdf/merge.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@

<xsl:function name="x:flatten" as="item()*" visibility="public">
<xsl:param name="root" as="item()"/>
<xsl:variable name="flattened" as="map(*)">
<xsl:map>
<xsl:sequence select="x:flatten-walker($root, $root, ())"/>
</xsl:map>
</xsl:variable>
<xsl:sequence select="map:merge(($flattened), map{ 'duplicates': 'use-first' })"/>
<xsl:sequence select="map:merge(x:flatten-walker($root, $root, ()),
map{ 'duplicates': 'use-first' })"/>
</xsl:function>

<xsl:function name="x:flatten-walker" as="item()*">
Expand Down
24 changes: 12 additions & 12 deletions src/generator/com/elovirta/pdf/topic.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
</xsl:attribute>
</axsl:variable>

<!-- <axsl:template match="*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]" mode="getTitle">-->
<!-- <axsl:variable name="topic" select="ancestor-or-self::*[contains(@class, ' topic/topic ')][1]"/>-->
<!-- <axsl:variable name="contents" as="node()*" select="e:get-title-number($topic)"/>-->
<!-- <axsl:if test="exists($contents)">-->
<!-- <axsl:copy-of select="$contents"/>-->
<!--&lt;!&ndash; <fo:leader leader-pattern="space" leader-length="from-nearest-specified-value(font-size)"/>&ndash;&gt;-->
<!-- <axsl:text>-->
<!-- <xsl:text> </xsl:text>-->
<!-- </axsl:text>-->
<!-- </axsl:if>-->
<!-- <axsl:apply-templates/>-->
<!-- </axsl:template>-->
<axsl:template match="*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]" mode="getTitle">
<axsl:variable name="topic" select="ancestor-or-self::*[contains(@class, ' topic/topic ')][1]"/>
<axsl:variable name="contents" as="node()*" select="e:get-title-number($topic)"/>
<axsl:if test="exists($contents)">
<axsl:copy-of select="$contents"/>
<!-- <fo:leader leader-pattern="space" leader-length="from-nearest-specified-value(font-size)"/>-->
<axsl:text>
<xsl:text> </xsl:text>
</axsl:text>
</axsl:if>
<axsl:apply-templates/>
</axsl:template>

<xsl:choose>
<xsl:when test="$root ?style-chapter-numbering = 'document'">
Expand Down
72 changes: 71 additions & 1 deletion src/main/resources/com/elovirta/pdf/default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,77 @@
{
"brand": {
"toc": {
"indent": "20pt"
}
},
"toc": {
"maximum-level": 6
},
"style": {
"body": {
"start-indent": "0pt"
},
"h1": {
"font-weight": "bold"
"title-numbering": true,
"border-style": "none"
},
"h2": {
"title-numbering": true,
"border-style": "none"
},
"h3": {
"title-numbering": true
},
"h4": {
"title-numbering": true
},
"h5": {
"title-numbering": true
},
"h6": {
"title-numbering": true
},
"chapter": {
"numbering": "document",
"title-numbering": true
},
"topic": {
"title-numbering": true
},
"part": {
"title-numbering": true
},
"toc": {
"part": {
"start-indent": "0pt"
},
"chapter": {
"start-indent": "0pt"
},
"1": {
"start-indent": "0pt",
"title-numbering": true
},
"2": {
"start-indent": "$brand-toc-indent",
"title-numbering": true
},
"3": {
"start-indent": "2 * $brand-toc-indent",
"title-numbering": true
},
"4": {
"start-indent": "3 * $brand-toc-indent",
"title-numbering": true
},
"5": {
"start-indent": "4 * $brand-toc-indent",
"title-numbering": true
},
"6": {
"start-indent": "5 * $brand-toc-indent",
"title-numbering": true
}
}
}
}
Loading