Doc - Add CI for automatic deployment

This commit is contained in:
Anthony MOI
2020-10-05 12:54:01 -04:00
committed by Anthony MOI
parent 16e1348038
commit 59d66c6db8
5 changed files with 110 additions and 24 deletions

View File

@ -2,26 +2,24 @@
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
# from the environment for those with `?=`
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
BUILDDIR ?= build
SOURCEDIR = source
RUSTBUILDDIR = build/rust
PYTHONBUILDDIR = build/python
NODEBUILDDIR = build/node
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(RUSTBUILDDIR)" $(SPHINXOPTS) $(O)
# Put it first so that "make" without argument is like "make html_all".
html_all:
@echo "Generating doc for Rust"
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)/rust" $(SPHINXOPTS) $(O) -t rust
@echo "Generating doc for Python"
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)/python" $(SPHINXOPTS) $(O) -t python
@echo "Generating doc for Node.js"
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)/node" $(SPHINXOPTS) $(O) -t node
.PHONY: help Makefile
.PHONY: html_all Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@echo "Generating doc for Rust"
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(RUSTBUILDDIR)" $(SPHINXOPTS) $(O) -t Rust
@echo "Generating doc for Python"
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(PYTHONBUILDDIR)" $(SPHINXOPTS) $(O) -t Python
@echo "Generating doc for Node.js"
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(NODEBUILDDIR)" $(SPHINXOPTS) $(O) -t Node
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -114,9 +114,12 @@ function addVersionControl() {
// If a version is specified, update it
if (parts[versionIndex] != "" && !parts[versionIndex].endsWith(".html")) {
version = parts[versionIndex];
// Otherwise redirect to the latest
} else {
// Otherwise redirect to the latest (if not opening locally)
} else if (!parts[parts.length - 1].endsWith(".html")) {
return window.location.pathname = [language, version, parts.splice(versionIndex)].join("/");
// Opening locally, just don't show the version/language selector
} else {
return
}
// Language Menu

View File

@ -40,7 +40,7 @@ Load an existing tokenizer:
Loading a previously saved tokenizer is extremely simple and requires a single line of code:
.. only:: Rust
.. only:: rust
.. literalinclude:: ../../tokenizers/tests/documentation.rs
:language: rust
@ -48,7 +48,7 @@ Loading a previously saved tokenizer is extremely simple and requires a single l
:end-before: END load_tokenizer
:dedent: 4
.. only:: Python
.. only:: python
.. literalinclude:: ../../bindings/python/tests/documentation/test_load.py
:language: python
@ -56,7 +56,7 @@ Loading a previously saved tokenizer is extremely simple and requires a single l
:end-before: END load_tokenizer
:dedent: 4
.. only:: Node
.. only:: node
.. literalinclude:: ../../bindings/node/examples/load.test.js
:language: javascript
@ -70,7 +70,7 @@ Train a tokenizer:
Small guide of :ref:`how to create a Tokenizer options<tokenizer_blocks>`.
.. only:: Rust
.. only:: rust
.. literalinclude:: ../../tokenizers/tests/documentation.rs
:language: rust
@ -78,7 +78,7 @@ Small guide of :ref:`how to create a Tokenizer options<tokenizer_blocks>`.
:end-before: END train_tokenizer
:dedent: 4
.. only:: Python
.. only:: python
.. literalinclude:: ../../bindings/python/tests/documentation/test_train.py
:language: python
@ -86,7 +86,7 @@ Small guide of :ref:`how to create a Tokenizer options<tokenizer_blocks>`.
:end-before: END train_tokenizer
:dedent: 4
.. only:: Node
.. only:: node
.. literalinclude:: ../../bindings/node/examples/train.test.js
:language: javascript