Skip to content

Commit 74bfa71

Browse files
committedMar 11, 2014
auto merge of #12783 : adrientetar/rust/more-docs, r=alexcrichton
- remove `node.js` dep., it has no effect as of #12747 (1) - switch between LaTeX compilers, some cleanups - CSS: fixup the print stylesheet, refactor highlighting code (2) (1): `prep.js` outputs its own HTML directives, which `pandoc` cannot recognize when converting the document into LaTeX (this is why the PDF docs have never been highlighted as of now). Note that if we were to add the `.rust` class to snippets, we could probably use pandoc's native highlighting capatibilities i.e. Kate ([here is](http://adrientetar.github.io/rust-tuts/tutorial/tutorial.pdf) an example of that). (2): the only real highlighting change is for lifetimes which are now brown instead of red, the rest is just refactor of twos shades of red that look the same. Also I made numbers highlighting for src in rustdoc a tint more clear so that it is less bothering. @alexcrichton, @huonw Closes #9873. Closes #12788.
2 parents 3bede9f + 840a270 commit 74bfa71

File tree

12 files changed

+67
-764
lines changed

12 files changed

+67
-764
lines changed
 

‎configure

+2-3
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,8 @@ probe CFG_ISCC iscc
454454
probe CFG_LLNEXTGEN LLnextgen
455455
probe CFG_PANDOC pandoc
456456
probe CFG_PDFLATEX pdflatex
457-
probe CFG_XETEX xetex
458-
probe CFG_LUATEX luatex
459-
probe CFG_NODE nodejs node
457+
probe CFG_XELATEX xelatex
458+
probe CFG_LUALATEX lualatex
460459
probe CFG_GDB gdb
461460
if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
462461
then

‎mk/docs.mk

+28-33
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
# translated.
2828
######################################################################
2929
DOCS := index tutorial guide-ffi guide-macros guide-lifetimes \
30-
guide-tasks guide-container guide-pointers \
31-
complement-cheatsheet guide-runtime \
32-
rust rustdoc
30+
guide-tasks guide-container guide-pointers guide-testing \
31+
guide-runtime complement-bugreport complement-cheatsheet \
32+
complement-lang-faq complement-project-faq rust rustdoc
3333

3434
PDF_DOCS := tutorial rust
3535

@@ -46,7 +46,7 @@ RUSTDOC_HTML_OPTS = --markdown-css rust.css \
4646
--markdown-in-header=doc/favicon.inc --markdown-after-content=doc/footer.inc
4747

4848
PANDOC_BASE_OPTS := --standalone --toc --number-sections
49-
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --include-before-body=doc/version.md \
49+
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --include-before-body=doc/version.tex \
5050
--from=markdown --include-before-body=doc/footer.tex --to=latex
5151
PANDOC_EPUB_OPTS = $(PANDOC_BASE_OPTS) --to=epub
5252

@@ -73,18 +73,20 @@ endif
7373
# Check for the various external utilities for the EPUB/PDF docs:
7474

7575
ifeq ($(CFG_PDFLATEX),)
76-
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
77-
NO_PDF_DOCS = 1
78-
else
79-
ifeq ($(CFG_XETEX),)
80-
$(info cfg: no xetex found, disabling doc/rust.pdf)
81-
NO_PDF_DOCS = 1
76+
$(info cfg: no pdflatex found, deferring to xelatex)
77+
ifeq ($(CFG_XELATEX),)
78+
$(info cfg: no xelatex found, deferring to lualatex)
79+
ifeq ($(CFG_LUALATEX),)
80+
$(info cfg: no lualatex found, disabling LaTeX docs)
81+
NO_PDF_DOCS = 1
82+
else
83+
CFG_LATEX := $(CFG_LUALATEX)
84+
endif
8285
else
83-
ifeq ($(CFG_LUATEX),)
84-
$(info cfg: lacking luatex, disabling pdflatex)
85-
NO_PDF_DOCS = 1
86-
endif
86+
CFG_LATEX := $(CFG_XELATEX)
8787
endif
88+
else
89+
CFG_LATEX := $(CFG_PDFLATEX)
8890
endif
8991

9092

@@ -93,17 +95,12 @@ $(info cfg: no pandoc found, omitting PDF and EPUB docs)
9395
ONLY_HTML_DOCS = 1
9496
endif
9597

96-
ifeq ($(CFG_NODE),)
97-
$(info cfg: no node found, omitting PDF and EPUB docs)
98-
ONLY_HTML_DOCS = 1
99-
endif
100-
10198

10299
######################################################################
103100
# Rust version
104101
######################################################################
105102

106-
doc/version.md: $(MKFILE_DEPS) $(wildcard $(D)/*.*) | doc/
103+
doc/version.tex: $(MKFILE_DEPS) $(wildcard $(D)/*.*) | doc/
107104
@$(call E, version-stamp: $@)
108105
$(Q)echo "$(CFG_VERSION)" >$@
109106

@@ -115,10 +112,10 @@ doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
115112
$(CFG_VER_HASH) | head -c 8)/;\
116113
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
117114

118-
GENERATED += doc/version.md doc/version_info.html
115+
GENERATED += doc/version.tex doc/version_info.html
119116

120117
######################################################################
121-
# Docs, from rustdoc and sometimes pandoc & node
118+
# Docs, from rustdoc and sometimes pandoc
122119
######################################################################
123120

124121
doc/:
@@ -143,10 +140,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
143140
@$(call E, cp: $@)
144141
$(Q)cp -a $< $@ 2> /dev/null
145142

146-
doc/footer.tex: $(D)/footer.tex | doc/
147-
@$(call E, cp: $@)
148-
$(Q)cp -a $< $@ 2> /dev/null
149-
150143
# The (english) documentation for each doc item.
151144

152145
define DEF_SHOULD_BUILD_PDF_DOC
@@ -168,22 +161,24 @@ ifneq ($(ONLY_HTML_DOCS),1)
168161
DOC_TARGETS += doc/$(1).epub
169162
doc/$(1).epub: $$(D)/$(1).md | doc/
170163
@$$(call E, pandoc: $$@)
171-
$$(Q)$$(CFG_NODE) $$(D)/prep.js --highlight $$< | \
172-
$$(CFG_PANDOC) $$(PANDOC_EPUB_OPTS) --output=$$@
164+
$$(CFG_PANDOC) $$(PANDOC_EPUB_OPTS) $$< --output=$$@
165+
166+
doc/footer.tex: $(D)/footer.inc | doc/
167+
@$$(call E, pandoc: $$@)
168+
$$(CFG_PANDOC) --from=html --to=latex $$< --output=$$@
173169

174170
# PDF (md =(pandoc)=> tex =(pdflatex)=> pdf)
175171
DOC_TARGETS += doc/$(1).tex
176-
doc/$(1).tex: $$(D)/$(1).md doc/footer.tex doc/version.md | doc/
172+
doc/$(1).tex: $$(D)/$(1).md doc/footer.tex doc/version.tex | doc/
177173
@$$(call E, pandoc: $$@)
178-
$$(Q)$$(CFG_NODE) $$(D)/prep.js $$< | \
179-
$$(CFG_PANDOC) $$(PANDOC_TEX_OPTS) --output=$$@
174+
$$(CFG_PANDOC) $$(PANDOC_TEX_OPTS) $$< --output=$$@
180175

181176
ifneq ($(NO_PDF_DOCS),1)
182177
ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1)),1)
183178
DOC_TARGETS += doc/$(1).pdf
184179
doc/$(1).pdf: doc/$(1).tex
185-
@$$(call E, pdflatex: $$@)
186-
$$(Q)$$(CFG_PDFLATEX) \
180+
@$$(call E, latex compiler: $$@)
181+
$$(Q)$$(CFG_LATEX) \
187182
-interaction=batchmode \
188183
-output-directory=doc \
189184
$$<

‎src/doc/README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
document converter, is required to generate docs as HTML from Rust's
55
source code.
66

7-
[Node.js](http://nodejs.org/) is also required for generating HTML from
8-
the Markdown docs (reference manual, tutorials, etc.) distributed with
9-
this git repository.
10-
117
[po4a](http://po4a.alioth.debian.org/) is required for generating translated
128
docs from the master (English) docs.
139

@@ -30,8 +26,8 @@ rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs
3026

3127
# Additional notes
3228

33-
To generate an HTML version of a doc from Markdown without having Node.js
34-
installed, you can do something like:
29+
To generate an HTML version of a doc from Markdown manually, you can do
30+
something like:
3531

3632
~~~~
3733
pandoc --from=markdown --to=html5 --number-sections -o rust.html rust.md

‎src/doc/footer.tex

-7
This file was deleted.

‎src/doc/lib/codemirror-node.js

-146
This file was deleted.

0 commit comments

Comments
 (0)