@fiduswriter/books 0.0.0-stage → 0.2.1

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.
Files changed (188) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +87 -2
  3. package/css/book.css +219 -0
  4. package/dist/exporter/bits/index.d.ts +42 -0
  5. package/dist/exporter/bits/index.d.ts.map +1 -0
  6. package/dist/exporter/bits/index.js +113 -0
  7. package/dist/exporter/bits/index.js.map +1 -0
  8. package/dist/exporter/bits/templates.d.ts +7 -0
  9. package/dist/exporter/bits/templates.d.ts.map +1 -0
  10. package/dist/exporter/bits/templates.js +78 -0
  11. package/dist/exporter/bits/templates.js.map +1 -0
  12. package/dist/exporter/docx/index.d.ts +33 -0
  13. package/dist/exporter/docx/index.d.ts.map +1 -0
  14. package/dist/exporter/docx/index.js +139 -0
  15. package/dist/exporter/docx/index.js.map +1 -0
  16. package/dist/exporter/docx/render.d.ts +19 -0
  17. package/dist/exporter/docx/render.d.ts.map +1 -0
  18. package/dist/exporter/docx/render.js +123 -0
  19. package/dist/exporter/docx/render.js.map +1 -0
  20. package/dist/exporter/epub/index.d.ts +70 -0
  21. package/dist/exporter/epub/index.d.ts.map +1 -0
  22. package/dist/exporter/epub/index.js +310 -0
  23. package/dist/exporter/epub/index.js.map +1 -0
  24. package/dist/exporter/epub/templates.d.ts +65 -0
  25. package/dist/exporter/epub/templates.d.ts.map +1 -0
  26. package/dist/exporter/epub/templates.js +224 -0
  27. package/dist/exporter/epub/templates.js.map +1 -0
  28. package/dist/exporter/epub/tools.d.ts +5 -0
  29. package/dist/exporter/epub/tools.d.ts.map +1 -0
  30. package/dist/exporter/epub/tools.js +59 -0
  31. package/dist/exporter/epub/tools.js.map +1 -0
  32. package/dist/exporter/html/index.d.ts +70 -0
  33. package/dist/exporter/html/index.d.ts.map +1 -0
  34. package/dist/exporter/html/index.js +320 -0
  35. package/dist/exporter/html/index.js.map +1 -0
  36. package/dist/exporter/html/templates.d.ts +40 -0
  37. package/dist/exporter/html/templates.d.ts.map +1 -0
  38. package/dist/exporter/html/templates.js +225 -0
  39. package/dist/exporter/html/templates.js.map +1 -0
  40. package/dist/exporter/html/tools.d.ts +2 -0
  41. package/dist/exporter/html/tools.d.ts.map +1 -0
  42. package/dist/exporter/html/tools.js +23 -0
  43. package/dist/exporter/html/tools.js.map +1 -0
  44. package/dist/exporter/latex/index.d.ts +36 -0
  45. package/dist/exporter/latex/index.d.ts.map +1 -0
  46. package/dist/exporter/latex/index.js +116 -0
  47. package/dist/exporter/latex/index.js.map +1 -0
  48. package/dist/exporter/latex/templates.d.ts +4 -0
  49. package/dist/exporter/latex/templates.d.ts.map +1 -0
  50. package/dist/exporter/latex/templates.js +26 -0
  51. package/dist/exporter/latex/templates.js.map +1 -0
  52. package/dist/exporter/native/index.d.ts +22 -0
  53. package/dist/exporter/native/index.d.ts.map +1 -0
  54. package/dist/exporter/native/index.js +141 -0
  55. package/dist/exporter/native/index.js.map +1 -0
  56. package/dist/exporter/odt/index.d.ts +33 -0
  57. package/dist/exporter/odt/index.d.ts.map +1 -0
  58. package/dist/exporter/odt/index.js +133 -0
  59. package/dist/exporter/odt/index.js.map +1 -0
  60. package/dist/exporter/odt/render.d.ts +21 -0
  61. package/dist/exporter/odt/render.d.ts.map +1 -0
  62. package/dist/exporter/odt/render.js +126 -0
  63. package/dist/exporter/odt/render.js.map +1 -0
  64. package/dist/exporter/pretty.d.ts +17 -0
  65. package/dist/exporter/pretty.d.ts.map +1 -0
  66. package/dist/exporter/pretty.js +55 -0
  67. package/dist/exporter/pretty.js.map +1 -0
  68. package/dist/exporter/print/index.d.ts +25 -0
  69. package/dist/exporter/print/index.d.ts.map +1 -0
  70. package/dist/exporter/print/index.js +46 -0
  71. package/dist/exporter/print/index.js.map +1 -0
  72. package/dist/exporter/print/templates.d.ts +2 -0
  73. package/dist/exporter/print/templates.d.ts.map +1 -0
  74. package/dist/exporter/print/templates.js +5 -0
  75. package/dist/exporter/print/templates.js.map +1 -0
  76. package/dist/exporter/tools.d.ts +31 -0
  77. package/dist/exporter/tools.d.ts.map +1 -0
  78. package/dist/exporter/tools.js +177 -0
  79. package/dist/exporter/tools.js.map +1 -0
  80. package/dist/i18n.d.ts +7 -0
  81. package/dist/i18n.d.ts.map +1 -0
  82. package/dist/i18n.js +918 -0
  83. package/dist/i18n.js.map +1 -0
  84. package/dist/ids.d.ts +19 -0
  85. package/dist/ids.d.ts.map +1 -0
  86. package/dist/ids.js +27 -0
  87. package/dist/ids.js.map +1 -0
  88. package/dist/importer/native/index.d.ts +45 -0
  89. package/dist/importer/native/index.d.ts.map +1 -0
  90. package/dist/importer/native/index.js +166 -0
  91. package/dist/importer/native/index.js.map +1 -0
  92. package/dist/importer/native/reader.d.ts +32 -0
  93. package/dist/importer/native/reader.d.ts.map +1 -0
  94. package/dist/importer/native/reader.js +170 -0
  95. package/dist/importer/native/reader.js.map +1 -0
  96. package/dist/index.d.ts +4 -0
  97. package/dist/index.d.ts.map +1 -0
  98. package/dist/index.js +3 -0
  99. package/dist/index.js.map +1 -0
  100. package/dist/schema/index.d.ts +7 -0
  101. package/dist/schema/index.d.ts.map +1 -0
  102. package/dist/schema/index.js +8 -0
  103. package/dist/schema/index.js.map +1 -0
  104. package/dist/types.d.ts +171 -0
  105. package/dist/types.d.ts.map +1 -0
  106. package/dist/types.js +5 -0
  107. package/dist/types.js.map +1 -0
  108. package/dist/ui/book_dialog/dialog.d.ts +161 -0
  109. package/dist/ui/book_dialog/dialog.d.ts.map +1 -0
  110. package/dist/ui/book_dialog/dialog.js +750 -0
  111. package/dist/ui/book_dialog/dialog.js.map +1 -0
  112. package/dist/ui/book_dialog/export.d.ts +95 -0
  113. package/dist/ui/book_dialog/export.d.ts.map +1 -0
  114. package/dist/ui/book_dialog/export.js +217 -0
  115. package/dist/ui/book_dialog/export.js.map +1 -0
  116. package/dist/ui/book_dialog/index.d.ts +38 -0
  117. package/dist/ui/book_dialog/index.d.ts.map +1 -0
  118. package/dist/ui/book_dialog/index.js +36 -0
  119. package/dist/ui/book_dialog/index.js.map +1 -0
  120. package/dist/ui/book_dialog/sanity_check.d.ts +22 -0
  121. package/dist/ui/book_dialog/sanity_check.d.ts.map +1 -0
  122. package/dist/ui/book_dialog/sanity_check.js +109 -0
  123. package/dist/ui/book_dialog/sanity_check.js.map +1 -0
  124. package/dist/ui/book_dialog/templates.d.ts +76 -0
  125. package/dist/ui/book_dialog/templates.d.ts.map +1 -0
  126. package/dist/ui/book_dialog/templates.js +542 -0
  127. package/dist/ui/book_dialog/templates.js.map +1 -0
  128. package/dist/ui/book_dialog/types.d.ts +258 -0
  129. package/dist/ui/book_dialog/types.d.ts.map +1 -0
  130. package/dist/ui/book_dialog/types.js +15 -0
  131. package/dist/ui/book_dialog/types.js.map +1 -0
  132. package/locale/ar/messages.json +49 -0
  133. package/locale/bg/messages.json +49 -0
  134. package/locale/cs/messages.json +49 -0
  135. package/locale/da/messages.json +49 -0
  136. package/locale/de/messages.json +49 -0
  137. package/locale/en/messages.json +49 -0
  138. package/locale/en_US/messages.json +49 -0
  139. package/locale/es/messages.json +49 -0
  140. package/locale/fr/messages.json +49 -0
  141. package/locale/it/messages.json +49 -0
  142. package/locale/ja/messages.json +49 -0
  143. package/locale/ko/messages.json +49 -0
  144. package/locale/nb/messages.json +49 -0
  145. package/locale/nl/messages.json +49 -0
  146. package/locale/pl/messages.json +49 -0
  147. package/locale/pt_BR/messages.json +49 -0
  148. package/locale/pt_PT/messages.json +49 -0
  149. package/locale/ru/messages.json +49 -0
  150. package/locale/sv/messages.json +49 -0
  151. package/locale/tr/messages.json +49 -0
  152. package/locale/zh_Hans/messages.json +49 -0
  153. package/logo.svg +10 -0
  154. package/package.json +150 -5
  155. package/src/exporter/bits/index.ts +184 -0
  156. package/src/exporter/bits/templates.ts +107 -0
  157. package/src/exporter/docx/index.ts +258 -0
  158. package/src/exporter/docx/render.ts +177 -0
  159. package/src/exporter/epub/index.ts +496 -0
  160. package/src/exporter/epub/templates.ts +403 -0
  161. package/src/exporter/epub/tools.ts +68 -0
  162. package/src/exporter/html/index.ts +479 -0
  163. package/src/exporter/html/templates.ts +362 -0
  164. package/src/exporter/html/tools.ts +26 -0
  165. package/src/exporter/latex/index.ts +190 -0
  166. package/src/exporter/latex/templates.ts +35 -0
  167. package/src/exporter/native/index.ts +238 -0
  168. package/src/exporter/odt/index.ts +230 -0
  169. package/src/exporter/odt/render.ts +181 -0
  170. package/src/exporter/pretty.ts +75 -0
  171. package/src/exporter/print/index.ts +76 -0
  172. package/src/exporter/print/templates.ts +8 -0
  173. package/src/exporter/tools.ts +270 -0
  174. package/src/global.d.ts +2 -0
  175. package/src/i18n.ts +936 -0
  176. package/src/ids.ts +27 -0
  177. package/src/importer/native/index.ts +269 -0
  178. package/src/importer/native/reader.ts +247 -0
  179. package/src/index.ts +20 -0
  180. package/src/modules.d.ts +7 -0
  181. package/src/schema/index.ts +8 -0
  182. package/src/types.ts +208 -0
  183. package/src/ui/book_dialog/dialog.ts +940 -0
  184. package/src/ui/book_dialog/export.ts +449 -0
  185. package/src/ui/book_dialog/index.ts +84 -0
  186. package/src/ui/book_dialog/sanity_check.ts +208 -0
  187. package/src/ui/book_dialog/templates.ts +736 -0
  188. package/src/ui/book_dialog/types.ts +283 -0
package/README.md CHANGED
@@ -1,3 +1,88 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="https://git.fiduswriter.org/fiduswriter/fiduswriter-books-ts/raw/branch/main/logo.svg" alt="@fiduswriter/books" width="100" height="100">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <h1 align="center">@fiduswriter/books</h1>
6
+
7
+ <p align="center">Book-level importers and exporters for Fidus Writer</p>
8
+
9
+ ---
10
+
11
+ > **Note:** This package was renamed in 0.2.0. It was previously published in
12
+ > the same `@fiduswriter` scope under the longer name
13
+ > `@fiduswriter/…-document` (up to 0.1.34); that older package is now deprecated
14
+ > on npm, so install `@fiduswriter/books` instead.
15
+
16
+ ## What it does
17
+
18
+ Implements book-level (composite/multi-document) importers and exporters for
19
+ Fidus Writer. Builds on top of `@fiduswriter/document` — reuses its
20
+ single-document export filters and composes them into book-level outputs.
21
+
22
+ ### Supported export formats
23
+
24
+ | Format | Extension | Description |
25
+ |--------|-----------|-------------|
26
+ | Native Fidus Book | `.fidusbook` | Full book archive with all chapters and assets |
27
+ | DOCX | `.docx` | Microsoft Word document |
28
+ | ODT | `.odt` | OpenDocument Text |
29
+ | LaTeX | `.tex` | LaTeX document |
30
+ | HTML | `.html` | Web page |
31
+ | EPUB | `.epub` | E-book |
32
+ | BITS | `.xml` | Book Interchange Tag Suite (JATS for books) |
33
+ | Print | `.pdf` | PDF via Vivliostyle |
34
+
35
+ ## Exports
36
+
37
+ Main entry exports:
38
+
39
+ | Export | Description |
40
+ |--------|-------------|
41
+ | `FIDUSBOOK_VERSION` | Current Fidus Book format version number |
42
+
43
+ ### Subpath exports
44
+
45
+ | Path | Description |
46
+ |------|-------------|
47
+ | `./schema` | Book document schema |
48
+ | `./importer/native` | Native `.fidusbook` format importer |
49
+ | `./exporter/native` | Native `.fidusbook` format exporter |
50
+ | `./exporter/docx` | Book to DOCX exporter |
51
+ | `./exporter/odt` | Book to ODT exporter |
52
+ | `./exporter/latex` | Book to LaTeX exporter |
53
+ | `./exporter/html` | Book to HTML exporter |
54
+ | `./exporter/epub` | Book to EPUB exporter |
55
+ | `./exporter/print` | Book to PDF exporter |
56
+ | `./exporter/bits` | Book to BITS exporter |
57
+ | `./exporter/tools` | Shared exporter utilities |
58
+ | `./i18n` | Internationalization strings |
59
+ | `./types` | TypeScript type definitions |
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ npm install @fiduswriter/books
65
+ ```
66
+
67
+ ## Usage
68
+
69
+ ```ts
70
+ import {FIDUSBOOK_VERSION} from "@fiduswriter/books"
71
+ import {NativeBookExporter} from "@fiduswriter/books/exporter/native"
72
+ import {DocxBookExporter} from "@fiduswriter/books/exporter/docx"
73
+ ```
74
+
75
+ ## Development
76
+
77
+ ```bash
78
+ npm install # Install dependencies
79
+ npm run build # Compile TypeScript to dist/
80
+ npm run typecheck # Check types without emitting
81
+ npm test # Run test suite (Jest)
82
+ npm run lint # Lint with ESLint
83
+ npm run format:check # Check formatting with Prettier
84
+ ```
85
+
86
+ ## License
87
+
88
+ AGPL-3.0 — see [LICENSE](LICENSE) for details.
package/css/book.css ADDED
@@ -0,0 +1,219 @@
1
+ /* Footnote and figure/table labeling */
2
+
3
+ span.label-counter::after,
4
+ a.reference-counter::after {
5
+ content: " " attr(data-book-counter); /* or data-chapter-counter */
6
+ }
7
+
8
+ .footnote-counter::before {
9
+ content: attr(data-book-counter); /* or data-chapter-counter */
10
+ }
11
+
12
+ section[role="doc-footnote"] .footnote-counter::after {
13
+ content: ". ";
14
+ }
15
+
16
+ /* CSL */
17
+
18
+ .csl-bib-body {
19
+ padding-top: 0.5em;
20
+ padding-bottom: 0.5em;
21
+ }
22
+
23
+ .csl-left-margin {
24
+ padding-right: 1ch;
25
+ clear: left;
26
+ float: left;
27
+ white-space: pre;
28
+ }
29
+
30
+ .csl-entry i {
31
+ font-style: italic;
32
+ }
33
+
34
+ .csl-entry b {
35
+ font-weight: bold;
36
+ }
37
+
38
+ .csl-entry sup {
39
+ vertical-align: super;
40
+ font-size: smaller;
41
+ }
42
+
43
+ .csl-entry sub {
44
+ vertical-align: sub;
45
+ font-size: smaller;
46
+ }
47
+
48
+ .csl-indent {
49
+ padding-left: 0.5in;
50
+ }
51
+
52
+ .csl-entry {
53
+ clear: left;
54
+ }
55
+
56
+ .csl-right-inline {
57
+ padding-left: 20px;
58
+ }
59
+
60
+ span.anchor {
61
+ text-decoration: underline;
62
+ color: var(--cs-4-text);
63
+ }
64
+
65
+ figure figcaption {
66
+ margin-top: 10px;
67
+ font-size: 0.9em;
68
+ }
69
+
70
+ figure img {
71
+ max-width: 100%;
72
+ }
73
+
74
+ figure {
75
+ width: calc(80% - 12px);
76
+ border: 1px solid black;
77
+ padding: 5px;
78
+ text-align: center;
79
+ break-inside: avoid;
80
+ cursor: pointer;
81
+ margin: 10%;
82
+ clear: none;
83
+ }
84
+
85
+ .aligned-right {
86
+ float: right;
87
+ }
88
+
89
+ .aligned-left {
90
+ float: left;
91
+ }
92
+
93
+ .aligned-center {
94
+ float: none;
95
+ display: block;
96
+ margin-left: auto;
97
+ margin-right: auto;
98
+ align-content: center;
99
+ }
100
+
101
+ .image-width-100 {
102
+ width: 80%;
103
+ box-sizing: border-box;
104
+ }
105
+
106
+ .image-width-75 {
107
+ width: 55%;
108
+ box-sizing: border-box;
109
+ }
110
+
111
+ .image-width-50 {
112
+ width: 40%;
113
+ margin-left: 5%;
114
+ margin-right: 5%;
115
+ box-sizing: border-box;
116
+ }
117
+
118
+ .image-width-25 {
119
+ width: 21%;
120
+ margin-left: 2%;
121
+ margin-right: 2%;
122
+ box-sizing: border-box;
123
+ }
124
+
125
+ figure[data-category="table"] figcaption span.text::before,
126
+ figure[data-category="photo"] figcaption span.text::before,
127
+ figure[data-category="figure"] figcaption span.text::before,
128
+ table[data-category="table"] caption span.text::before {
129
+ content: ": ";
130
+ }
131
+
132
+ table {
133
+ clear: both;
134
+ }
135
+
136
+ .table-25 {
137
+ width: 25%;
138
+ }
139
+
140
+ .table-50 {
141
+ width: 50%;
142
+ }
143
+
144
+ .table-75 {
145
+ width: 75%;
146
+ }
147
+
148
+ .table-100 {
149
+ width: 100%;
150
+ }
151
+
152
+ .table-center {
153
+ margin-left: auto !important;
154
+ margin-right: auto !important;
155
+ clear: both;
156
+ }
157
+
158
+ .table-left {
159
+ float: left;
160
+ }
161
+
162
+ .table-right {
163
+ float: right;
164
+ }
165
+
166
+ .user-contents a {
167
+ text-decoration: underline;
168
+ }
169
+
170
+ .user-contents table[data-layout="fixed"] {
171
+ table-layout: fixed !important;
172
+ }
173
+
174
+ .user-contents table[data-layout="auto"] {
175
+ table-layout: auto !important;
176
+ }
177
+
178
+ .doc-title {
179
+ font-size: 48px;
180
+ }
181
+
182
+ .user-contents .table-of-contents h1,
183
+ .user-contents .table-of-contents h2,
184
+ .user-contents .table-of-contents h3,
185
+ .user-contents .table-of-contents h4,
186
+ .user-contents .table-of-contents h5,
187
+ .user-contents .table-of-contents h6 {
188
+ font-size: 1em;
189
+ font-weight: normal;
190
+ margin-bottom: unset;
191
+ }
192
+
193
+ .user-contents .table-of-contents h2 {
194
+ padding-left: 1em;
195
+ }
196
+
197
+ .user-contents .table-of-contents h3 {
198
+ padding-left: 2em;
199
+ }
200
+
201
+ .user-contents .table-of-contents h4 {
202
+ padding-left: 3em;
203
+ }
204
+
205
+ .user-contents .table-of-contents h5 {
206
+ padding-left: 4em;
207
+ }
208
+
209
+ .user-contents .table-of-contents h6 {
210
+ padding-left: 5em;
211
+ }
212
+
213
+ .user-contents .table-of-contents h1.toc {
214
+ font-style: italic;
215
+ }
216
+
217
+ .underline {
218
+ text-decoration: underline;
219
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * BITS (Book Interchange Tag Suite) book exporter.
3
+ */
4
+ import type { Schema } from "prosemirror-model";
5
+ import type { ProgressCallback } from "@fiduswriter/document/exporter/tools/progress";
6
+ import type { ImageDBEntry } from "@fiduswriter/document";
7
+ import type { Book, CSL, DocumentListEntry, User } from "../../types.js";
8
+ interface TextFile {
9
+ filename: string;
10
+ contents: string;
11
+ }
12
+ interface HttpFile {
13
+ filename: string;
14
+ url: string;
15
+ title?: string;
16
+ }
17
+ export declare class BITSBookExporter {
18
+ schema: Schema;
19
+ csl: CSL;
20
+ book: Book;
21
+ user: User;
22
+ docList: DocumentListEntry[];
23
+ updated: number;
24
+ type: string;
25
+ textFiles: TextFile[];
26
+ httpFiles: HttpFile[];
27
+ zipFileName: string;
28
+ progressCallback?: ProgressCallback;
29
+ constructor(schema: Schema, csl: CSL, book: Book, user: User, docList: DocumentListEntry[], updated: number);
30
+ init(progressCallback?: ProgressCallback): Promise<Blob> | false;
31
+ export(): Promise<Blob>;
32
+ createFiles(chapters: Array<{
33
+ front: string;
34
+ body: string;
35
+ back: string;
36
+ }>, imageDict: Record<string, ImageDBEntry>): Promise<Blob>;
37
+ createZip(): Promise<Blob>;
38
+ download(blob: Blob): Blob;
39
+ get defaultFilename(): string;
40
+ }
41
+ export {};
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exporter/bits/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AAI7C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,+CAA+C,CAAA;AAKnF,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAIvD,OAAO,KAAK,EAAC,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAC,MAAM,gBAAgB,CAAA;AAItE,UAAU,QAAQ;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,QAAQ;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,qBAAa,gBAAgB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IAEnC,YACI,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,EAAE,EAC5B,OAAO,EAAE,MAAM,EAYlB;IAED,IAAI,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAc/D;IAED,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CA6BtB;IAED,WAAW,CACP,QAAQ,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,EAC5D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC,CA4Cf;IAED,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAazB;IAED,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAEzB;IAED,IAAI,eAAe,IAAI,MAAM,CAE5B;CACJ"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * BITS (Book Interchange Tag Suite) book exporter.
3
+ */
4
+ import pretty from "../pretty.js";
5
+ import { JATSExporterConverter } from "@fiduswriter/document/exporter/jats/convert";
6
+ import { darManifest } from "@fiduswriter/document/exporter/jats/templates";
7
+ import { createSlug, getImageDBEntryFilename } from "@fiduswriter/document/exporter/tools/file";
8
+ import { ZipFileCreator } from "fwtoolkit/file/zip";
9
+ import { gettext } from "fwtoolkit";
10
+ import { getMissingChapterData } from "../tools.js";
11
+ import { bitsTemplate } from "./templates.js";
12
+ export class BITSBookExporter {
13
+ schema;
14
+ csl;
15
+ book;
16
+ user;
17
+ docList;
18
+ updated;
19
+ type;
20
+ textFiles;
21
+ httpFiles;
22
+ zipFileName;
23
+ progressCallback;
24
+ constructor(schema, csl, book, user, docList, updated) {
25
+ this.schema = schema;
26
+ this.csl = csl;
27
+ this.book = book;
28
+ this.user = user;
29
+ this.docList = docList;
30
+ this.updated = updated;
31
+ this.type = "book";
32
+ this.textFiles = [];
33
+ this.httpFiles = [];
34
+ this.zipFileName = "";
35
+ }
36
+ init(progressCallback) {
37
+ this.progressCallback = progressCallback;
38
+ this.progressCallback?.(gettext("BITS book export has been initiated."), 0);
39
+ if (this.book.chapters.length === 0) {
40
+ throw new Error(gettext("Book cannot be exported due to lack of chapters."));
41
+ }
42
+ return getMissingChapterData(this.book, this.docList, this.schema, {
43
+ progressCallback: this.progressCallback
44
+ }).then(() => this.export());
45
+ }
46
+ export() {
47
+ this.progressCallback?.(gettext("Preparing BITS book..."), 10);
48
+ this.book.chapters.sort((a, b) => (a.number > b.number ? 1 : -1));
49
+ const imageDict = {};
50
+ return Promise.all(this.book.chapters.map(chapter => {
51
+ const doc = this.docList.find(d => d.id === chapter.text);
52
+ if (!doc) {
53
+ return Promise.resolve({ front: "", body: "", back: "" });
54
+ }
55
+ const converter = new JATSExporterConverter(this.type, doc, this.csl, { db: doc.images || {} }, { db: doc.bibliography || {} });
56
+ return converter.init().then(({ front, body, back, imageIds }) => {
57
+ imageIds.forEach((imageId) => (imageDict[imageId] = doc.images?.[imageId]));
58
+ return { front, body, back };
59
+ });
60
+ })).then(chapters => this.createFiles(chapters, imageDict));
61
+ }
62
+ createFiles(chapters, imageDict) {
63
+ this.progressCallback?.(gettext("Assembling BITS book..."), 80);
64
+ const images = Object.entries(imageDict)
65
+ .filter((entry) => Boolean(entry[1]?.image))
66
+ .map(([id, image]) => ({
67
+ // Data URL images (the desktop stores them that way) have no
68
+ // usable last path segment: the base64 payload can contain
69
+ // "/" and a random tail became the file name.
70
+ filename: getImageDBEntryFilename(image, id),
71
+ url: image.image.split("?")[0],
72
+ title: image.title || ""
73
+ }));
74
+ this.zipFileName = `${createSlug(this.book.title)}.bits.zip`;
75
+ this.textFiles = [
76
+ {
77
+ filename: "manuscript.xml",
78
+ contents: pretty(bitsTemplate(this.book, chapters), { ocd: true })
79
+ },
80
+ {
81
+ filename: "manifest.xml",
82
+ contents: pretty(darManifest({
83
+ title: this.book.title,
84
+ type: this.type,
85
+ images
86
+ }), { ocd: true })
87
+ }
88
+ ];
89
+ images.forEach(image => {
90
+ this.httpFiles.push({
91
+ filename: image.filename,
92
+ url: image.url,
93
+ title: image.title
94
+ });
95
+ });
96
+ return this.createZip();
97
+ }
98
+ createZip() {
99
+ this.progressCallback?.(gettext("Finalizing BITS book..."), 90);
100
+ const zipper = new ZipFileCreator(this.textFiles, this.httpFiles, undefined, undefined, new Date(this.updated * 1000));
101
+ return zipper.init().then(blob => {
102
+ this.progressCallback?.(gettext("BITS book export complete."), 100);
103
+ return this.download(blob);
104
+ });
105
+ }
106
+ download(blob) {
107
+ return blob;
108
+ }
109
+ get defaultFilename() {
110
+ return this.zipFileName;
111
+ }
112
+ }
113
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exporter/bits/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,MAAM,MAAM,cAAc,CAAA;AACjC,OAAO,EAAC,qBAAqB,EAAC,MAAM,6CAA6C,CAAA;AACjF,OAAO,EAAC,WAAW,EAAC,MAAM,+CAA+C,CAAA;AAEzE,OAAO,EACH,UAAU,EACV,uBAAuB,EAC1B,MAAM,2CAA2C,CAAA;AAElD,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,OAAO,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAa3C,MAAM,OAAO,gBAAgB;IACzB,MAAM,CAAQ;IACd,GAAG,CAAK;IACR,IAAI,CAAM;IACV,IAAI,CAAM;IACV,OAAO,CAAqB;IAC5B,OAAO,CAAQ;IACf,IAAI,CAAQ;IACZ,SAAS,CAAY;IACrB,SAAS,CAAY;IACrB,WAAW,CAAQ;IACnB,gB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AM;iBACT,CAAC,EACF,EAAC,GAAG,EAAE,IAAI,EAAC,CACd;aACJ;SACJ,CAAA;QAED,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,KAAK,EAAE,KAAK,CAAC,KAAK;aACrB,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,SAAS,EAAE,CAAA;IAC3B,CAAC;IAED,SAAS;QACL,IAAI,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE,EAAE,CAAC,CAAA;QAC/D,MAAM,MAAM,GAAG,IAAI,cAAc,CAC7B,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,SAAS,EACd,SAAS,EACT,SAAS,EACT,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAChC,CAAA;QACD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC7B,IAAI,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE,GAAG,CAAC,CAAA;YACnE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;IACN,CAAC;IAED,QAAQ,CAAC,IAAU;QACf,OAAO,IAAI,CAAA;IACf,CAAC;IAED,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,WAAW,CAAA;IAC3B,CAAC;CACJ"}
@@ -0,0 +1,7 @@
1
+ import type { Book } from "../../types.js";
2
+ export declare const bitsTemplate: (book: Book, chapters: Array<{
3
+ front: string;
4
+ body: string;
5
+ back: string;
6
+ }>) => string;
7
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/exporter/bits/templates.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,IAAI,EAAqB,MAAM,gBAAgB,CAAA;AAK5D,eAAO,MAAM,YAAY,SACf,IAAI,YACA,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,WAiG/D,CAAA"}
@@ -0,0 +1,78 @@
1
+ import { escapeText } from "fwtoolkit";
2
+ const bookPartTemplate = ({ front, body, back }) => `<book-part book-part-type="chapter" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:mml="http://www.w3.org/1998/Math/MathML">${front}${body}${back}</book-part>`;
3
+ export const bitsTemplate = (book, chapters) => {
4
+ const updated = new Date((book.updated || 0) * 1000);
5
+ return `<?xml version="1.0" encoding="UTF-8"?>
6
+ <!DOCTYPE book PUBLIC "-//NLM//DTD BITS Book Interchange DTD v2.1 20220202//EN" "https://jats.nlm.nih.gov/extensions/bits/2.1/BITS-book2-1.dtd">
7
+ <book dtd-version="2.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ali="http://www.niso.org/schemas/ali/1.0/">
8
+ <processing-meta tagset-family="bits" table-model="xhtml" math-representation="tex mathml"></processing-meta>
9
+ <book-meta>
10
+ <book-title-group>
11
+ <book-title>${escapeText(book.title)}</book-title>
12
+ ${book.metadata.subtitle?.length ? `<subtitle>${escapeText(book.metadata.subtitle)}</subtitle>` : ""}
13
+ </book-title-group>
14
+ ${book.metadata.version?.length
15
+ ? `<content-version>${escapeText(book.metadata.version)}</content-version>`
16
+ : ""}
17
+ <content-language>${(book.settings.language || "en-US").split("-")[0]}</content-language>
18
+ ${book.metadata.description?.length
19
+ ? `<abstract>
20
+ <p>${escapeText(book.metadata.description)}</p>
21
+ </abstract>`
22
+ : ""}
23
+ ${book.metadata.author?.length
24
+ ? `<contrib-group>
25
+ <contrib contrib-type="author">
26
+ <name>
27
+ <surname>${escapeText(book.metadata.author.split(" ").slice(1).join(" "))}</surname>
28
+ <given-names>${escapeText(book.metadata.author.split(" ").pop() || "")}</given-names>
29
+ </name>
30
+ </contrib>
31
+ </contrib-group>`
32
+ : ""}
33
+ <pub-date>
34
+ <year>${updated.getFullYear()}</year>
35
+ <month>${updated.getMonth() + 1}</month>
36
+ <day>${updated.getDate()}</day>
37
+ </pub-date>
38
+ ${book.metadata.publication_date?.length
39
+ ? `<pub-date date-type="pub" publication-format="electronic">
40
+ <string-date>${escapeText(book.metadata.publication_date)}</string-date>
41
+ </pub-date>`
42
+ : ""}
43
+ ${book.metadata.isbn?.length
44
+ ? `<isbn>${escapeText(book.metadata.isbn)}</isbn>`
45
+ : ""}
46
+ ${book.metadata.publisher?.length
47
+ ? `<publisher>
48
+ <publisher-name>${escapeText(book.metadata.publisher)}</publisher-name>
49
+ </publisher>`
50
+ : ""}
51
+ ${book.metadata.series_title?.length
52
+ ? `<series>
53
+ <series-title>${escapeText(book.metadata.series_title)}</series-title>
54
+ ${book.metadata.series_position?.length
55
+ ? `<series-text>${escapeText(book.metadata.series_position)}</series-text>`
56
+ : ""}
57
+ </series>`
58
+ : ""}
59
+ ${book.metadata.copyright?.length
60
+ ? `<permissions>
61
+ <copyright-holder>
62
+ <name>${escapeText(book.metadata.copyright)}</name>
63
+ </copyright-holder>
64
+ </permissions>`
65
+ : ""}
66
+ ${book.metadata.keywords?.length
67
+ ? `<kwd-group>${book.metadata.keywords
68
+ .split(",")
69
+ .map(keyword => `<kwd>${escapeText(keyword.trim())}</kwd>`)
70
+ .join("")}</kwd-group>`
71
+ : ""}
72
+ </book-meta>
73
+ <book-body>
74
+ ${chapters.map(chapter => bookPartTemplate(chapter)).join("\n")}
75
+ </book-body>
76
+ </book>`;
77
+ };
78
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/exporter/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QAAQ,CAAC,QAAQ,EAAE,MAAM;QAC1B,CAAC,CAAC,cAAc,IAAI,CAAC,QAAQ,CAAC,QAAQ;aAC/B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CACA,OAAO,CAAC,EAAE,CAAC,QAAQ,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,QAAQ,CACxD;aACA,IAAI,CAAC,EAAE,CAAC,cAAc;QAC7B,CAAC,CAAC,EACV;;;UAGE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;QAE/D,CAAA;AACR,CAAC,CAAA"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * DOCX book exporter.
3
+ */
4
+ import type { Schema } from "prosemirror-model";
5
+ import type { CSL, ExportMetadata, User } from "@fiduswriter/document";
6
+ import type { ProgressCallback } from "@fiduswriter/document/exporter/tools/progress";
7
+ import { XmlZip } from "@fiduswriter/document/exporter/tools/xml_zip";
8
+ import { DOCXExporterMath } from "@fiduswriter/document/exporter/docx/math";
9
+ import { DOCXExporterRels } from "@fiduswriter/document/exporter/docx/rels";
10
+ import { DOCXExporterTables } from "@fiduswriter/document/exporter/docx/tables";
11
+ import type { Book, DocumentListEntry } from "../../types.js";
12
+ import { DOCXBookExporterRender } from "./render.js";
13
+ export declare class DOCXBookExporter {
14
+ schema: Schema;
15
+ csl: CSL;
16
+ book: Book;
17
+ user: User;
18
+ docList: DocumentListEntry[];
19
+ templateUrl: string;
20
+ updated: number;
21
+ textFiles: Array<Record<string, unknown>>;
22
+ httpFiles: Array<Record<string, unknown>>;
23
+ mimeType: string;
24
+ progressCallback?: ProgressCallback;
25
+ constructor(schema: Schema, csl: CSL, book: Book, user: User, docList: DocumentListEntry[], updated: number);
26
+ init(progressCallback?: ProgressCallback): Promise<Blob> | false;
27
+ export(): Promise<Blob>;
28
+ exportChapters(xml: XmlZip, render: DOCXBookExporterRender, rels: DOCXExporterRels, math: DOCXExporterMath, tables: DOCXExporterTables): Promise<void>;
29
+ getBaseMetadata(): ExportMetadata;
30
+ download(blob: Blob): Blob;
31
+ get defaultFilename(): string;
32
+ }
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exporter/docx/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAC,GAAG,EAAE,cAAc,EAAa,IAAI,EAAC,MAAM,uBAAuB,CAAA;AAC/E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,+CAA+C,CAAA;AAMnF,OAAO,EAAC,MAAM,EAAC,MAAM,8CAA8C,CAAA;AAQnE,OAAO,EAAC,gBAAgB,EAAC,MAAM,0CAA0C,CAAA;AAEzE,OAAO,EAAC,gBAAgB,EAAC,MAAM,0CAA0C,CAAA;AAEzE,OAAO,EAAC,kBAAkB,EAAC,MAAM,4CAA4C,CAAA;AAG7E,OAAO,KAAK,EAAC,IAAI,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAE3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAA;AAElD,qBAAa,gBAAgB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACzC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACzC,QAAQ,EAAE,MAAM,CAAA;IACh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