diff --git a/docs/source/Extensions/hidden_code_block.py b/docs/source/Extensions/hidden_code_block.py index 3782d47d582bdea3f50c9f0bd18af38c74dc667b..195a80921b911db69b1572c828c4d88bac368d63 100644 --- a/docs/source/Extensions/hidden_code_block.py +++ b/docs/source/Extensions/hidden_code_block.py @@ -35,7 +35,12 @@ Released under the WTFPL (http://sam.zoy.org/wtfpl/). from docutils import nodes from docutils.parsers.rst import directives from sphinx.directives.code import CodeBlock -from sphinx.util.compat import make_admonition + +# Fixes from https://github.com/abakan/ablog/commit/413566341b36d2b855fdebe133e15edcd4542785 +try: + from sphinx.util.compat import make_admonition +except ImportError as e: + from docutils.parsers.rst.directives.admonitions import BaseAdmonition as make_admonition HCB_COUNTER = 0 @@ -82,6 +87,12 @@ class HiddenCodeBlock(CodeBlock): hcb.line = self.lineno return [hcb] +def visit_hcb_tex( self, node ): + pass + +def depart_hcb_tex( self, node ): + pass + def visit_hcb_html(self, node): """Visit hidden code block""" @@ -126,4 +137,4 @@ def depart_hcb_html(self, node): def setup(app): app.add_directive('hidden-code-block', HiddenCodeBlock) app.add_node(hidden_code_block, html=(visit_hcb_html, depart_hcb_html)) - + app.add_node(hidden_code_block, latex=(visit_hcb_tex, depart_hcb_tex)) diff --git a/docs/source/conf.py b/docs/source/conf.py index 7a207922fbf7b60b2e0595894022e68abd468fcc..42b01731c9aecfe5514cf1b476c61637654194a1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,17 +22,19 @@ import sys import sphinx_rtd_theme import mock +conf_dir_ = os.path.dirname( __file__ ) + # 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 # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../python')) -sys.path.insert(0, os.path.abspath('./Extensions')) sys.path.append(os.path.abspath('../../moose-examples/snippets')) sys.path.append(os.path.abspath('../../moose-examples/tutorials/ChemicalOscillators')) sys.path.append(os.path.abspath('../../moose-examples/tutorials/ChemicalBistables')) sys.path.append(os.path.abspath('../../moose-examples/tutorials/ExcInhNet')) sys.path.append(os.path.abspath('../../moose-examples/neuroml/lobster_pyloric')) sys.path.append(os.path.abspath('../../moose-examples/tutorials/ExcInhNetCaPlasticity')) +sys.path.append(os.path.join(conf_dir_, 'Extensions') ) # -- General configuration -----------------------------------------------------