Skip to content

Commit

Permalink
↗️ convert a markdown README to rst, if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
jhermann committed Apr 30, 2015
1 parent 29a6009 commit b054d5f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/rituals/acts/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from invoke import Collection, ctask as task

from .. import config
from ..util import notify
from ..util.filesys import pushd


Expand All @@ -39,6 +40,16 @@ 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'))

# Build API docs
cmd = ['sphinx-apidoc', '-o', 'api', '-f', '-M']
for package in cfg.project.packages:
Expand Down

0 comments on commit b054d5f

Please sign in to comment.