asciidoctor-pdf-table-break 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: de514b2984c827ec505996e116fda87ad5134ae4e82e74ecf0e99286af856fa1
4
+ data.tar.gz: 9430c1c541b26c9b1e7bf7424d30d93e4f96ef6aba3a7b47b5ab6e82413e593a
5
+ SHA512:
6
+ metadata.gz: 0ffbe8393f1a7faa61ef82ee4bb1879496f82ce8f624bfadba6beb4c0198290a54eb8ff0a8f5cb4ef6759f5e27098a6904f9461a4d964a2db80333f31adc312c
7
+ data.tar.gz: 5ed03de5ba3d9ab53ea1955b4b8e8845d32ea769e7aa9387f4da24b25e89bdce619faf6d4173b030ce61c5e512a81fb312fcc570809345235e0685ede5422ca1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 白一百 baiyibai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.adoc ADDED
@@ -0,0 +1,148 @@
1
+ = asciidoctor-pdf-table-break
2
+ :toc: left
3
+ :toclevels: 2
4
+ :source-highlighter: highlight.js
5
+
6
+ An asciidoctor-pdf extension that forces page breaks inside tables, with repeating headers, seamless borders, and footer only on the last page.
7
+
8
+ A rendered demo is available at link:demo/demo.pdf[].
9
+
10
+ == Installation
11
+
12
+ [source,bash]
13
+ ----
14
+ gem install asciidoctor-pdf-table-break
15
+ ----
16
+
17
+ Or add to a `Gemfile`:
18
+
19
+ [source,ruby]
20
+ ----
21
+ gem 'asciidoctor-pdf-table-break'
22
+ ----
23
+
24
+ == Usage
25
+
26
+ Require the extension on the command line:
27
+
28
+ [source,bash]
29
+ ----
30
+ asciidoctor-pdf -r asciidoctor-pdf-table-break document.adoc
31
+ ----
32
+
33
+ == Syntax
34
+
35
+ Insert a *break row* at the point where you want the page break.
36
+ Two equivalent forms are supported:
37
+
38
+ === Form 1 — colspan span (recommended)
39
+
40
+ Use AsciiDoc's `N+|` span syntax, where `N` is the number of columns:
41
+
42
+ [source,asciidoc]
43
+ ----
44
+ [%header]
45
+ |===
46
+ | Name | Value
47
+
48
+ | Row 1 | alpha
49
+ | Row 2 | beta
50
+
51
+ 2+| <<<
52
+
53
+ | Row 3 | gamma
54
+ |===
55
+ ----
56
+
57
+ === Form 2 — one cell per column
58
+
59
+ Write one `| <<<` per column:
60
+
61
+ [source,asciidoc]
62
+ ----
63
+ [%header]
64
+ |===
65
+ | Name | Value
66
+
67
+ | Row 1 | alpha
68
+ | Row 2 | beta
69
+
70
+ | <<< | <<<
71
+
72
+ | Row 3 | gamma
73
+ |===
74
+ ----
75
+
76
+ === Keeping HTML/Antora output clean
77
+
78
+ Wrap break rows in `ifdef::backend-pdf[]` so they are invisible to the HTML5 and Antora converters:
79
+
80
+ [source,asciidoc]
81
+ ----
82
+ [%header]
83
+ |===
84
+ | Name | Value
85
+
86
+ | Row 1 | alpha
87
+ | Row 2 | beta
88
+
89
+ \ifdef::backend-pdf[]
90
+ 2+| <<<
91
+ \endif::[]
92
+
93
+ | Row 3 | gamma
94
+ |===
95
+ ----
96
+
97
+ == Behavior
98
+
99
+ * Break rows are not rendered — they exist only as page-break markers.
100
+ * Header rows repeat on every continuation page.
101
+ * Footer rows appear only on the last page segment.
102
+ * The table caption/title and anchor appear only on the first page.
103
+ * Borders are seamless: the outer frame border is replaced by the grid line width at break boundaries, so the table looks identical to one that breaks naturally.
104
+
105
+ == Multiple breaks
106
+
107
+ You can insert as many break rows as needed:
108
+
109
+ [source,asciidoc]
110
+ ----
111
+ |===
112
+ | A | B | C
113
+
114
+ | 1 | 2 | 3
115
+
116
+ \ifdef::backend-pdf[]
117
+ 3+| <<<
118
+ \endif::[]
119
+
120
+ | 4 | 5 | 6
121
+
122
+ \ifdef::backend-pdf[]
123
+ 3+| <<<
124
+ \endif::[]
125
+
126
+ | 7 | 8 | 9
127
+ |===
128
+ ----
129
+
130
+ == Background
131
+
132
+ asciidoctor-pdf has no built-in mechanism to force a page break at a specific row within a table.
133
+ The `<<<` page-break paragraph works between blocks but not inside a table.
134
+ This extension monkey-patches `Asciidoctor::PDF::Converter#convert_table` via `Module#prepend`
135
+ to detect break rows and render each segment as a separate table on its own page.
136
+
137
+ A native implementation of this feature has been proposed upstream at
138
+ https://github.com/asciidoctor/asciidoctor-pdf[asciidoctor/asciidoctor-pdf].
139
+ This gem is a stopgap for users who need the feature now.
140
+
141
+ == Compatibility
142
+
143
+ Tested against asciidoctor-pdf 2.3.x and later.
144
+ Uses `Module#prepend` so it is compatible with other extensions that subclass or prepend the converter.
145
+
146
+ == License
147
+
148
+ MIT — see link:LICENSE[].
data/demo/demo.adoc ADDED
@@ -0,0 +1,117 @@
1
+ = asciidoctor-table-break demo
2
+ :doctype: article
3
+ :toc:
4
+ :toclevels: 2
5
+ :sectanchors:
6
+
7
+ This document demonstrates the `asciidoctor-table-break` extension.
8
+ Each break row (`2+| <<<`) forces a new page inside the table while keeping headers repeating and borders seamless.
9
+
10
+ == Basic break with repeating header
11
+
12
+ The table below has a header row and a break after row 2.
13
+ The header repeats on the second page.
14
+
15
+ [%header]
16
+ |===
17
+ | Name | Value
18
+
19
+ | Row 1 | alpha
20
+ | Row 2 | beta
21
+
22
+ ifdef::backend-pdf[]
23
+ 2+| <<<
24
+ endif::[]
25
+
26
+ | Row 3 | gamma
27
+ | Row 4 | delta
28
+ | Row 5 | epsilon
29
+ |===
30
+
31
+ == Break with footer
32
+
33
+ The footer row (`Total`) appears only on the last page segment.
34
+
35
+ [%header%footer]
36
+ |===
37
+ | Item | Quantity | Unit Price
38
+
39
+ | Apple | 10 | $0.50
40
+ | Banana | 6 | $0.30
41
+ | Cherry | 100 | $0.10
42
+ | Date | 20 | $1.20
43
+ | Elderberry | 5 | $3.00
44
+
45
+ ifdef::backend-pdf[]
46
+ 3+| <<<
47
+ endif::[]
48
+
49
+ | Fig | 15 | $0.80
50
+ | Grape | 40 | $0.25
51
+ | Honeydew | 2 | $4.50
52
+ | Jackfruit | 1 | $8.00
53
+ | Kiwi | 12 | $0.60
54
+
55
+ | Total | 211 |
56
+ |===
57
+
58
+ == Multiple breaks (three pages)
59
+
60
+ A three-column reference table split across three pages.
61
+
62
+ [%header]
63
+ |===
64
+ | Country | Capital | Population (M)
65
+
66
+ | Argentina | Buenos Aires | 46.1
67
+ | Australia | Canberra | 26.5
68
+ | Brazil | Brasília | 215.3
69
+ | Canada | Ottawa | 38.2
70
+ | China | Beijing | 1412.0
71
+
72
+ ifdef::backend-pdf[]
73
+ 3+| <<<
74
+ endif::[]
75
+
76
+ | Egypt | Cairo | 105.0
77
+ | France | Paris | 68.0
78
+ | Germany | Berlin | 83.8
79
+ | India | New Delhi | 1428.0
80
+ | Japan | Tokyo | 124.5
81
+
82
+ ifdef::backend-pdf[]
83
+ 3+| <<<
84
+ endif::[]
85
+
86
+ | Mexico | Mexico City | 128.5
87
+ | Nigeria | Abuja | 223.8
88
+ | Russia | Moscow | 144.1
89
+ | Spain | Madrid | 47.4
90
+ | USA | Washington DC | 335.9
91
+ |===
92
+
93
+ == Captioned table
94
+
95
+ The title and anchor appear only on the first page segment.
96
+
97
+ .Software release history
98
+ [%header,#tbl-releases]
99
+ |===
100
+ | Version | Date | Highlights
101
+
102
+ | 3.0 | 2024-01-15 | Complete rewrite, new theme engine
103
+ | 2.3 | 2023-06-01 | Prawn 2.5 support, improved footnotes
104
+ | 2.2 | 2022-11-20 | Running header/footer theming
105
+ | 2.1 | 2022-04-05 | SVG improvements, table captions
106
+ | 2.0 | 2021-09-12 | Scratch converter, theming overhaul
107
+
108
+ ifdef::backend-pdf[]
109
+ 3+| <<<
110
+ endif::[]
111
+
112
+ | 1.6 | 2020-07-18 | Index support
113
+ | 1.5 | 2019-12-10 | Callout list improvements
114
+ | 1.4 | 2019-03-27 | Multi-column layout
115
+ | 1.3 | 2018-08-14 | TOC generation rewrite
116
+ | 1.0 | 2017-01-31 | Initial stable release
117
+ |===