Skip to content

Commit ba85c03

Browse files
authored
Add nozip epub format (#1093)
1 parent 2316379 commit ba85c03

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

pretext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
VERSION = get_version("pretext", Path(__file__).parent.parent)
2020

2121

22-
CORE_COMMIT = "ce20f15d525f2d1e7a3c3fb8da3bb5fa9d16d3ee"
22+
CORE_COMMIT = "e98e2f879c6da2daaf3435bdcff832c3fc05c91b"
2323

2424

2525
def activate() -> None:

pretext/constants.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"pdf",
99
"latex",
1010
"epub",
11+
"epub_nozip",
1112
"kindle",
1213
"braille",
1314
"revealjs",
@@ -70,6 +71,20 @@
7071
"myopenmath",
7172
"dynamic-subs",
7273
],
74+
"epub_nozip": [
75+
"webwork",
76+
"latex-image",
77+
"sageplot",
78+
"asymptote",
79+
"youtube",
80+
"codelens",
81+
"datafile",
82+
"interactive",
83+
"qrcode",
84+
"mermaid",
85+
"myopenmath",
86+
"dynamic-subs",
87+
],
7388
"kindle": [
7489
"webwork",
7590
"latex-image",
@@ -198,6 +213,13 @@
198213
"prefigure": ["svg"],
199214
"mermaid": ["svg"],
200215
},
216+
"epub_nozip": {
217+
"asymptote": ["svg"],
218+
"latex-image": ["svg"],
219+
"sageplot": ["svg"],
220+
"prefigure": ["svg"],
221+
"mermaid": ["svg"],
222+
},
201223
"kindle": {
202224
"asymptote": ["png"],
203225
"latex-image": ["png"],

pretext/project/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Format(str, Enum):
5353
LATEX = "latex"
5454
PDF = "pdf"
5555
EPUB = "epub"
56+
EPUB_NOZIP = "epub_nozip"
5657
KINDLE = "kindle"
5758
BRAILLE = "braille"
5859
REVEALJS = "revealjs"
@@ -810,6 +811,18 @@ def build(
810811
pub_file=self.publication_abspath().as_posix(),
811812
out_file=out_file,
812813
dest_dir=self.output_dir_abspath().as_posix(),
814+
file_format="epub",
815+
math_format="svg",
816+
stringparams=stringparams_copy,
817+
)
818+
elif self.format == Format.EPUB_NOZIP:
819+
utils.mjsre_npm_install()
820+
core.epub(
821+
xml_source=self.source_abspath(),
822+
pub_file=self.publication_abspath().as_posix(),
823+
out_file=out_file,
824+
dest_dir=self.output_dir_abspath().as_posix(),
825+
file_format="nozip",
813826
math_format="svg",
814827
stringparams=stringparams_copy,
815828
)
@@ -820,6 +833,7 @@ def build(
820833
pub_file=self.publication_abspath().as_posix(),
821834
out_file=out_file,
822835
dest_dir=self.output_dir_abspath().as_posix(),
836+
file_format="epub",
823837
math_format="kindle",
824838
stringparams=stringparams_copy,
825839
)

0 commit comments

Comments
 (0)