feat(m2r): use m2r to convert automatic .md files to .rst

* https://github.com/miyakogi/m2r
  - Markdown to reStructuredText converter
This commit is contained in:
Imran Iqbal 2019-03-03 01:05:55 +00:00
parent 1a26fdda06
commit b86ddf4ce7
No known key found for this signature in database
GPG key ID: 6D8629439D2B7819
4 changed files with 35 additions and 2 deletions

3
.gitignore vendored
View file

@ -101,3 +101,6 @@ ENV/
# mypy
.mypy_cache/
# copied `.md` files used for conversion to `.rst` using `m2r`
docs/*.md

View file

@ -8,7 +8,7 @@ Welcome to template-formula's documentation!
============================================
.. toctree::
:maxdepth: 3
:maxdepth: 2
:caption: Contents
:numbered:
:glob:
@ -16,3 +16,5 @@ Welcome to template-formula's documentation!
README <README>
CONTRIBUTING
TOFS_pattern
AUTHORS
CHANGELOG

View file

@ -14,7 +14,7 @@ module.exports = {
prepareCmd: 'sh ./update_FORMULA.sh ${nextRelease.version}',
}],
['@semantic-release/git', {
assets: ['*.md', 'FORMULA'],
assets: ['*.md', 'docs/*.rst', 'FORMULA'],
}],
'@semantic-release/github',
],

View file

@ -1,2 +1,30 @@
#!/bin/sh
###############################################################################
# (A) Update `FORMULA` with `${nextRelease.version}`
###############################################################################
sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
###############################################################################
# (B) Use `m2r` to convert automatically produced `.md` docs to `.rst`
###############################################################################
# Install `m2r`
sudo -H pip install m2r
# Copy and then convert the `.md` docs
cp *.md docs/
cd docs/
m2r --overwrite *.md
# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst`
sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst
sed -i -e '1,4s/-/=/g' CHANGELOG.rst
# Use for debugging output, when required
# cat AUTHORS.rst
# cat CHANGELOG.rst
# Return back to the main directory
cd ..