Skip to content

Commit 759c016

Browse files
committed
Create epub versions of tutorial and ref manual.
Pandoc can create epub verions of the markdown files. Since the docs are lengthy, epubs are handy to have around. Two rules to create epub versions of the reference manual and the main tutorial are added here. Signed-off-by: Noufal Ibrahim <[email protected]>
1 parent 1bbd4af commit 759c016

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*.cps
3131
*.log
3232
*.pdf
33+
*.epub
3334
*.html
3435
*.pg
3536
*.toc

mk/clean.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ clean-misc:
5353
$(Q)rm -Rf tmp/*
5454
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
5555
$(Q)rm -Rf $(foreach ext, \
56-
html aux cp fn ky log pdf pg toc tp vr cps, \
56+
html aux cp fn ky log pdf pg toc tp vr cps epub, \
5757
$(wildcard doc/*.$(ext)))
5858
$(Q)find doc/std doc/extra -mindepth 1 | xargs rm -Rf
5959
$(Q)rm -Rf doc/version.md

mk/docs.mk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ doc/rust.tex: rust.md doc/version.md
6464
--from=markdown --to=latex \
6565
--output=$@
6666

67+
DOCS += doc/rust.epub
68+
doc/rust.epub: rust.md doc/version_info.html doc/rust.css doc/manual.inc
69+
@$(call E, pandoc: $@)
70+
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
71+
"$(CFG_PANDOC)" \
72+
--standalone --toc \
73+
--section-divs \
74+
--number-sections \
75+
--from=markdown --to=epub \
76+
--css=rust.css --include-in-header=doc/manual.inc \
77+
--include-before-body=doc/version_info.html \
78+
--output=$@
79+
80+
6781
DOCS += doc/tutorial.tex
6882
doc/tutorial.tex: tutorial.md doc/version.md
6983
@$(call E, pandoc: $@)
@@ -98,6 +112,17 @@ doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
98112
--include-before-body=doc/version_info.html \
99113
--output=$@
100114

115+
DOCS += doc/tutorial.epub
116+
doc/tutorial.epub: tutorial.md doc/version_info.html doc/rust.css
117+
@$(call E, pandoc: $@)
118+
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
119+
$(CFG_PANDOC) --standalone --toc \
120+
--section-divs --number-sections \
121+
--from=markdown --to=epub --css=rust.css \
122+
--include-before-body=doc/version_info.html \
123+
--output=$@
124+
125+
101126
DOCS_L10N += doc/l10n/ja/tutorial.html
102127
doc/l10n/ja/tutorial.html: doc/l10n/ja/tutorial.md doc/version_info.html doc/rust.css
103128
@$(call E, pandoc: $@)

0 commit comments

Comments
 (0)