From 5842b1a4b35a293e3d3cb9eedb85092ee3761326 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 28 Jan 2018 16:13:47 -0200 Subject: Sphinx: markdown support --- share/templater/sphinx/files/Makefile.sphinx | 6 +++++- share/templater/sphinx/files/conf.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/share/templater/sphinx/files/Makefile.sphinx b/share/templater/sphinx/files/Makefile.sphinx index 6f8ddaa..3369b20 100644 --- a/share/templater/sphinx/files/Makefile.sphinx +++ b/share/templater/sphinx/files/Makefile.sphinx @@ -94,6 +94,8 @@ epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + @cp $(BUILDDIR)/epub/*epub _static/ + @echo "A copy was made to _static/." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @@ -107,6 +109,8 @@ latexpdf: @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + @cp $(BUILDDIR)/latex/*pdf _static/ + @echo "A copy was made to _static/." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @@ -152,7 +156,7 @@ doctest: @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." -web: clean html +web: clean epub latexpdf html web_deploy: @rsync -avz --delete _build/html/ templates:/var/sites/templates/www/ diff --git a/share/templater/sphinx/files/conf.py b/share/templater/sphinx/files/conf.py index a605478..a8aa2d8 100644 --- a/share/templater/sphinx/files/conf.py +++ b/share/templater/sphinx/files/conf.py @@ -12,6 +12,8 @@ # serve to show the default. import sys, os +import recommonmark +from recommonmark.transform import AutoStructify # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -291,3 +293,15 @@ epub_copyright = u'2016, Templates' # Allow duplicate toc entries. #epub_tocdup = True + +# See http://recommonmark.readthedocs.io +#github_doc_root = 'https://github.com/rtfd/recommonmark/tree/master/doc/' +def setup(app): + app.add_config_value('recommonmark_config', { + #'url_resolver': lambda url: github_doc_root + url, + 'auto_toc_tree_section': 'Index', + 'enable_auto_toc_tree' : True, + 'enable_auto_doc_ref' : True, + 'enable_eval_rst' : True, + }, True) + app.add_transform(AutoStructify) -- cgit v1.2.3