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

Move toc under style #122

Merged
merged 1 commit into from
Jan 18, 2025
Merged
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: 3 additions & 3 deletions src/app/components/Other.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export default function Other() {
<h3>Table of Contents</h3>
<fieldset>
<p>
<label htmlFor="toc_maximum_level">Show level</label>
<label htmlFor="style_toc_maximum_level">Show level</label>
<Field
component="select"
name="toc_maximum_level"
id="toc_maximum_level"
name="style_toc_maximum_level"
id="style_toc_maximum_level"
>
<option value="2">1</option>
<option value="3">2</option>
Expand Down
4 changes: 2 additions & 2 deletions src/generator/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export type Model = {
cover_image_metadata: string;
cover_image_topic: string;
bookmark_style: 'COLLAPSED' | 'EXPANDED';
toc_maximum_level: number;
style_toc_maximum_level: number;
task_label: boolean;
include_related_links: 'none' | 'all' | 'nofamily';
table_continued: boolean;
Expand Down Expand Up @@ -170,7 +170,7 @@ export function getInitStore(): PluginModel {
cover_image_metadata: 'cover-image',
cover_image_topic: '',
bookmark_style: 'COLLAPSED',
toc_maximum_level: 4,
style_toc_maximum_level: 4,
task_label: false,
include_related_links: 'none',
table_continued: false,
Expand Down
4 changes: 2 additions & 2 deletions src/generator/basic-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export function generate_custom_attr(root: Element, conf: Generator) {
select: `'${conf.formatter}'`,
});
SubElement(root, 'xsl:param', {
name: 'tocMaximumLevel',
select: conf.toc_maximum_level.toString(),
name: 'styleTocMaximumLevel',
select: conf.style_toc_maximum_level.toString(),
});
// page size
SubElement(root, xsl('variable'), { name: 'page-width' }).text =
Expand Down
4 changes: 2 additions & 2 deletions src/generator/com/elovirta/pdf/basic-settings.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<axsl:stylesheet version="2.0">
<xsl:call-template name="generate-namespace-node"/>
<axsl:param name="pdfFormatter" select="'{. ?formatter}'"/>
<xsl:if test="map:contains($root, 'toc-maximum-level')">
<axsl:param name="tocMaximumLevel" select="{$root ?toc-maximum-level}"/>
<xsl:if test="map:contains($root, 'style-toc-maximum-level')">
<axsl:param name="tocMaximumLevel" select="{$root ?style-toc-maximum-level}"/>
</xsl:if>
<!-- page size -->
<xsl:if test="map:contains($root, 'page-width')">
Expand Down
4 changes: 2 additions & 2 deletions src/generator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class Generator {
body_column_count;
index_column_count;
bookmark_style;
toc_maximum_level;
style_toc_maximum_level;
task_label;
include_related_links;
column_gap;
Expand Down Expand Up @@ -119,7 +119,7 @@ export default class Generator {
this.force_page_count = conf.force_page_count;
this.chapter_layout = conf.chapter_layout;
this.bookmark_style = conf.bookmark_style;
this.toc_maximum_level = conf.toc_maximum_level;
this.style_toc_maximum_level = conf.style_toc_maximum_level;
this.task_label = conf.task_label;
this.include_related_links = conf.include_related_links;
if (conf.body_column_count) {
Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/com/elovirta/pdf/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
"text-align": "start"
}
},
"toc": {
"maximum-level": 6
},
"style": {
"body": {
"start-indent": "0pt",
Expand Down Expand Up @@ -141,6 +138,7 @@
"title-numbering": true
},
"toc": {
"maximum-level": 6,
"part": {
"start-indent": "0pt",
"space-before": "0.6em",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"default": "COLLAPSED",
"description": "Expand state of PDF bookmarks."
},
"toc-maximum-level": {
"style-toc-maximum-level": {
"type": "integer",
"description": "Maximum TOC depth.",
"default": 4
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/exp/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"bookmark-style": "COLLAPSED",
"table-continued": false,
"column-gap": "12pt",
"toc-maximum-level": 4,
"style-toc-maximum-level": 4,
"include-related-links": "none",
"force-page-count": "even",
"index-column-count": 2,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/src/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@
"cover_image_metadata": "cover-image",
"cover_image_topic": "",
"bookmark_style": "COLLAPSED",
"toc_maximum_level": 4,
"style_toc_maximum_level": 4,
"task_label": false,
"include_related_links": "none",
"table_continued": false,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/src/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ chapter_layout: BASIC
cover_image_metadata: cover-image
cover_image_topic: ''
bookmark_style: COLLAPSED
toc_maximum_level: 4
style_toc_maximum_level: 4
task_label: false
include_related_links: none
table_continued: false
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/src/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"cover_image_metadata": "cover-image",
"cover_image_topic": "",
"bookmark_style": "COLLAPSED",
"toc_maximum_level": 4,
"style_toc_maximum_level": 4,
"task_label": false,
"include_related_links": "none",
"table_continued": false,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/src/theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ chapter_layout: BASIC
cover_image_metadata: cover-image
cover_image_topic: ''
bookmark_style: COLLAPSED
toc_maximum_level: 4
style_toc_maximum_level: 4
task_label: false
include_related_links: none
table_continued: false
Expand Down
Loading