Hello community,
here is the log from the commit of package python-recommonmark for
openSUSE:Factory checked in at 2019-08-16 15:27:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-recommonmark (Old)
and /work/SRC/openSUSE:Factory/.python-recommonmark.new.22127 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-recommonmark"
Fri Aug 16 15:27:33 2019 rev:8 rq:722799 version:0.6.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-recommonmark/python-recommonmark.changes
2019-06-18 14:51:31.873625404 +0200
+++
/work/SRC/openSUSE:Factory/.python-recommonmark.new.22127/python-recommonmark.changes
2019-08-16 15:27:34.378007991 +0200
@@ -1,0 +2,29 @@
+Fri Aug 9 19:22:08 UTC 2019 - Sebastian Wagner <[email protected]>
+
+- update to version 0.6.0:
+ - [@RaptorCZ](http://github.com/RaptorCZ): Process linebreaks and
+ convert them to br element.
+ ([\#162](https://github.com/readthedocs/recommonmark/pull/162))
+ - [@gibfahn](http://github.com/gibfahn): Remove URL quoting from refs
+ before passing to Sphinx
+ ([\#158](https://github.com/readthedocs/recommonmark/pull/158))
+ - [@dandersson](http://github.com/dandersson): Use image description
+ text as \"alt\", drop title
+ ([\#150](https://github.com/readthedocs/recommonmark/pull/150))
+ - [@annegentle](http://github.com/annegentle): Clarify the specifics
+ of Auto Toc Tree
+ ([\#149](https://github.com/readthedocs/recommonmark/pull/149))
+ - [@loganrosen](http://github.com/loganrosen): Bump dependency on
+ commonmark to \>= 0.8.1
+ ([\#147](https://github.com/readthedocs/recommonmark/pull/147))
+ - [@codejamninja](http://github.com/codejamninja): Use official
+ gitignore template
+ ([\#140](https://github.com/readthedocs/recommonmark/pull/140))
+ - [@dotlambda](http://github.com/dotlambda): Include all test files in
+ PyPI tarball
+ ([\#128](https://github.com/readthedocs/recommonmark/pull/128))
+ - [@tk0miya](http://github.com/tk0miya): Register a parser class using
+ new Sphinx API; add\_source\_suffix
+ ([\#113](https://github.com/readthedocs/recommonmark/pull/113))
+
+-------------------------------------------------------------------
Old:
----
recommonmark-0.5.0.tar.gz
New:
----
recommonmark-0.6.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-recommonmark.spec ++++++
--- /var/tmp/diff_new_pack.g26QHn/_old 2019-08-16 15:27:34.946007865 +0200
+++ /var/tmp/diff_new_pack.g26QHn/_new 2019-08-16 15:27:34.950007864 +0200
@@ -19,13 +19,14 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name: python-recommonmark
-Version: 0.5.0
+Version: 0.6.0
Release: 0
Summary: Python docutils-compatibility bridge to CommonMark
License: MIT
Group: Development/Languages/Python
URL: https://github.com/rtfd/recommonmark
-Source0:
https://github.com/rtfd/recommonmark/archive/0.5.0.tar.gz#/recommonmark-%{version}.tar.gz
+Source:
https://files.pythonhosted.org/packages/source/r/recommonmark/recommonmark-%{version}.tar.gz
+#Source0:
https://github.com/rtfd/recommonmark/archive/%%{version}.tar.gz#/recommonmark-%%{version}.tar.gz
Patch0: sphinx2.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
++++++ recommonmark-0.5.0.tar.gz -> recommonmark-0.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/.gitignore
new/recommonmark-0.6.0/.gitignore
--- old/recommonmark-0.5.0/.gitignore 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/.gitignore 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-*.pyc
-*egg-info
-_build
-*~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/.travis.yml
new/recommonmark-0.6.0/.travis.yml
--- old/recommonmark-0.5.0/.travis.yml 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-language: python
-python:
- - 2.7
- - 3.5
- - 3.6
-sudo: false
-install:
- - pip install tox-travis
-script:
- - tox
-notifications:
- slack:
- rooms:
- - readthedocs:y3hjODOi7EIz1JAbD1Zb41sz#random
- on_success: change
- on_failure: always
-branches:
- only:
- - master
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/CHANGELOG.md
new/recommonmark-0.6.0/CHANGELOG.md
--- old/recommonmark-0.5.0/CHANGELOG.md 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/CHANGELOG.md 2019-08-09 20:31:51.000000000 +0200
@@ -1,3 +1,34 @@
+
+Version 0.6.0
+-------------
+
+Date: 2019-08-09
+
+- [@RaptorCZ](http://github.com/RaptorCZ): Process linebreaks and
+ convert them to br element.
+ ([\#162](https://github.com/readthedocs/recommonmark/pull/162))
+- [@gibfahn](http://github.com/gibfahn): Remove URL quoting from refs
+ before passing to Sphinx
+ ([\#158](https://github.com/readthedocs/recommonmark/pull/158))
+- [@dandersson](http://github.com/dandersson): Use image description
+ text as \"alt\", drop title
+ ([\#150](https://github.com/readthedocs/recommonmark/pull/150))
+- [@annegentle](http://github.com/annegentle): Clarify the specifics
+ of Auto Toc Tree
+ ([\#149](https://github.com/readthedocs/recommonmark/pull/149))
+- [@loganrosen](http://github.com/loganrosen): Bump dependency on
+ commonmark to \>= 0.8.1
+ ([\#147](https://github.com/readthedocs/recommonmark/pull/147))
+- [@codejamninja](http://github.com/codejamninja): Use official
+ gitignore template
+ ([\#140](https://github.com/readthedocs/recommonmark/pull/140))
+- [@dotlambda](http://github.com/dotlambda): Include all test files in
+ PyPI tarball
+ ([\#128](https://github.com/readthedocs/recommonmark/pull/128))
+- [@tk0miya](http://github.com/tk0miya): Register a parser class using
+ new Sphinx API; add\_source\_suffix
+ ([\#113](https://github.com/readthedocs/recommonmark/pull/113))
+
## Changelog
## 0.4.0 (in development)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/MANIFEST.in
new/recommonmark-0.6.0/MANIFEST.in
--- old/recommonmark-0.5.0/MANIFEST.in 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/MANIFEST.in 2019-08-09 20:09:15.000000000 +0200
@@ -1,3 +1,3 @@
include *.md
recursive-include docs *.md *.py Makefile
-recursive-include tests *.py
+graft tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/PKG-INFO
new/recommonmark-0.6.0/PKG-INFO
--- old/recommonmark-0.5.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/PKG-INFO 2019-08-09 20:32:27.000000000 +0200
@@ -0,0 +1,11 @@
+Metadata-Version: 1.1
+Name: recommonmark
+Version: 0.6.0
+Summary: A docutils-compatibility bridge to CommonMark, enabling you to write
CommonMark inside of Docutils & Sphinx projects.
+Home-page: https://github.com/rtfd/recommonmark
+Author: UNKNOWN
+Author-email: UNKNOWN
+License: MIT
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: License :: OSI Approved :: MIT License
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/README.md
new/recommonmark-0.6.0/README.md
--- old/recommonmark-0.5.0/README.md 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/README.md 2019-08-09 20:30:27.000000000 +0200
@@ -43,6 +43,41 @@
For all links in commonmark that aren't explicit URLs, they are treated as
cross references with the
[`:any:`](http://www.sphinx-doc.org/en/stable/markup/inline.html#role-any)
role. This allows referencing a lot of things including files, labels, and even
objects in the loaded domain.
+#### Linking to headings in other files
+
+For linking to headings in other files you can use the [`autosectionlabel`][]
sphinx feature, e.g.
+
+```python
+# conf.py
+
+extensions = [
+ # Auto-generate section labels.
+ 'sphinx.ext.autosectionlabel',
+]
+
+# Prefix document path to section labels, otherwise autogenerated labels would
look like 'heading'
+# rather than 'path/to/file:heading'
+autosectionlabel_prefix_document = True
+```
+
+You would use it like:
+
+```markdown
+<!-- path/to/file_1.md -->
+
+# Title
+
+## My Subtitle
+```
+
+```markdown
+<!-- file_2.md -->
+
+[My Subtitle][]
+
+[My Subtitle]: <path/to/file_1:My Subtitle>
+```
+
### AutoStructify
AutoStructify makes it possible to write your documentation in Markdown, and
automatically convert this
@@ -70,12 +105,16 @@
AutoStructify comes with the following options. See
[http://recommonmark.readthedocs.org/en/latest/auto_structify.html](http://recommonmark.readthedocs.org/en/latest/auto_structify.html)
for more information about the specific features.
* __enable_auto_toc_tree__: enable the Auto Toc Tree feature.
+* __auto_toc_maxdepth__: The max depth of the Auto Toc. Defaults to 1.
* __auto_toc_tree_section__: when True, Auto Toc Tree will only be enabled on
section that matches the title.
* __enable_auto_doc_ref__: enable the Auto Doc Ref feature. **Deprecated**
* __enable_math__: enable the Math Formula feature.
* __enable_inline_math__: enable the Inline Math feature.
* __enable_eval_rst__: enable the evaluate embedded reStructuredText feature.
* __url_resolver__: a function that maps a existing relative position in the
document to a http link
+* __known_url_schemes__: a list of url schemes to treat as URLs, schemes not
in this list will be assumed to be Sphinx cross-references.
+ Defaults to `None`, which means treat all URL schemes as URLs.
+ Example: `['http', 'https', 'mailto']`
## Development
@@ -118,3 +157,4 @@
[dc]: http://docutils.sourceforge.net/docs/ref/doctree.html
[sphinx-issue]:
https://bitbucket.org/birkenfeld/sphinx/issue/825/markdown-capable-sphinx
[so-question]:
http://stackoverflow.com/questions/2471804/using-sphinx-with-markdown-instead-of-rst
+[`autosectionlabel`]:
https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/docs/auto_structify.md
new/recommonmark-0.6.0/docs/auto_structify.md
--- old/recommonmark-0.5.0/docs/auto_structify.md 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/docs/auto_structify.md 2019-08-09
20:31:51.000000000 +0200
@@ -1,5 +1,6 @@
AutoStructify Component
=======================
+
AutoStructify is a component in recommonmark that takes a parsed docutil AST
by `CommonMarkParser`,
and transform it to another AST that introduces some of more. This enables
additional features
of recommonmark syntax, to introduce more structure into the final generated
document.
@@ -7,6 +8,7 @@
Configuring AutoStructify
-------------------------
+
The behavior of AutoStructify can be configured via a dict in document setting.
In sphinx, you can configure it by `conf.py`. The following snippet
is what is actually used to generate this document, see full code at
[conf.py](conf.py).
@@ -21,9 +23,11 @@
app.add_transform(AutoStructify)
```
+
All the features are by default enabled
***List of options***
+
* __enable_auto_toc_tree__: whether enable [Auto Toc Tree](#auto-toc-tree)
feature.
* __auto_toc_tree_section__: when enabled, [Auto Toc Tree](#auto-toc-tree)
will only be enabled on section that matches the title.
* __enable_auto_doc_ref__: whether enable [Auto Doc Ref](#auto-doc-ref)
feature. **Deprecated**
@@ -34,17 +38,20 @@
Auto Toc Tree
-------------
+
One of important command in tools like sphinx is `toctree`. This is a command
to generate table of contents and
tell sphinx about the structure of the documents. In markdown, usually we
manually list of contents by a bullet list
of url reference to the other documents.
-AutoStructify will transforms bullet list of document URLs
+AutoStructify transforms bullet list of document URLs like this
```
* [Title1](doc1.md)
* [Title2](doc2.md)
```
-will be translated to the AST of following reStructuredText code
+
+to the AST of this following reStructuredText code
+
```rst
.. toctree::
:maxdepth: 1
@@ -52,6 +59,7 @@
doc1
doc2
```
+
You can also find the usage of this feature in `index.md` of this document.
Auto Doc Ref
@@ -66,10 +74,13 @@
It is common to refer to another document page in one document. We usually use
reference to do that.
AutoStructify will translate these reference block into a structured document
reference. For example
+
```
[API Reference](api_ref.md)
```
+
will be translated to the AST of following reStructuredText code
+
```
:doc:`API Reference </api_ref>`
```
@@ -77,6 +88,7 @@
URL Resolver
------------
+
Sometimes in a markdown, we want to refer to the code in the same repo.
This can usually be done by a reference by reference path. However, since the
generated document is hosted elsewhere,
the relative path may not work in generated document site. URL resolver is
introduced to solve this problem.
@@ -87,9 +99,9 @@
Note that the reference to the internal document will not be passed to url
resolver, and will be linked to the internal document pages correctly, see
[Auto Doc Ref](#auto-doc-ref).
-
Codeblock Extensions
--------------------
+
In markdown, you can write codeblocks fenced by (at least) three backticks
(```` ``` ````). The following is an example of codeblock.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/docs/conf.py
new/recommonmark-0.6.0/docs/conf.py
--- old/recommonmark-0.5.0/docs/conf.py 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/docs/conf.py 2019-08-09 20:31:51.000000000 +0200
@@ -21,12 +21,8 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
import recommonmark
-from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
-source_parsers = {
- '.md': CommonMarkParser
-}
source_suffix = ['.rst', '.md']
@@ -42,6 +38,7 @@
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.mathjax',
+ 'recommonmark',
]
# Add any paths that contain templates here, relative to this directory.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/docs/index.md
new/recommonmark-0.6.0/docs/index.md
--- old/recommonmark-0.5.0/docs/index.md 2019-08-16 15:27:35.010007851
+0200
+++ new/recommonmark-0.6.0/docs/index.md 2019-08-09 20:30:27.000000000
+0200
@@ -1 +1,160 @@
-symbolic link to ../README.md
+# recommonmark
+
+A `docutils`-compatibility bridge to [CommonMark][cm].
+
+This allows you to write CommonMark inside of Docutils & Sphinx projects.
+
+Documentation is available on Read the Docs:
<http://recommonmark.readthedocs.org>
+
+Contents
+--------
+
+* [API Reference](api_ref.md)
+* [AutoStructify Component](auto_structify.md)
+
+## Getting Started
+
+To use `recommonmark` inside of Sphinx only takes 2 steps.
+First you install it:
+
+```
+pip install recommonmark
+```
+
+Then add this to your Sphinx conf.py:
+
+```
+# for Sphinx-1.4 or newer
+extensions = ['recommonmark']
+
+# for Sphinx-1.3
+from recommonmark.parser import CommonMarkParser
+
+source_parsers = {
+ '.md': CommonMarkParser,
+}
+
+source_suffix = ['.rst', '.md']
+```
+
+This allows you to write both `.md` and `.rst` files inside of the same
project.
+
+### Links
+
+For all links in commonmark that aren't explicit URLs, they are treated as
cross references with the
[`:any:`](http://www.sphinx-doc.org/en/stable/markup/inline.html#role-any)
role. This allows referencing a lot of things including files, labels, and even
objects in the loaded domain.
+
+#### Linking to headings in other files
+
+For linking to headings in other files you can use the [`autosectionlabel`][]
sphinx feature, e.g.
+
+```python
+# conf.py
+
+extensions = [
+ # Auto-generate section labels.
+ 'sphinx.ext.autosectionlabel',
+]
+
+# Prefix document path to section labels, otherwise autogenerated labels would
look like 'heading'
+# rather than 'path/to/file:heading'
+autosectionlabel_prefix_document = True
+```
+
+You would use it like:
+
+```markdown
+<!-- path/to/file_1.md -->
+
+# Title
+
+## My Subtitle
+```
+
+```markdown
+<!-- file_2.md -->
+
+[My Subtitle][]
+
+[My Subtitle]: <path/to/file_1:My Subtitle>
+```
+
+### AutoStructify
+
+AutoStructify makes it possible to write your documentation in Markdown, and
automatically convert this
+into rST at build time. See [the AutoStructify
Documentation](http://recommonmark.readthedocs.org/en/latest/auto_structify.html)
+for more information about configuration and usage.
+
+To use the advanced markdown to rst transformations you must add
`AutoStructify` to your Sphinx conf.py.
+
+```python
+# At top on conf.py (with other import statements)
+import recommonmark
+from recommonmark.transform import AutoStructify
+
+# At the bottom of conf.py
+def setup(app):
+ app.add_config_value('recommonmark_config', {
+ 'url_resolver': lambda url: github_doc_root + url,
+ 'auto_toc_tree_section': 'Contents',
+ }, True)
+ app.add_transform(AutoStructify)
+```
+
+See https://github.com/rtfd/recommonmark/blob/master/docs/conf.py for a full
example.
+
+AutoStructify comes with the following options. See
[http://recommonmark.readthedocs.org/en/latest/auto_structify.html](http://recommonmark.readthedocs.org/en/latest/auto_structify.html)
for more information about the specific features.
+
+* __enable_auto_toc_tree__: enable the Auto Toc Tree feature.
+* __auto_toc_maxdepth__: The max depth of the Auto Toc. Defaults to 1.
+* __auto_toc_tree_section__: when True, Auto Toc Tree will only be enabled on
section that matches the title.
+* __enable_auto_doc_ref__: enable the Auto Doc Ref feature. **Deprecated**
+* __enable_math__: enable the Math Formula feature.
+* __enable_inline_math__: enable the Inline Math feature.
+* __enable_eval_rst__: enable the evaluate embedded reStructuredText feature.
+* __url_resolver__: a function that maps a existing relative position in the
document to a http link
+* __known_url_schemes__: a list of url schemes to treat as URLs, schemes not
in this list will be assumed to be Sphinx cross-references.
+ Defaults to `None`, which means treat all URL schemes as URLs.
+ Example: `['http', 'https', 'mailto']`
+
+## Development
+
+You can run the tests by running `tox` in the top-level of the project.
+
+We are working to expand test coverage,
+but this will at least test basic Python 2 and 3 compatability.
+
+## Why a bridge?
+
+Many python tools (mostly for documentation creation) rely on `docutils`.
+But [docutils][dc] only supports a ReStructuredText syntax.
+
+For instance [this issue][sphinx-issue] and [this StackOverflow
+question][so-question] show that there is an interest in allowing `docutils`
+to use markdown as an alternative syntax.
+
+## Why another bridge to docutils?
+
+recommonmark uses the [python implementation][pcm] of [CommonMark][cm] while
+[remarkdown][rmd] implements a stand-alone parser leveraging [parsley][prs].
+
+Both output a [`docutils` document tree][dc] and provide scripts
+that leverage `docutils` for generation of different types of documents.
+
+## Acknowledgement
+
+recommonmark is mainly derived from [remarkdown][rmd] by Steve Genoud and
+leverages the python CommonMark implementation.
+
+It was originally created by [Luca Barbato][lu-zero],
+and is now maintained in the Read the Docs (rtfd) GitHub organization.
+
+[cm]: http://commonmark.org
+[pcm]: https://github.com/rtfd/CommonMark-py
+[rmd]: https://github.com/sgenoud/remarkdown
+[prs]: https://github.com/python-parsley/parsley
+[lu-zero]: https://github.com/lu-zero
+
+[dc]: http://docutils.sourceforge.net/docs/ref/doctree.html
+[sphinx-issue]:
https://bitbucket.org/birkenfeld/sphinx/issue/825/markdown-capable-sphinx
+[so-question]:
http://stackoverflow.com/questions/2471804/using-sphinx-with-markdown-instead-of-rst
+[`autosectionlabel`]:
https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/prospector.yml
new/recommonmark-0.6.0/prospector.yml
--- old/recommonmark-0.5.0/prospector.yml 2019-01-08 22:45:59.000000000
+0100
+++ new/recommonmark-0.6.0/prospector.yml 1970-01-01 01:00:00.000000000
+0100
@@ -1,31 +0,0 @@
-strictness: medium
-
-test-warnings: false
-doc-warnings: true
-
-ignore-paths:
- - docs
-
-pep8:
- full: true
- options:
- max-line-length: 100
-
-pylint:
- options:
- max-line-length: 100
- docstring-min-length: 20
- disable:
- - interface-not-implemented
-
-mccabe:
- run: false
-
-pep257:
- run: true
- disable:
- - D213
- - D211
- - D107
- - D104
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/recommonmark/__init__.py
new/recommonmark-0.6.0/recommonmark/__init__.py
--- old/recommonmark-0.5.0/recommonmark/__init__.py 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark/__init__.py 2019-08-09
20:31:51.000000000 +0200
@@ -1,6 +1,6 @@
"""Docutils CommonMark parser"""
-__version__ = '0.5.0'
+__version__ = '0.6.0'
def setup(app):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/recommonmark/parser.py
new/recommonmark-0.6.0/recommonmark/parser.py
--- old/recommonmark-0.5.0/recommonmark/parser.py 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark/parser.py 2019-08-09
20:30:27.000000000 +0200
@@ -11,9 +11,9 @@
from warnings import warn
if sys.version_info < (3, 0):
- from urlparse import urlparse
+ from urlparse import urlparse, unquote
else:
- from urllib.parse import urlparse
+ from urllib.parse import urlparse, unquote
__all__ = ['CommonMarkParser']
@@ -25,12 +25,22 @@
supported = ('md', 'markdown')
translate_section_name = None
+ default_config = {
+ 'known_url_schemes': None,
+ }
+
def __init__(self):
self._level_to_elem = {}
def parse(self, inputstring, document):
self.document = document
self.current_node = document
+ self.config = self.default_config.copy()
+ try:
+ new_cfg = self.document.settings.env.config.recommonmark_config
+ self.config.update(new_cfg)
+ except AttributeError:
+ pass
self.setup_parse(inputstring, document)
self.setup_sections()
parser = Parser()
@@ -109,6 +119,9 @@
def visit_softbreak(self, _):
self.current_node.append(nodes.Text('\n'))
+ def visit_linebreak(self, _):
+ self.current_node.append(nodes.raw('', '<br />', format='html'))
+
def visit_paragraph(self, mdnode):
p = nodes.paragraph(mdnode.literal)
p.line = mdnode.sourcepos[0][0]
@@ -150,9 +163,18 @@
next_node = ref_node
url_check = urlparse(destination)
- if not url_check.scheme and not url_check.fragment:
+ # If there's not a url scheme (e.g. 'https' for 'https:...' links),
+ # or there is a scheme but it's not in the list of known_url_schemes,
+ # then assume it's a cross-reference and pass it to Sphinx as an
`:any:` ref.
+ known_url_schemes = self.config.get('known_url_schemes')
+ if known_url_schemes:
+ scheme_known = url_check.scheme in known_url_schemes
+ else:
+ scheme_known = bool(url_check.scheme)
+
+ if not url_check.fragment and not scheme_known:
wrap_node = addnodes.pending_xref(
- reftarget=destination,
+ reftarget=unquote(destination),
reftype='any',
refdomain=None, # Added to enable cross-linking
refexplicit=True,
@@ -178,8 +200,15 @@
img_node = nodes.image()
img_node['uri'] = mdnode.destination
- if mdnode.title:
- img_node['alt'] = mdnode.title
+ if mdnode.first_child and mdnode.first_child.literal:
+ content = [mdnode.first_child.literal]
+ n = mdnode.first_child
+ mdnode.first_child.literal = ''
+ mdnode.first_child = mdnode.last_child = None
+ while getattr(n, 'nxt'):
+ n.nxt, n = None, n.nxt
+ content.append(n.literal)
+ img_node['alt'] = ''.join(content)
self.current_node.append(img_node)
self.current_node = img_node
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/recommonmark/transform.py
new/recommonmark-0.6.0/recommonmark/transform.py
--- old/recommonmark-0.5.0/recommonmark/transform.py 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark/transform.py 2019-08-09
20:30:27.000000000 +0200
@@ -41,6 +41,7 @@
default_config = {
'enable_auto_doc_ref': False,
+ 'auto_toc_maxdepth': 1,
'auto_toc_tree_section': None,
'enable_auto_toc_tree': True,
'enable_eval_rst': True,
@@ -48,6 +49,7 @@
'enable_inline_math': True,
'commonmark_suffixes': ['.md'],
'url_resolver': lambda x: x,
+ 'known_url_schemes': None,
}
def parse_ref(self, ref):
@@ -179,7 +181,10 @@
self.current_level)
return self.state_machine.run_directive(
'toctree',
- options={'maxdepth': 1, 'numbered': numbered},
+ options={
+ 'maxdepth': self.config['auto_toc_maxdepth'],
+ 'numbered': numbered,
+ },
content=['%s <%s>' % (k, v) for k, v in refs])
def auto_inline_code(self, node):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/recommonmark.egg-info/PKG-INFO
new/recommonmark-0.6.0/recommonmark.egg-info/PKG-INFO
--- old/recommonmark-0.5.0/recommonmark.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark.egg-info/PKG-INFO 2019-08-09
20:32:27.000000000 +0200
@@ -0,0 +1,11 @@
+Metadata-Version: 1.1
+Name: recommonmark
+Version: 0.6.0
+Summary: A docutils-compatibility bridge to CommonMark, enabling you to write
CommonMark inside of Docutils & Sphinx projects.
+Home-page: https://github.com/rtfd/recommonmark
+Author: UNKNOWN
+Author-email: UNKNOWN
+License: MIT
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: License :: OSI Approved :: MIT License
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/recommonmark.egg-info/SOURCES.txt
new/recommonmark-0.6.0/recommonmark.egg-info/SOURCES.txt
--- old/recommonmark-0.5.0/recommonmark.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark.egg-info/SOURCES.txt 2019-08-09
20:32:27.000000000 +0200
@@ -0,0 +1,46 @@
+CHANGELOG.md
+MANIFEST.in
+README.md
+license.md
+setup.cfg
+setup.py
+docs/Makefile
+docs/api_ref.md
+docs/auto_structify.md
+docs/conf.py
+docs/index.md
+recommonmark/__init__.py
+recommonmark/parser.py
+recommonmark/scripts.py
+recommonmark/states.py
+recommonmark/transform.py
+recommonmark.egg-info/PKG-INFO
+recommonmark.egg-info/SOURCES.txt
+recommonmark.egg-info/dependency_links.txt
+recommonmark.egg-info/entry_points.txt
+recommonmark.egg-info/requires.txt
+recommonmark.egg-info/top_level.txt
+tests/__init__.py
+tests/__init__.pyc
+tests/test_basic.py
+tests/test_sphinx.py
+tests/__pycache__/__init__.cpython-34.pyc
+tests/__pycache__/__init__.cpython-36.pyc
+tests/__pycache__/test_basic.cpython-27-PYTEST.pyc
+tests/__pycache__/test_basic.cpython-34-PYTEST.pyc
+tests/__pycache__/test_basic.cpython-36-PYTEST.pyc
+tests/__pycache__/test_sphinx.cpython-27-PYTEST.pyc
+tests/__pycache__/test_sphinx.cpython-36-PYTEST.pyc
+tests/sphinx_code_block/conf.py
+tests/sphinx_code_block/index.md
+tests/sphinx_custom_md/conf.py
+tests/sphinx_custom_md/index.markdown
+tests/sphinx_generic/conf.py
+tests/sphinx_generic/index.md
+tests/sphinx_indented_code/conf.py
+tests/sphinx_indented_code/index.md
+tests/sphinx_nested_header_block/conf.py
+tests/sphinx_nested_header_block/index.md
+tests/sphinx_xref/conf.py
+tests/sphinx_xref/index.md
+tests/sphinx_xref/link.md
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/recommonmark-0.5.0/recommonmark.egg-info/dependency_links.txt
new/recommonmark-0.6.0/recommonmark.egg-info/dependency_links.txt
--- old/recommonmark-0.5.0/recommonmark.egg-info/dependency_links.txt
1970-01-01 01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark.egg-info/dependency_links.txt
2019-08-09 20:32:27.000000000 +0200
@@ -0,0 +1 @@
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/recommonmark-0.5.0/recommonmark.egg-info/entry_points.txt
new/recommonmark-0.6.0/recommonmark.egg-info/entry_points.txt
--- old/recommonmark-0.5.0/recommonmark.egg-info/entry_points.txt
1970-01-01 01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark.egg-info/entry_points.txt
2019-08-09 20:32:27.000000000 +0200
@@ -0,0 +1,8 @@
+[console_scripts]
+cm2html = recommonmark.scripts:cm2html
+cm2latex = recommonmark.scripts:cm2latex
+cm2man = recommonmark.scripts:cm2man
+cm2pseudoxml = recommonmark.scripts:cm2pseudoxml
+cm2xetex = recommonmark.scripts:cm2xetex
+cm2xml = recommonmark.scripts:cm2xml
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/recommonmark-0.5.0/recommonmark.egg-info/requires.txt
new/recommonmark-0.6.0/recommonmark.egg-info/requires.txt
--- old/recommonmark-0.5.0/recommonmark.egg-info/requires.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark.egg-info/requires.txt 2019-08-09
20:32:27.000000000 +0200
@@ -0,0 +1,3 @@
+commonmark>=0.8.1
+docutils>=0.11
+sphinx>=1.3.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/recommonmark-0.5.0/recommonmark.egg-info/top_level.txt
new/recommonmark-0.6.0/recommonmark.egg-info/top_level.txt
--- old/recommonmark-0.5.0/recommonmark.egg-info/top_level.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/recommonmark-0.6.0/recommonmark.egg-info/top_level.txt 2019-08-09
20:32:27.000000000 +0200
@@ -0,0 +1 @@
+recommonmark
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/setup.cfg
new/recommonmark-0.6.0/setup.cfg
--- old/recommonmark-0.5.0/setup.cfg 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/setup.cfg 2019-08-09 20:32:27.000000000 +0200
@@ -1,2 +1,15 @@
[bdist_wheel]
-universal=1
+universal = 1
+
+[metadata]
+name = recommonmark
+version = 0.6.0
+
+[tool:release]
+github_owner = readthedocs
+github_repo = recommonmark
+
+[egg_info]
+tag_build =
+tag_date = 0
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/setup.py
new/recommonmark-0.6.0/setup.py
--- old/recommonmark-0.5.0/setup.py 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/setup.py 2019-08-09 20:09:15.000000000 +0200
@@ -23,7 +23,7 @@
'License :: OSI Approved :: MIT License',
],
install_requires=[
- 'commonmark>=0.7.3',
+ 'commonmark>=0.8.1',
'docutils>=0.11',
'sphinx>=1.3.1',
],
Binary files old/recommonmark-0.5.0/tests/__init__.pyc and
new/recommonmark-0.6.0/tests/__init__.pyc differ
Binary files old/recommonmark-0.5.0/tests/__pycache__/__init__.cpython-34.pyc
and new/recommonmark-0.6.0/tests/__pycache__/__init__.cpython-34.pyc differ
Binary files old/recommonmark-0.5.0/tests/__pycache__/__init__.cpython-36.pyc
and new/recommonmark-0.6.0/tests/__pycache__/__init__.cpython-36.pyc differ
Binary files
old/recommonmark-0.5.0/tests/__pycache__/test_basic.cpython-27-PYTEST.pyc and
new/recommonmark-0.6.0/tests/__pycache__/test_basic.cpython-27-PYTEST.pyc differ
Binary files
old/recommonmark-0.5.0/tests/__pycache__/test_basic.cpython-34-PYTEST.pyc and
new/recommonmark-0.6.0/tests/__pycache__/test_basic.cpython-34-PYTEST.pyc differ
Binary files
old/recommonmark-0.5.0/tests/__pycache__/test_basic.cpython-36-PYTEST.pyc and
new/recommonmark-0.6.0/tests/__pycache__/test_basic.cpython-36-PYTEST.pyc differ
Binary files
old/recommonmark-0.5.0/tests/__pycache__/test_sphinx.cpython-27-PYTEST.pyc and
new/recommonmark-0.6.0/tests/__pycache__/test_sphinx.cpython-27-PYTEST.pyc
differ
Binary files
old/recommonmark-0.5.0/tests/__pycache__/test_sphinx.cpython-36-PYTEST.pyc and
new/recommonmark-0.6.0/tests/__pycache__/test_sphinx.cpython-36-PYTEST.pyc
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tests/sphinx_generic/index.md
new/recommonmark-0.6.0/tests/sphinx_generic/index.md
--- old/recommonmark-0.5.0/tests/sphinx_generic/index.md 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/tests/sphinx_generic/index.md 2019-08-09
20:09:15.000000000 +0200
@@ -23,7 +23,7 @@
Bar
-
+
#!/bin/sh
python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tests/sphinx_xref/conf.py
new/recommonmark-0.6.0/tests/sphinx_xref/conf.py
--- old/recommonmark-0.5.0/tests/sphinx_xref/conf.py 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/tests/sphinx_xref/conf.py 2019-08-09
20:09:15.000000000 +0200
@@ -3,6 +3,9 @@
from recommonmark.parser import CommonMarkParser
+extensions = 'sphinx.ext.autosectionlabel']
+autosectionlabel_prefix_document = True
+
templates_path = ['_templates']
source_suffix = '.md'
source_parsers = { '.md': CommonMarkParser }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tests/sphinx_xref/index.md
new/recommonmark-0.6.0/tests/sphinx_xref/index.md
--- old/recommonmark-0.5.0/tests/sphinx_xref/index.md 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/tests/sphinx_xref/index.md 2019-08-09
20:09:15.000000000 +0200
@@ -3,3 +3,7 @@
A paragraph [link](link) and [absolute link](/link). An [external
link](http://www.google.com).
+A [ref with spaces][].
+
+
+[ref with spaces]: <link:Section 1>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tests/sphinx_xref/link.md
new/recommonmark-0.6.0/tests/sphinx_xref/link.md
--- old/recommonmark-0.5.0/tests/sphinx_xref/link.md 2019-01-08
22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/tests/sphinx_xref/link.md 2019-08-09
20:09:15.000000000 +0200
@@ -2,3 +2,7 @@
====
The link file.
+
+## Section 1
+
+Autosectionlabel will generate a link for this heading at `link:Section 1`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tests/test_basic.py
new/recommonmark-0.6.0/tests/test_basic.py
--- old/recommonmark-0.5.0/tests/test_basic.py 2019-01-08 22:45:59.000000000
+0100
+++ new/recommonmark-0.6.0/tests/test_basic.py 2019-08-09 20:30:27.000000000
+0200
@@ -17,6 +17,7 @@
def assertParses(self, source, expected, alt=False): # noqa
parser = CommonMarkParser()
parser.parse(dedent(source), new_document('<string>'))
+ self.maxDiff = None
self.assertMultiLineEqual(
dedent(expected).lstrip(),
dedent(parser.document.asdom().toprettyxml(indent=' ')),
@@ -223,16 +224,56 @@
"""
)
+ def test_known_schemes(self):
+ self.assertParses(
+ """
+ [https link](https://example.com)
+ [http link](http://example.com)
+ [mailto link](mailto:[email protected])
+ [custom scheme](custom:example.com)
+ [ref link](path/to/file:heading)
+ [ref link with spaces](<path/to/file:heading with spaces>)
+ """,
+ """
+ <?xml version="1.0" ?>
+ <document source="<string>">
+ <paragraph>
+ <reference refuri="https://example.com">https link</reference>
+
+
+ <reference refuri="http://example.com">http link</reference>
+
+
+ <reference refuri="mailto:[email protected]">mailto
link</reference>
+
+
+ <reference refuri="custom:example.com">custom
scheme</reference>
+
+
+ <pending_xref refdomain="None" refexplicit="True"
reftarget="path/to/file:heading" reftype="any" refwarn="True">
+ <reference refuri="path/to/file:heading">ref link</reference>
+ </pending_xref>
+
+
+ <pending_xref refdomain="None" refexplicit="True"
reftarget="path/to/file:heading with spaces" reftype="any" refwarn="True">
+ <reference refuri="path/to/file:heading%20with%20spaces">ref
link with spaces</reference>
+ </pending_xref>
+ </paragraph>
+ </document>
+ """
+ )
+ pass
+
def test_image(self):
self.assertParses(
"""
- 
+ 
""",
"""
<?xml version="1.0" ?>
<document source="<string>">
<paragraph>
- <image alt="title" uri="/url">foo</image>
+ <image alt="foo "handle quotes"" uri="/url"></image>
</paragraph>
</document>
"""
@@ -458,6 +499,24 @@
</document>
"""
)
+
+ def test_linebreak(self):
+ self.assertParses(
+ """
+ line1
+ line2
+ """,
+ """
+ <?xml version="1.0" ?>
+ <document source="<string>">
+ <paragraph>
+ line1
+ <raw format="html" xml:space="preserve"><br /></raw>
+ line2
+ </paragraph>
+ </document>
+ """
+ )
if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tests/test_sphinx.py
new/recommonmark-0.6.0/tests/test_sphinx.py
--- old/recommonmark-0.5.0/tests/test_sphinx.py 2019-01-08 22:45:59.000000000
+0100
+++ new/recommonmark-0.6.0/tests/test_sphinx.py 2019-08-09 20:09:15.000000000
+0200
@@ -129,7 +129,7 @@
def test_image(self):
output = self.read_file('index.html')
self.assertIn(
- '<p><img alt="Example" src="image.png" />foo</p>',
+ '<p><img alt="foo "handle quotes"" src="image.png"
/></p>',
output
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/recommonmark-0.5.0/tox.ini
new/recommonmark-0.6.0/tox.ini
--- old/recommonmark-0.5.0/tox.ini 2019-01-08 22:45:59.000000000 +0100
+++ new/recommonmark-0.6.0/tox.ini 1970-01-01 01:00:00.000000000 +0100
@@ -1,41 +0,0 @@
-[tox]
-envlist =
- py{27,35,36}-sphinx{16,17,18},
- # Workaround https://github.com/tox-dev/tox/issues/706
- lint-sphinx18
- docs-sphinx18
-
-[tox:travis]
-2.7 = py27-sphinx{16,17,18}, docs-sphinx16, lint-sphinx16
-3.5 = py35-sphinx{16,17,18}
-3.6 = py36-sphinx{16,17,18}
-
-[testenv]
-setenv =
- LANG=C
-deps =
- .
- pytest
- sphinx16: Sphinx < 1.7
- sphinx17: Sphinx < 1.8
- sphinx18: Sphinx < 1.9
-commands =
- py.test {posargs}
-
-[testenv:docs]
-deps =
- {[testenv]deps}
- sphinx_rtd_theme
-changedir = {toxinidir}/docs
-commands =
- sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
-
-[testenv:lint]
-deps =
- {[testenv]deps}
- prospector
-commands =
- prospector \
- --profile-path={toxinidir} \
- --profile=prospector \
- --die-on-tool-error