From 641cea092699aaeba8c61ed5ca864f0a219d5c43 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Mon, 13 Oct 2014 13:09:17 -0700 Subject: [PATCH] doc: build branch versioned docs --- Makefile | 13 +++++++++++-- tools/doc/html.js | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3464c2e2f16..99c168179c6 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,9 @@ website_files = \ doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ out/doc/changelog.html node +doc-branch: NODE_DOC_VERSION = v$(shell $(PYTHON) tools/getnodeversion.py | cut -f1,2 -d.) +doc-branch: doc + $(apidoc_dirs): mkdir -p $@ @@ -159,10 +162,10 @@ out/doc/%: doc/% cp -r $< $@ out/doc/api/%.json: doc/api/%.markdown node - out/Release/node tools/doc/generate.js --format=json $< > $@ + NODE_DOC_VERSION=$(NODE_DOC_VERSION) out/Release/node tools/doc/generate.js --format=json $< > $@ out/doc/api/%.html: doc/api/%.markdown node - out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@ + NODE_DOC_VERSION=$(NODE_DOC_VERSION) out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@ email.md: ChangeLog tools/email-footer.md bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@ @@ -181,6 +184,11 @@ website-upload: doc rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\ ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz' +doc-branch-upload: NODE_DOC_VERSION = v$(shell $(PYTHON) tools/getnodeversion.py | cut -f1,2 -d.) +doc-branch-upload: doc-branch + echo $(NODE_DOC_VERSION) + rsync -r out/doc/api/ node@nodejs.org:~/web/nodejs.org/api/$(NODE_DOC_VERSION) + docopen: out/doc/api/all.html -google-chrome out/doc/api/all.html @@ -189,6 +197,7 @@ docclean: RAWVER=$(shell $(PYTHON) tools/getnodeversion.py) VERSION=v$(RAWVER) +NODE_DOC_VERSION=$(VERSION) RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py) PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]') ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) diff --git a/tools/doc/html.js b/tools/doc/html.js index 087f726a35f..195668a3795 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -48,7 +48,7 @@ function render(lexed, filename, template, cb) { template = template.replace(/__FILENAME__/g, filename); template = template.replace(/__SECTION__/g, section); - template = template.replace(/__VERSION__/g, process.version); + template = template.replace(/__VERSION__/g, process.env.NODE_DOC_VERSION); template = template.replace(/__TOC__/g, toc); // content has to be the last thing we do with