diff --git a/doc/prep.js b/doc/prep.js index 89dfd5ef085f7708da65fbaf947cf9c81f913572..1cd5bec81b2be03d55c7ce6ee36829c2121e70cc 100755 --- a/doc/prep.js +++ b/doc/prep.js @@ -40,7 +40,16 @@ var out = outfile ? fs.createWriteStream(outfile) : process.stdout; while ((line = lines[cur++]) != null) { if (/^~~~/.test(line)) { var block = "", bline; - var isRust = !/notrust/.test(line); + var notRust = + /notrust/.test(line) + // These are all used by the language ref to indicate things + // that are not Rust source code + || /ebnf/.test(line) + || /abnf/.test(line) + || /keyword/.test(line) + || /field/.test(line) + || /precedence/.test(line); + var isRust = !notRust; while ((bline = lines[cur++]) != null) { if (/^~~~/.test(bline)) break; if (!/^\s*##? /.test(bline)) block += bline + "\n"; diff --git a/mk/docs.mk b/mk/docs.mk index 5efd5c4678ea85d9c5cbf0caae0b92a2f7722cc6..8582b4c58e7851d50d095d046230b94e546f4e98 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -12,20 +12,25 @@ ifeq ($(CFG_PANDOC),) $(info cfg: no pandoc found, omitting doc/rust.pdf) else + ifeq ($(CFG_NODE),) + $(info cfg: no node found, omitting doc/tutorial.html) + else + DOCS += doc/rust.html doc/rust.html: rust.md doc/version.md doc/keywords.md $(S)doc/rust.css @$(call E, pandoc: $@) - $(Q)"$(CFG_PANDOC)" \ + $(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \ + "$(CFG_PANDOC)" \ --standalone --toc \ --section-divs \ --number-sections \ --from=markdown --to=html \ --css=rust.css \ - --output=$@ \ - $< + --output=$@ @$(call E, cp: $(S)doc/rust.css) -$(Q)cp -a $(S)doc/rust.css doc/rust.css 2> /dev/null + endif ifeq ($(CFG_PDFLATEX),) $(info cfg: no pdflatex found, omitting doc/rust.pdf)