@fiduswriter/books-document 0.1.8 → 0.1.11
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.
- package/dist/exporter/docx/render.d.ts.map +1 -1
- package/dist/exporter/docx/render.js.map +1 -1
- package/dist/exporter/epub/index.d.ts +2 -1
- package/dist/exporter/epub/index.d.ts.map +1 -1
- package/dist/exporter/epub/index.js.map +1 -1
- package/dist/exporter/html/index.d.ts +3 -2
- package/dist/exporter/html/index.d.ts.map +1 -1
- package/dist/exporter/html/index.js +1 -1
- package/dist/exporter/html/index.js.map +1 -1
- package/dist/exporter/latex/index.d.ts +2 -0
- package/dist/exporter/latex/index.d.ts.map +1 -1
- package/dist/exporter/latex/index.js +6 -1
- package/dist/exporter/latex/index.js.map +1 -1
- package/dist/exporter/odt/render.d.ts.map +1 -1
- package/dist/exporter/odt/render.js.map +1 -1
- package/locale/ar/messages.json +49 -0
- package/locale/bg/messages.json +49 -0
- package/locale/cs/messages.json +49 -0
- package/locale/da/messages.json +49 -0
- package/locale/de/messages.json +49 -0
- package/locale/en/messages.json +49 -0
- package/locale/en_US/messages.json +49 -0
- package/locale/es/messages.json +49 -0
- package/locale/fr/messages.json +49 -0
- package/locale/it/messages.json +49 -0
- package/locale/ja/messages.json +49 -0
- package/locale/ko/messages.json +49 -0
- package/locale/nb/messages.json +49 -0
- package/locale/nl/messages.json +49 -0
- package/locale/pl/messages.json +49 -0
- package/locale/pt_BR/messages.json +49 -0
- package/locale/pt_PT/messages.json +49 -0
- package/locale/ru/messages.json +49 -0
- package/locale/sv/messages.json +49 -0
- package/locale/tr/messages.json +49 -0
- package/locale/zh_Hans/messages.json +49 -0
- package/package.json +22 -14
- package/src/exporter/docx/render.ts +17 -4
- package/src/exporter/epub/index.ts +3 -2
- package/src/exporter/html/index.ts +9 -17
- package/src/exporter/latex/index.ts +8 -3
- package/src/exporter/odt/render.ts +16 -4
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"": "ru",
|
|
3
|
+
"A personal passphrase is required to work with books that contain encrypted chapters. Please set up or unlock your personal passphrase in your profile settings.": "",
|
|
4
|
+
"Assembling BITS book...": "",
|
|
5
|
+
"Assembling Epub book...": "",
|
|
6
|
+
"Assembling HTML book...": "",
|
|
7
|
+
"BITS book export complete.": "",
|
|
8
|
+
"BITS book export has been initiated.": "",
|
|
9
|
+
"Book cannot be exported due to lack of chapters.": "",
|
|
10
|
+
"Cannot produce book as you lack access rights to its chapters.": "",
|
|
11
|
+
"Chapter data loaded.": "",
|
|
12
|
+
"Could not decrypt chapter:": "",
|
|
13
|
+
"Could not import chapter ": "",
|
|
14
|
+
"DOCX book export complete.": "",
|
|
15
|
+
"DOCX book export has been initiated.": "",
|
|
16
|
+
"Epub book export complete.": "",
|
|
17
|
+
"Epub book export has been initiated.": "",
|
|
18
|
+
"Exporting book chapters...": "",
|
|
19
|
+
"Exporting chapter %s of %s...": "",
|
|
20
|
+
"Fidusbook export complete.": "",
|
|
21
|
+
"Fidusbook export failed.": "",
|
|
22
|
+
"Fidusbook export has been initiated.": "",
|
|
23
|
+
"Fidusbook file is missing data for chapter ": "",
|
|
24
|
+
"Finalizing BITS book...": "",
|
|
25
|
+
"Finalizing DOCX book...": "",
|
|
26
|
+
"Finalizing Epub book...": "",
|
|
27
|
+
"Finalizing HTML book...": "",
|
|
28
|
+
"Finalizing LaTeX book...": "",
|
|
29
|
+
"Finalizing ODT book...": "",
|
|
30
|
+
"HTML book export complete.": "",
|
|
31
|
+
"HTML book export has been initiated.": "",
|
|
32
|
+
"LaTeX book export complete.": "",
|
|
33
|
+
"LaTeX book export has been initiated.": "",
|
|
34
|
+
"Loading chapter data...": "",
|
|
35
|
+
"No encryption key found for chapter:": "",
|
|
36
|
+
"ODT book export complete.": "",
|
|
37
|
+
"ODT book export has been initiated.": "",
|
|
38
|
+
"Preparing BITS book...": "",
|
|
39
|
+
"Preparing DOCX book...": "",
|
|
40
|
+
"Preparing Epub book...": "",
|
|
41
|
+
"Preparing LaTeX book...": "",
|
|
42
|
+
"Preparing ODT book...": "",
|
|
43
|
+
"successfully imported.": "успешно импортирован.",
|
|
44
|
+
"The document may have been re-encrypted with a different password.": "",
|
|
45
|
+
"The Fidusbook file version is not supported by this server: ": "",
|
|
46
|
+
"The key may not have been shared with you.": "",
|
|
47
|
+
"The uploaded file does not appear to be a Fidusbook file.": "",
|
|
48
|
+
"Untitled": "Без названия"
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"": "sv",
|
|
3
|
+
"A personal passphrase is required to work with books that contain encrypted chapters. Please set up or unlock your personal passphrase in your profile settings.": "",
|
|
4
|
+
"Assembling BITS book...": "",
|
|
5
|
+
"Assembling Epub book...": "",
|
|
6
|
+
"Assembling HTML book...": "",
|
|
7
|
+
"BITS book export complete.": "",
|
|
8
|
+
"BITS book export has been initiated.": "",
|
|
9
|
+
"Book cannot be exported due to lack of chapters.": "",
|
|
10
|
+
"Cannot produce book as you lack access rights to its chapters.": "",
|
|
11
|
+
"Chapter data loaded.": "",
|
|
12
|
+
"Could not decrypt chapter:": "",
|
|
13
|
+
"Could not import chapter ": "",
|
|
14
|
+
"DOCX book export complete.": "",
|
|
15
|
+
"DOCX book export has been initiated.": "",
|
|
16
|
+
"Epub book export complete.": "",
|
|
17
|
+
"Epub book export has been initiated.": "",
|
|
18
|
+
"Exporting book chapters...": "",
|
|
19
|
+
"Exporting chapter %s of %s...": "",
|
|
20
|
+
"Fidusbook export complete.": "",
|
|
21
|
+
"Fidusbook export failed.": "",
|
|
22
|
+
"Fidusbook export has been initiated.": "",
|
|
23
|
+
"Fidusbook file is missing data for chapter ": "",
|
|
24
|
+
"Finalizing BITS book...": "",
|
|
25
|
+
"Finalizing DOCX book...": "",
|
|
26
|
+
"Finalizing Epub book...": "",
|
|
27
|
+
"Finalizing HTML book...": "",
|
|
28
|
+
"Finalizing LaTeX book...": "",
|
|
29
|
+
"Finalizing ODT book...": "",
|
|
30
|
+
"HTML book export complete.": "",
|
|
31
|
+
"HTML book export has been initiated.": "",
|
|
32
|
+
"LaTeX book export complete.": "",
|
|
33
|
+
"LaTeX book export has been initiated.": "",
|
|
34
|
+
"Loading chapter data...": "",
|
|
35
|
+
"No encryption key found for chapter:": "",
|
|
36
|
+
"ODT book export complete.": "",
|
|
37
|
+
"ODT book export has been initiated.": "",
|
|
38
|
+
"Preparing BITS book...": "",
|
|
39
|
+
"Preparing DOCX book...": "",
|
|
40
|
+
"Preparing Epub book...": "",
|
|
41
|
+
"Preparing LaTeX book...": "",
|
|
42
|
+
"Preparing ODT book...": "",
|
|
43
|
+
"successfully imported.": "framgångsrikt importerat.",
|
|
44
|
+
"The document may have been re-encrypted with a different password.": "",
|
|
45
|
+
"The Fidusbook file version is not supported by this server: ": "",
|
|
46
|
+
"The key may not have been shared with you.": "",
|
|
47
|
+
"The uploaded file does not appear to be a Fidusbook file.": "",
|
|
48
|
+
"Untitled": "Namnlös"
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"": "tr",
|
|
3
|
+
"A personal passphrase is required to work with books that contain encrypted chapters. Please set up or unlock your personal passphrase in your profile settings.": "",
|
|
4
|
+
"Assembling BITS book...": "",
|
|
5
|
+
"Assembling Epub book...": "",
|
|
6
|
+
"Assembling HTML book...": "",
|
|
7
|
+
"BITS book export complete.": "",
|
|
8
|
+
"BITS book export has been initiated.": "",
|
|
9
|
+
"Book cannot be exported due to lack of chapters.": "",
|
|
10
|
+
"Cannot produce book as you lack access rights to its chapters.": "",
|
|
11
|
+
"Chapter data loaded.": "",
|
|
12
|
+
"Could not decrypt chapter:": "",
|
|
13
|
+
"Could not import chapter ": "",
|
|
14
|
+
"DOCX book export complete.": "",
|
|
15
|
+
"DOCX book export has been initiated.": "",
|
|
16
|
+
"Epub book export complete.": "",
|
|
17
|
+
"Epub book export has been initiated.": "",
|
|
18
|
+
"Exporting book chapters...": "",
|
|
19
|
+
"Exporting chapter %s of %s...": "",
|
|
20
|
+
"Fidusbook export complete.": "",
|
|
21
|
+
"Fidusbook export failed.": "",
|
|
22
|
+
"Fidusbook export has been initiated.": "",
|
|
23
|
+
"Fidusbook file is missing data for chapter ": "",
|
|
24
|
+
"Finalizing BITS book...": "",
|
|
25
|
+
"Finalizing DOCX book...": "",
|
|
26
|
+
"Finalizing Epub book...": "",
|
|
27
|
+
"Finalizing HTML book...": "",
|
|
28
|
+
"Finalizing LaTeX book...": "",
|
|
29
|
+
"Finalizing ODT book...": "",
|
|
30
|
+
"HTML book export complete.": "",
|
|
31
|
+
"HTML book export has been initiated.": "",
|
|
32
|
+
"LaTeX book export complete.": "",
|
|
33
|
+
"LaTeX book export has been initiated.": "",
|
|
34
|
+
"Loading chapter data...": "",
|
|
35
|
+
"No encryption key found for chapter:": "",
|
|
36
|
+
"ODT book export complete.": "",
|
|
37
|
+
"ODT book export has been initiated.": "",
|
|
38
|
+
"Preparing BITS book...": "",
|
|
39
|
+
"Preparing DOCX book...": "",
|
|
40
|
+
"Preparing Epub book...": "",
|
|
41
|
+
"Preparing LaTeX book...": "",
|
|
42
|
+
"Preparing ODT book...": "",
|
|
43
|
+
"successfully imported.": "başarıyla içe aktarıldı.",
|
|
44
|
+
"The document may have been re-encrypted with a different password.": "",
|
|
45
|
+
"The Fidusbook file version is not supported by this server: ": "",
|
|
46
|
+
"The key may not have been shared with you.": "",
|
|
47
|
+
"The uploaded file does not appear to be a Fidusbook file.": "",
|
|
48
|
+
"Untitled": "İsimsiz"
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"": "zh_Hans",
|
|
3
|
+
"A personal passphrase is required to work with books that contain encrypted chapters. Please set up or unlock your personal passphrase in your profile settings.": "",
|
|
4
|
+
"Assembling BITS book...": "",
|
|
5
|
+
"Assembling Epub book...": "",
|
|
6
|
+
"Assembling HTML book...": "",
|
|
7
|
+
"BITS book export complete.": "",
|
|
8
|
+
"BITS book export has been initiated.": "",
|
|
9
|
+
"Book cannot be exported due to lack of chapters.": "",
|
|
10
|
+
"Cannot produce book as you lack access rights to its chapters.": "",
|
|
11
|
+
"Chapter data loaded.": "",
|
|
12
|
+
"Could not decrypt chapter:": "",
|
|
13
|
+
"Could not import chapter ": "",
|
|
14
|
+
"DOCX book export complete.": "",
|
|
15
|
+
"DOCX book export has been initiated.": "",
|
|
16
|
+
"Epub book export complete.": "",
|
|
17
|
+
"Epub book export has been initiated.": "",
|
|
18
|
+
"Exporting book chapters...": "",
|
|
19
|
+
"Exporting chapter %s of %s...": "",
|
|
20
|
+
"Fidusbook export complete.": "",
|
|
21
|
+
"Fidusbook export failed.": "",
|
|
22
|
+
"Fidusbook export has been initiated.": "",
|
|
23
|
+
"Fidusbook file is missing data for chapter ": "",
|
|
24
|
+
"Finalizing BITS book...": "",
|
|
25
|
+
"Finalizing DOCX book...": "",
|
|
26
|
+
"Finalizing Epub book...": "",
|
|
27
|
+
"Finalizing HTML book...": "",
|
|
28
|
+
"Finalizing LaTeX book...": "",
|
|
29
|
+
"Finalizing ODT book...": "",
|
|
30
|
+
"HTML book export complete.": "",
|
|
31
|
+
"HTML book export has been initiated.": "",
|
|
32
|
+
"LaTeX book export complete.": "",
|
|
33
|
+
"LaTeX book export has been initiated.": "",
|
|
34
|
+
"Loading chapter data...": "",
|
|
35
|
+
"No encryption key found for chapter:": "",
|
|
36
|
+
"ODT book export complete.": "",
|
|
37
|
+
"ODT book export has been initiated.": "",
|
|
38
|
+
"Preparing BITS book...": "",
|
|
39
|
+
"Preparing DOCX book...": "",
|
|
40
|
+
"Preparing Epub book...": "",
|
|
41
|
+
"Preparing LaTeX book...": "",
|
|
42
|
+
"Preparing ODT book...": "",
|
|
43
|
+
"successfully imported.": "成功导入。",
|
|
44
|
+
"The document may have been re-encrypted with a different password.": "",
|
|
45
|
+
"The Fidusbook file version is not supported by this server: ": "",
|
|
46
|
+
"The key may not have been shared with you.": "",
|
|
47
|
+
"The uploaded file does not appear to be a Fidusbook file.": "",
|
|
48
|
+
"Untitled": "无题"
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiduswriter/books-document",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Fidus Writer book importers and exporters",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -72,48 +72,56 @@
|
|
|
72
72
|
"dist/",
|
|
73
73
|
"src/",
|
|
74
74
|
"README.md",
|
|
75
|
-
"LICENSE"
|
|
75
|
+
"LICENSE",
|
|
76
|
+
"locale/*/messages.json"
|
|
76
77
|
],
|
|
77
78
|
"scripts": {
|
|
78
79
|
"build": "tsc",
|
|
79
|
-
"prepare": "
|
|
80
|
+
"prepare": "husky",
|
|
80
81
|
"prepublishOnly": "npm run build",
|
|
81
82
|
"typecheck": "tsc --noEmit",
|
|
82
83
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.config.js",
|
|
83
84
|
"lint": "eslint src test",
|
|
84
85
|
"lint:fix": "eslint src test --fix",
|
|
85
86
|
"format": "prettier --write .",
|
|
86
|
-
"format:check": "prettier --check ."
|
|
87
|
+
"format:check": "prettier --check .",
|
|
88
|
+
"install-hooks": "husky",
|
|
89
|
+
"compile-i18n": "node scripts/compile-i18n.js",
|
|
90
|
+
"extract-i18n": "node scripts/extract-i18n.js"
|
|
87
91
|
},
|
|
88
92
|
"dependencies": {
|
|
89
|
-
"@fiduswriter/document": "^0.2.
|
|
93
|
+
"@fiduswriter/document": "^0.2.32",
|
|
90
94
|
"@vivliostyle/print": "^2.42.0",
|
|
91
|
-
"bibliojson": "^4.0.
|
|
95
|
+
"bibliojson": "^4.0.4",
|
|
92
96
|
"downloadjs": "^1.4.7",
|
|
93
97
|
"fast-deep-equal": "^3.1.3",
|
|
94
|
-
"fwtoolkit": "^0.
|
|
98
|
+
"fwtoolkit": "^0.2.4",
|
|
95
99
|
"jszip": "^3.10.1",
|
|
96
100
|
"pretty": "^2.0.0"
|
|
97
101
|
},
|
|
98
102
|
"devDependencies": {
|
|
103
|
+
"@eslint/js": "^10.0.1",
|
|
99
104
|
"@types/node": "^26.0.1",
|
|
105
|
+
"eslint": "^10.6.0",
|
|
106
|
+
"gettext-parser": "^9.1.1",
|
|
107
|
+
"globals": "^15.15.0",
|
|
108
|
+
"husky": "^9.1.7",
|
|
100
109
|
"jest": "^30.4.2",
|
|
110
|
+
"lint-staged": "^17.0.8",
|
|
111
|
+
"prettier": "^3.8.5",
|
|
112
|
+
"prosemirror-model": "^1.25.0",
|
|
101
113
|
"ts-jest": "^29.1.2",
|
|
102
114
|
"ts-jest-resolver": "^2.0.1",
|
|
103
115
|
"typescript": "^6.0.3",
|
|
104
|
-
"
|
|
105
|
-
"eslint": "^10.6.0",
|
|
106
|
-
"globals": "^15.15.0",
|
|
107
|
-
"prettier": "^3.8.5",
|
|
108
|
-
"typescript-eslint": "^8.62.0",
|
|
109
|
-
"prosemirror-model": "^1.25.0"
|
|
116
|
+
"typescript-eslint": "^8.62.0"
|
|
110
117
|
},
|
|
111
118
|
"lint-staged": {
|
|
112
119
|
"*.{ts,js,mjs,css,md,json,html}": [
|
|
113
120
|
"prettier --write"
|
|
114
121
|
],
|
|
115
122
|
"*.{ts,js,mjs}": [
|
|
116
|
-
"eslint --fix"
|
|
123
|
+
"eslint --fix",
|
|
124
|
+
"sh -c 'npm run typecheck'"
|
|
117
125
|
]
|
|
118
126
|
}
|
|
119
127
|
}
|
|
@@ -5,6 +5,13 @@ import {DOCXExporterRender} from "@fiduswriter/document/exporter/docx/render"
|
|
|
5
5
|
import {DOCXExporterRichtext} from "@fiduswriter/document/exporter/docx/richtext"
|
|
6
6
|
import type {DocSettings, FidusNode} from "@fiduswriter/document"
|
|
7
7
|
|
|
8
|
+
interface TagData {
|
|
9
|
+
title: string
|
|
10
|
+
content?: string | unknown[]
|
|
11
|
+
block: XMLElement
|
|
12
|
+
dimensions?: {width: number; height: number}
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
export class DOCXBookExporterRender extends DOCXExporterRender {
|
|
9
16
|
preamble: XMLElement | null
|
|
10
17
|
bodyTemplate: XMLElement | null
|
|
@@ -69,7 +76,13 @@ export class DOCXBookExporterRender extends DOCXExporterRender {
|
|
|
69
76
|
if (bodyBookmark) {
|
|
70
77
|
bodyBookmark.setAttribute("w:name", `chapter ${chapterIndex + 1}`)
|
|
71
78
|
}
|
|
72
|
-
super.render(
|
|
79
|
+
super.render(
|
|
80
|
+
docContent,
|
|
81
|
+
pmBib as false | FidusNode,
|
|
82
|
+
settings,
|
|
83
|
+
richtext,
|
|
84
|
+
citations
|
|
85
|
+
)
|
|
73
86
|
this.bodyParts.push(this.text)
|
|
74
87
|
}
|
|
75
88
|
|
|
@@ -105,7 +118,7 @@ export class DOCXBookExporterRender extends DOCXExporterRender {
|
|
|
105
118
|
]
|
|
106
119
|
const usedTags: Array<{
|
|
107
120
|
title: string
|
|
108
|
-
content?: unknown
|
|
121
|
+
content?: string | unknown[]
|
|
109
122
|
block: XMLElement
|
|
110
123
|
}> = []
|
|
111
124
|
const ambles = [this.preamble, this.postamble].filter(
|
|
@@ -118,12 +131,12 @@ export class DOCXBookExporterRender extends DOCXExporterRender {
|
|
|
118
131
|
tags.forEach(tag => {
|
|
119
132
|
const tagString = tag.title
|
|
120
133
|
if (text.includes(`{${tagString}}`)) {
|
|
121
|
-
usedTags.push(Object.assign({block}, tag))
|
|
134
|
+
usedTags.push(Object.assign({block}, tag) as TagData)
|
|
122
135
|
}
|
|
123
136
|
})
|
|
124
137
|
})
|
|
125
138
|
})
|
|
126
|
-
usedTags.forEach(tag => this.inlineRender(tag))
|
|
139
|
+
usedTags.forEach(tag => this.inlineRender(tag as unknown as TagData))
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
assemble(): void {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type {Schema} from "prosemirror-model"
|
|
6
6
|
import {HTMLExporterConvert} from "@fiduswriter/document/exporter/html/convert"
|
|
7
|
+
import type {HTMLExportMetadata} from "@fiduswriter/document/exporter/html/convert"
|
|
7
8
|
import {htmlExportTemplate} from "@fiduswriter/document/exporter/html/templates"
|
|
8
9
|
import type {ProgressCallback} from "@fiduswriter/document/exporter/tools/progress"
|
|
9
10
|
import {removeHidden} from "@fiduswriter/document/exporter/tools/doc_content"
|
|
@@ -65,7 +66,7 @@ interface ChapterOutput {
|
|
|
65
66
|
part: string
|
|
66
67
|
title: string
|
|
67
68
|
docNum: number
|
|
68
|
-
metaData:
|
|
69
|
+
metaData: HTMLExportMetadata
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
export class EpubBookExporter {
|
|
@@ -247,7 +248,7 @@ export class EpubBookExporter {
|
|
|
247
248
|
})
|
|
248
249
|
|
|
249
250
|
await Promise.all(
|
|
250
|
-
extraStyleSheets.map(
|
|
251
|
+
(extraStyleSheets as StyleSheet[]).map(
|
|
251
252
|
async (sheet: StyleSheet) => this.loadStyle(sheet)
|
|
252
253
|
)
|
|
253
254
|
)
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type {Schema} from "prosemirror-model"
|
|
6
6
|
import type {CSL, User} from "@fiduswriter/document"
|
|
7
|
+
import type {HTMLExportMetadata} from "@fiduswriter/document/exporter/html/convert"
|
|
7
8
|
import type {ProgressCallback} from "@fiduswriter/document/exporter/tools/progress"
|
|
8
9
|
import {HTMLExporter} from "@fiduswriter/document/exporter/html/index"
|
|
9
10
|
import {createSlug} from "@fiduswriter/document/exporter/tools/file"
|
|
@@ -33,7 +34,7 @@ interface StyleSheet {
|
|
|
33
34
|
|
|
34
35
|
interface TextFile {
|
|
35
36
|
filename: string
|
|
36
|
-
contents
|
|
37
|
+
contents?: string
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
interface HttpFile {
|
|
@@ -50,7 +51,7 @@ interface ChapterInfo {
|
|
|
50
51
|
number: number
|
|
51
52
|
part: string
|
|
52
53
|
doc: DocumentListEntry
|
|
53
|
-
metaData:
|
|
54
|
+
metaData: HTMLExportMetadata
|
|
54
55
|
toc: Array<Record<string, unknown>>
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -201,7 +202,7 @@ export class HTMLBookExporter {
|
|
|
201
202
|
bibDB,
|
|
202
203
|
imageDB,
|
|
203
204
|
this.csl,
|
|
204
|
-
this.updated,
|
|
205
|
+
new Date(this.updated * 1000),
|
|
205
206
|
[],
|
|
206
207
|
options,
|
|
207
208
|
htmlBookChapterTemplate as unknown as typeof HTMLExporter.prototype.htmlExportTemplate
|
|
@@ -209,19 +210,7 @@ export class HTMLBookExporter {
|
|
|
209
210
|
|
|
210
211
|
await documentHTMLExporter.process()
|
|
211
212
|
const {metaData, converter, textFiles, httpFiles} =
|
|
212
|
-
documentHTMLExporter.getProcessedFiles()
|
|
213
|
-
metaData: Record<string, unknown>
|
|
214
|
-
converter: {
|
|
215
|
-
fnCounter: number
|
|
216
|
-
affCounter: number
|
|
217
|
-
categoryCounter: Record<string, number>
|
|
218
|
-
features: {math: boolean}
|
|
219
|
-
citations: {bibCSS: string}
|
|
220
|
-
metaData: {toc: Array<Record<string, unknown>>}
|
|
221
|
-
}
|
|
222
|
-
textFiles: TextFile[]
|
|
223
|
-
httpFiles: HttpFile[]
|
|
224
|
-
}
|
|
213
|
+
documentHTMLExporter.getProcessedFiles()
|
|
225
214
|
|
|
226
215
|
const contents = textFiles.find(
|
|
227
216
|
(textFile: TextFile) => textFile.filename === "document.html"
|
|
@@ -443,7 +432,10 @@ export class HTMLBookExporter {
|
|
|
443
432
|
|
|
444
433
|
async createZip(): Promise<Blob | void> {
|
|
445
434
|
const zipper = new ZipFileCreator(
|
|
446
|
-
this.textFiles.concat(this.styleSheets as TextFile[])
|
|
435
|
+
this.textFiles.concat(this.styleSheets as TextFile[]) as Array<{
|
|
436
|
+
filename: string
|
|
437
|
+
contents: string
|
|
438
|
+
}>,
|
|
447
439
|
this.httpFiles,
|
|
448
440
|
this.includeZips,
|
|
449
441
|
"application/zip",
|
|
@@ -13,7 +13,7 @@ import {ZipFileCreator} from "fwtoolkit/file/zip"
|
|
|
13
13
|
import {gettext} from "fwtoolkit"
|
|
14
14
|
|
|
15
15
|
import type {Book, DocumentListEntry} from "../../types.js"
|
|
16
|
-
import type {BibDB, ImageDB} from "@fiduswriter/document"
|
|
16
|
+
import type {BibDB, ExportDoc, FidusNode, ImageDB} from "@fiduswriter/document"
|
|
17
17
|
import {getMissingChapterData} from "../tools.js"
|
|
18
18
|
import {bookTexTemplate} from "./templates.js"
|
|
19
19
|
|
|
@@ -29,6 +29,7 @@ interface HttpFile {
|
|
|
29
29
|
|
|
30
30
|
export class LatexBookExporter {
|
|
31
31
|
schema: Schema
|
|
32
|
+
doc!: ExportDoc
|
|
32
33
|
book: Book
|
|
33
34
|
user: User
|
|
34
35
|
docList: DocumentListEntry[]
|
|
@@ -81,13 +82,14 @@ export class LatexBookExporter {
|
|
|
81
82
|
if (!doc) {
|
|
82
83
|
return
|
|
83
84
|
}
|
|
85
|
+
this.doc = doc
|
|
84
86
|
const converter = new LatexExporterConvert(
|
|
85
87
|
this,
|
|
86
88
|
{db: doc.images || {}},
|
|
87
89
|
{db: doc.bibliography || {}},
|
|
88
90
|
doc.settings
|
|
89
91
|
)
|
|
90
|
-
const chapterContent = removeHidden(doc.content)
|
|
92
|
+
const chapterContent = removeHidden(doc.content) as FidusNode
|
|
91
93
|
const convertedDoc = converter.init(chapterContent)
|
|
92
94
|
this.textFiles.push({
|
|
93
95
|
filename: `chapter-${index + 1}.tex`,
|
|
@@ -132,7 +134,10 @@ export class LatexBookExporter {
|
|
|
132
134
|
this,
|
|
133
135
|
{db: combinedImages as unknown as ImageDB["db"]},
|
|
134
136
|
{db: combinedBibliography as unknown as BibDB["db"]},
|
|
135
|
-
{
|
|
137
|
+
{
|
|
138
|
+
language: this.book.settings.language,
|
|
139
|
+
bibliography_header: {} as FidusNode
|
|
140
|
+
}
|
|
136
141
|
)
|
|
137
142
|
bookConverter.features = features
|
|
138
143
|
const preamble = bookConverter.assemblePreamble()
|
|
@@ -6,6 +6,12 @@ import {ODTExporterRender} from "@fiduswriter/document/exporter/odt/render"
|
|
|
6
6
|
import {ODTExporterRichtext} from "@fiduswriter/document/exporter/odt/richtext"
|
|
7
7
|
import type {ODTExporterStyles} from "@fiduswriter/document/exporter/odt/styles"
|
|
8
8
|
|
|
9
|
+
interface Tag {
|
|
10
|
+
title: string
|
|
11
|
+
content?: unknown[]
|
|
12
|
+
block: XMLElement
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
export class ODTBookExporterRender extends ODTExporterRender {
|
|
10
16
|
styles: ODTExporterStyles
|
|
11
17
|
preamble: XMLElement | null
|
|
@@ -85,7 +91,13 @@ export class ODTBookExporterRender extends ODTExporterRender {
|
|
|
85
91
|
`chapter ${chapterIndex + 1}`
|
|
86
92
|
)
|
|
87
93
|
}
|
|
88
|
-
super.render(
|
|
94
|
+
super.render(
|
|
95
|
+
docContent,
|
|
96
|
+
pmBib as false | FidusNode,
|
|
97
|
+
settings,
|
|
98
|
+
richtext,
|
|
99
|
+
citations
|
|
100
|
+
)
|
|
89
101
|
this.bodyParts.push(this.text)
|
|
90
102
|
}
|
|
91
103
|
|
|
@@ -121,7 +133,7 @@ export class ODTBookExporterRender extends ODTExporterRender {
|
|
|
121
133
|
]
|
|
122
134
|
const usedTags: Array<{
|
|
123
135
|
title: string
|
|
124
|
-
content?: unknown
|
|
136
|
+
content?: unknown[]
|
|
125
137
|
block: XMLElement
|
|
126
138
|
}> = []
|
|
127
139
|
const ambles = [this.preamble, this.postamble].filter(
|
|
@@ -137,12 +149,12 @@ export class ODTBookExporterRender extends ODTExporterRender {
|
|
|
137
149
|
tags.forEach(tag => {
|
|
138
150
|
const tagString = tag.title
|
|
139
151
|
if (text.includes(`{${tagString}}`)) {
|
|
140
|
-
usedTags.push(Object.assign({block}, tag))
|
|
152
|
+
usedTags.push(Object.assign({block}, tag) as Tag)
|
|
141
153
|
}
|
|
142
154
|
})
|
|
143
155
|
})
|
|
144
156
|
})
|
|
145
|
-
usedTags.forEach(tag => this.inlineRender(tag))
|
|
157
|
+
usedTags.forEach(tag => this.inlineRender(tag as unknown as Tag))
|
|
146
158
|
}
|
|
147
159
|
|
|
148
160
|
assemble(): void {
|