Skip to content

Commit

Permalink
Automatically fetch and include examples images in generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamovar committed Feb 26, 2015
1 parent edc1519 commit e961cbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions brian2/sphinxext/generate_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ def main(rootpath, destdir):
output += docs + '\n\n::\n\n'
output += '\n'.join([' ' + line for line in afterdoccode.split('\n')])
output += '\n\n'
images = glob.glob('../../docs_sphinx/examples_images/%s.*.png' % exname)
basedir, _ = os.path.split(__file__)
eximgpat = os.path.join(basedir, '../../docs_sphinx/examples_images', '%s.*.png' % exname)
images = glob.glob(eximgpat)
for image in sorted(images):
image = os.path.relpath(image, '../../docs_sphinx/examples_images')
_, image = os.path.split(image)
output += '.. image:: ../examples_images/%s\n\n' % image

open(os.path.join(destdir, exname + '.rst'), 'w').write(output)
Expand Down
2 changes: 2 additions & 0 deletions dev/tools/docs/build_html_brian2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import shutil
import sphinx
import sys
from download_examples_images_from_dropbox import download_examples_images_from_dropbox

download_examples_images_from_dropbox()
os.chdir('../../../docs_sphinx')
if os.path.exists('../docs'):
shutil.rmtree('../docs')
Expand Down

0 comments on commit e961cbf

Please sign in to comment.