Skip to content

Commit

Permalink
↗️ also convert a markdown CONTRIBUTING
Browse files Browse the repository at this point in the history
  • Loading branch information
jhermann committed Apr 30, 2015
1 parent b054d5f commit 9d8fb72
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/rituals/acts/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ def sphinx(ctx, browse=False, opts=''):
"""Build Sphinx docs."""
cfg = config.load()

# Convert README, if applicable
readme_md = cfg.rootjoin('README.md')
if os.path.exists(readme_md):
try:
import pypandoc
except ImportError as exc:
notify.warning("Can't import 'pandoc' ({})".format(exc))
else:
pypandoc.convert(readme_md, 'rst', outputfile=os.path.join(ctx.docs.sources, 'README.rst'))
# Convert markdown files, if applicable
for basename in ('README', 'CONTRIBUTING'):
markdown = cfg.rootjoin(basename + '.md')
if os.path.exists(markdown):
try:
import pypandoc
except ImportError as exc:
notify.warning("Can't import 'pandoc' ({})".format(exc))
break
else:
pypandoc.convert(markdown, 'rst', outputfile=os.path.join(ctx.docs.sources, basename + '.rst'))

# Build API docs
cmd = ['sphinx-apidoc', '-o', 'api', '-f', '-M']
Expand Down

0 comments on commit 9d8fb72

Please sign in to comment.