From 331c54929b296daccd59565ae88ae3d6c3b608c2 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Sat, 18 Sep 2021 15:28:21 +0100 Subject: [PATCH] Use CONTRIBUTING template instead of automatic conversion Due to an [issue] the output generated by rst-to-myst does not work 100%. Therefore a fixed template seems to be a temporary solution. [issue]: https://github.com/executablebooks/rst-to-myst/issues/33 --- setup.cfg | 2 +- src/pyscaffoldext/markdown/extension.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/setup.cfg b/setup.cfg index 9558e6f..ed8fae9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,7 +57,7 @@ install_requires = pyscaffold>=4.1rc1,<5.0a0 wheel>=0.31 myst-parser[linkify] - rst-to-myst[sphinx]>=0.3.2 + # rst-to-myst[sphinx]>=0.3.2 # see issue #25 [options.packages.find] diff --git a/src/pyscaffoldext/markdown/extension.py b/src/pyscaffoldext/markdown/extension.py index fcc75b1..69c01b8 100644 --- a/src/pyscaffoldext/markdown/extension.py +++ b/src/pyscaffoldext/markdown/extension.py @@ -10,7 +10,6 @@ from pyscaffold.operations import no_overwrite from pyscaffold.structure import merge, reify_leaf, reject from pyscaffold.templates import get_template -from rst_to_myst.mdformat_render import rst_to_myst from . import templates @@ -23,12 +22,6 @@ DOC_REQUIREMENTS = ["myst-parser[linkify]"] -RST2MYST_OPTS: dict = {} -"""Options for the automatic conversion between reStructuredText and Markdown - -See https://rst-to-myst.readthedocs.io/en/stable/api.html#full-conversion -""" - template = partial(get_template, relative_to=templates) @@ -135,6 +128,7 @@ def replace_files(struct: Structure, opts: ScaffoldOpts) -> ActionParams: "README.md": (template("readme"), NO_OVERWRITE), "AUTHORS.md": (template("authors"), NO_OVERWRITE), "CHANGELOG.md": (template("changelog"), NO_OVERWRITE), + "CONTRIBUTING.md": (template("contributing"), NO_OVERWRITE), "docs": { "index.md": (template("index"), NO_OVERWRITE), "readme.md": (default_myst_include("README.md"), NO_OVERWRITE), @@ -145,10 +139,14 @@ def replace_files(struct: Structure, opts: ScaffoldOpts) -> ActionParams: }, } - # Automatically convert RST to MD - content, file_op = reify_leaf(struct.get("CONTRIBUTING.rst"), opts) - md_content = rst_to_myst(content or "", **RST2MYST_OPTS).text - files["CONTRIBUTING.md"] = (md_content, file_op) + # TODO: Automatically convert RST to MD + # + # >>> content, file_op = reify_leaf(struct.get("CONTRIBUTING.rst"), opts) + # >>> md_content = rst_to_myst(content or "", **RST2MYST_OPTS).text + # >>> files["CONTRIBUTING.md"] = (md_content, file_op) + # + # Currently there is a problem in rst-to-myst, preventing automatic conversion: + # https://github.com/executablebooks/rst-to-myst/issues/33#issuecomment-922264030 # Modify pre-existing files content, file_op = reify_leaf(struct["setup.cfg"], opts)