Skip to content

Instantly share code, notes, and snippets.

@ksunden
Created January 10, 2023 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksunden/1b726225cbc93e65c7e478fda4dd5a1f to your computer and use it in GitHub Desktop.
Save ksunden/1b726225cbc93e65c7e478fda4dd5a1f to your computer and use it in GitHub Desktop.
import sphinx
from packaging.version import parse as parse_version
# -- General configuration ------------------------------------------------
extensions = ['matplotlib.sphinxext.plot_directive']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'tinypages'
copyright = '2014, Matplotlib developers'
version = '0.1'
release = '0.1'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
# -- Options for HTML output ----------------------------------------------
if parse_version(sphinx.__version__) >= parse_version('1.3'):
html_theme = 'classic'
else:
html_theme = 'default'
html_static_path = ['_static']

plt.plot(range(2))

# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS = -W --keep-going
SPHINXBUILD = python -msphinx
SPHINXPROJ = matplotlib
SOURCEDIR = .
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# workaround because sphinx does not completely clean up (#11139)
clean:
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
rm -rf "$(SOURCEDIR)/build"
rm -rf "$(SOURCEDIR)/api/_as_gen"
rm -rf "$(SOURCEDIR)/gallery"
rm -rf "$(SOURCEDIR)/plot_types"
rm -rf "$(SOURCEDIR)/tutorials"
rm -rf "$(SOURCEDIR)/savefig"
rm -rf "$(SOURCEDIR)/sphinxext/__pycache__"
show:
@python -c "import webbrowser; webbrowser.open_new_tab('file://$(shell pwd)/build/html/index.html')"
html-noplot:
$(SPHINXBUILD) -D plot_gallery=0 -b html $(SOURCEDIR) $(BUILDDIR)/html $(SPHINXOPTS) $(O)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
mkdir _static
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment