From e11fe9948609dfa8e9b9340e9e5157889d163712 Mon Sep 17 00:00:00 2001 From: Nikola Forró Date: May 25 2017 15:32:57 +0000 Subject: Initial import (#1452126) --- diff --git a/.gitignore b/.gitignore index e69de29..c4ddb01 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/m2r-539a0794236ad25d03bab717c2cc5555d3b098de.tar.gz diff --git a/fix-image_link-regex.patch b/fix-image_link-regex.patch new file mode 100644 index 0000000..beef640 --- /dev/null +++ b/fix-image_link-regex.patch @@ -0,0 +1,33 @@ +From d649fc4dd4e20234404884a59a556e5a3793505b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= +Date: Wed, 17 May 2017 10:06:52 +0200 +Subject: [PATCH] Make image_link regex non-greedy +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In case there is more than one image link on the same line, +the original regex would consume all of them. +Fix that. + +Signed-off-by: Nikola Forró +--- + m2r.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/m2r.py b/m2r.py +index 80bc037..315773d 100644 +--- a/m2r.py ++++ b/m2r.py +@@ -80,7 +80,7 @@ class RestBlockLexer(mistune.BlockLexer): + + class RestInlineGrammar(mistune.InlineGrammar): + image_link = re.compile( +- r'\[!\[(?P.*?)\]\((?P.*?)\).*\]\((?P.*?)\)' ++ r'\[!\[(?P.*?)\]\((?P.*?)\).*?\]\((?P.*?)\)' + ) + rest_role = re.compile(r':.*?:`.*?`|`[^`]+`:.*?:') + rest_link = re.compile(r'`[^`]*?`_') +-- +2.7.4 + diff --git a/python-m2r.spec b/python-m2r.spec new file mode 100644 index 0000000..4d338a8 --- /dev/null +++ b/python-m2r.spec @@ -0,0 +1,106 @@ +%global github_name m2r +%global commit 539a0794236ad25d03bab717c2cc5555d3b098de +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global desc M2R converts a markdown file including reST markups to a valid reST format. + +Name: python-%{github_name} +Version: 0.1.5 +Release: 2.git%{shortcommit}%{?dist} +Summary: Markdown to reStructuredText converter + +License: MIT +URL: https://github.com/miyakogi/%{github_name} +Source0: https://github.com/miyakogi/%{github_name}/archive/%{commit}/%{github_name}-%{commit}.tar.gz + +# https://github.com/miyakogi/m2r/pull/3 +Patch0: fix-image_link-regex.patch + +BuildArch: noarch + + +%description +%{desc} + + +%package -n python2-%{github_name} +BuildRequires: python2-devel +BuildRequires: python-docutils +BuildRequires: python-mistune +BuildRequires: python-pygments +BuildRequires: python2-mock +Requires: python-docutils +Requires: python-mistune +Summary: %{summary} +%{?python_provide:%python_provide python2-%{github_name}} + + +%description -n python2-%{github_name} +%{desc} + + +%package -n python3-%{github_name} +BuildRequires: python3-devel +BuildRequires: python3-docutils +BuildRequires: python3-mistune +BuildRequires: python3-pygments +BuildRequires: python3-mock +Requires: python3-docutils +Requires: python3-mistune +Summary: %{summary} +%{?python_provide:%python_provide python3-%{github_name}} + + +%description -n python3-%{github_name} +%{desc} + + +%prep +%setup -qn %{github_name}-%{commit} +%patch0 -p1 + +# Remove upstream's egg-info +rm -rf %{github_name}.egg-info + +# Remove shebang +sed -i '1{\@^#!/usr/bin/env python@d}' m2r.py + + +%build +%py2_build +%py3_build + + +%install +%py2_install +%py3_install + + +%check +PYTHONPATH=$(pwd) %{__python2} setup.py test -s tests +PYTHONPATH=$(pwd) %{__python3} setup.py test -s tests + + +%files -n python2-%{github_name} +%license LICENSE +%doc README.md +%{python2_sitelib}/%{github_name}.py{,c,o} +%{python2_sitelib}/%{github_name}-%{version}*-py%{python2_version}.egg-info +%exclude %{python2_sitelib}/tests + + +%files -n python3-%{github_name} +%license LICENSE +%doc README.md +%{_bindir}/m2r +%{python3_sitelib}/__pycache__/* +%{python3_sitelib}/%{github_name}.py +%{python3_sitelib}/%{github_name}-%{version}*-py%{python3_version}.egg-info +%exclude %{python3_sitelib}/tests + + +%changelog +* Wed May 17 2017 Nikola Forró - 0.1.5-2.git539a079 +- Make image_link regex non-greedy + +* Tue May 16 2017 Nikola Forró - 0.1.5-1.git539a079 +- Initial package diff --git a/sources b/sources index e69de29..d1047f6 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (m2r-539a0794236ad25d03bab717c2cc5555d3b098de.tar.gz) = 7e7ffeca35733b92daba8f01e80171da5a54508a4ed6a31ce9c846f764e439c882cd7eb3b2c1a0f9d1248ffee70f3de2059fcb54ec4817729d07f3b18d523dcb