Loading .github/FUNDING.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line github: paulmueller liberapay: paulmueller CHANGELOG +3 −0 Original line number Diff line number Diff line 1.1.7 - docs: add sponsor links to contribute section - docs: add gallery with all images in docs/gallery 1.1.6 - fix: improve support for Confocor FCS file format (see discussion in #37) Loading docs/conf.py +2 −1 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', 'github_changelog', 'simple_gallery', ] # Add any paths that contain templates here, relative to this directory. Loading Loading @@ -119,7 +120,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'default' html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the Loading docs/extensions/simple_gallery.py 0 → 100644 +63 −0 Original line number Diff line number Diff line """Show all images in the "gallery" folder Usage: .. simple_gallery:: :dir: gallery where "gallery" is relative to the folder containing conf.py. Changelog: 0.1 (2019-10-24) - initial release """ import pathlib from docutils.statemachine import ViewList from docutils.parsers.rst import Directive, directives from sphinx.util.nodes import nested_parse_with_titles from docutils import nodes class SimpleGalleryDirective(Directive): required_arguments = 0 optional_arguments = 1 final_argument_whitespace = True option_spec = { 'dir': directives.unchanged, } def get_files(self): """This will return a list of files""" root = pathlib.Path(__file__).parent.parent gpath = root / self.options["dir"] files = [] for ff in gpath.glob("*"): if ff.suffix in [".png", "*.jpg"]: files.append(ff.relative_to(root)) return files def run(self): rst = [] files = self.get_files() for ff in files: rst.append(".. image:: {}".format(ff)) rst.append(" :target: _images/{}".format(ff.name)) rst.append(" :scale: 25%") rst.append(" :align: left") rst.append("") vl = ViewList(rst, "fakefile.rst") # Create a node. node = nodes.section() node.document = self.state.document # Parse the rst. nested_parse_with_titles(self.state, vl, node) return node.children def setup(app): app.add_directive('simple_gallery', SimpleGalleryDirective) return {'version': '0.1'} # identifies the version of our extension docs/requirements.txt +1 −0 Original line number Diff line number Diff line mock sphinx>=1.6.4 sphinxcontrib.bibtex sphinx_rtd_theme Loading
.github/FUNDING.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line github: paulmueller liberapay: paulmueller
CHANGELOG +3 −0 Original line number Diff line number Diff line 1.1.7 - docs: add sponsor links to contribute section - docs: add gallery with all images in docs/gallery 1.1.6 - fix: improve support for Confocor FCS file format (see discussion in #37) Loading
docs/conf.py +2 −1 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', 'github_changelog', 'simple_gallery', ] # Add any paths that contain templates here, relative to this directory. Loading Loading @@ -119,7 +120,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'default' html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the Loading
docs/extensions/simple_gallery.py 0 → 100644 +63 −0 Original line number Diff line number Diff line """Show all images in the "gallery" folder Usage: .. simple_gallery:: :dir: gallery where "gallery" is relative to the folder containing conf.py. Changelog: 0.1 (2019-10-24) - initial release """ import pathlib from docutils.statemachine import ViewList from docutils.parsers.rst import Directive, directives from sphinx.util.nodes import nested_parse_with_titles from docutils import nodes class SimpleGalleryDirective(Directive): required_arguments = 0 optional_arguments = 1 final_argument_whitespace = True option_spec = { 'dir': directives.unchanged, } def get_files(self): """This will return a list of files""" root = pathlib.Path(__file__).parent.parent gpath = root / self.options["dir"] files = [] for ff in gpath.glob("*"): if ff.suffix in [".png", "*.jpg"]: files.append(ff.relative_to(root)) return files def run(self): rst = [] files = self.get_files() for ff in files: rst.append(".. image:: {}".format(ff)) rst.append(" :target: _images/{}".format(ff.name)) rst.append(" :scale: 25%") rst.append(" :align: left") rst.append("") vl = ViewList(rst, "fakefile.rst") # Create a node. node = nodes.section() node.document = self.state.document # Parse the rst. nested_parse_with_titles(self.state, vl, node) return node.children def setup(app): app.add_directive('simple_gallery', SimpleGalleryDirective) return {'version': '0.1'} # identifies the version of our extension
docs/requirements.txt +1 −0 Original line number Diff line number Diff line mock sphinx>=1.6.4 sphinxcontrib.bibtex sphinx_rtd_theme