diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-15 06:16:53 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-15 06:16:53 +0000 |
commit | ece2ced52f0faabd06b12d1aa6cbff1c8f837ea5 (patch) | |
tree | fee38357ba7e787020afc57d72c8e020a2dfe8da | |
parent | 925e9b74aa1e6f84b50e592dac443a56357cf972 (diff) |
automatic import of python-mdx-linkify
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-mdx-linkify.spec | 399 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 401 insertions, 0 deletions
@@ -0,0 +1 @@ +/mdx_linkify-2.1.tar.gz diff --git a/python-mdx-linkify.spec b/python-mdx-linkify.spec new file mode 100644 index 0000000..5fea5ee --- /dev/null +++ b/python-mdx-linkify.spec @@ -0,0 +1,399 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mdx-linkify +Version: 2.1 +Release: 1 +Summary: Link recognition for Python Markdown +License: MIT +URL: https://github.com/daGrevis/mdx_linkify +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/03/9a/d07599b2e3487d4fa6dca76ecf80ae3d51d135c107d7ead09509a88ecc1d/mdx_linkify-2.1.tar.gz +BuildArch: noarch + + +%description +# Mdx Linkify + +[](https://travis-ci.org/daGrevis/mdx_linkify) +[](https://coveralls.io/r/daGrevis/mdx_linkify?branch=master) +[](https://pypi.python.org/pypi/mdx_linkify) +[](https://pypi.python.org/pypi/mdx_linkify) + +This extension for [Python Markdown](https://github.com/waylan/Python-Markdown) +will convert text that look like links to HTML anchors. + +There's an alternative package that serves the same purpose called +[`markdown-urlize`](https://github.com/r0wb0t/markdown-urlize). The main +difference is that [`mdx_linkify`](https://github.com/daGrevis/mdx_linkify) is +utilizing the excellent [`bleach`](https://github.com/jsocol/bleach) for +searching links in text. :clap: + +## Usage + +### Minimal Example + +```python +from markdown import markdown + +markdown("minimal http://example.org/", extensions=["mdx_linkify"]) +# Returns '<p>minimal <a href="http://example.org/">http://example.org/</a></p>' +``` + +## Installation + +The project is [on PyPI](https://pypi.python.org/pypi/mdx_linkify)! + + pip install mdx_linkify + +If you want the bleeding-edge version (this includes unreleased-to-PyPI code), +you can always grab the master branch directly from Git. + + pip install git+git://github.com/daGrevis/mdx_linkify.git + +### Configuring Linker + +To configure used Linker instance, use `linker_options` parameter. It will be passed to [`bleach.linkifier.Linker`](https://bleach.readthedocs.io/en/latest/linkify.html#using-bleach-linkifier-linker) unchanged. + + +#### Example: Parse Emails + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from markdown import Markdown + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"parse_email": True})], +) + +assert md.convert('contact@example.com'), '<p><a href="mailto:contact@example.com">contact@example.com</a></p>' +``` + +#### Example: Custom TLDs + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from bleach.linkifier import build_url_re +from markdown import Markdown + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"url_re": build_url_re(["custom", "custom2"])})], +) + +assert md.convert('linked.custom'), '<p><a href="http://linked.custom">linked.custom</a></p>' +``` + +#### Example: Ignoring TLDs + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from markdown import Markdown + +def dont_linkify_net_tld(attrs, new=False): + if attrs["_text"].endswith(".net"): + return None + + return attrs + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"callbacks": [dont_linkify_net_tld]})], +) + +assert md.convert("not-linked.net"), '<p>not-linked.net</p>' +``` + +## Development + +``` +git clone git@github.com:daGrevis/mdx_linkify.git +virtualenv mdx_linkify/ +cd mdx_linkify/ +source bin/activate +python setup.py install +python setup.py test +``` + +Pull requests are much welcome! :+1: + +## Releasing + +_(more like a cheatsheet for me actually)_ + +- Change version in `setup.py`, +- Commit and tag it, +- Push it (including tag), +- Run `python setup.py register && python setup.py sdist upload`; + +%package -n python3-mdx-linkify +Summary: Link recognition for Python Markdown +Provides: python-mdx-linkify +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mdx-linkify +# Mdx Linkify + +[](https://travis-ci.org/daGrevis/mdx_linkify) +[](https://coveralls.io/r/daGrevis/mdx_linkify?branch=master) +[](https://pypi.python.org/pypi/mdx_linkify) +[](https://pypi.python.org/pypi/mdx_linkify) + +This extension for [Python Markdown](https://github.com/waylan/Python-Markdown) +will convert text that look like links to HTML anchors. + +There's an alternative package that serves the same purpose called +[`markdown-urlize`](https://github.com/r0wb0t/markdown-urlize). The main +difference is that [`mdx_linkify`](https://github.com/daGrevis/mdx_linkify) is +utilizing the excellent [`bleach`](https://github.com/jsocol/bleach) for +searching links in text. :clap: + +## Usage + +### Minimal Example + +```python +from markdown import markdown + +markdown("minimal http://example.org/", extensions=["mdx_linkify"]) +# Returns '<p>minimal <a href="http://example.org/">http://example.org/</a></p>' +``` + +## Installation + +The project is [on PyPI](https://pypi.python.org/pypi/mdx_linkify)! + + pip install mdx_linkify + +If you want the bleeding-edge version (this includes unreleased-to-PyPI code), +you can always grab the master branch directly from Git. + + pip install git+git://github.com/daGrevis/mdx_linkify.git + +### Configuring Linker + +To configure used Linker instance, use `linker_options` parameter. It will be passed to [`bleach.linkifier.Linker`](https://bleach.readthedocs.io/en/latest/linkify.html#using-bleach-linkifier-linker) unchanged. + + +#### Example: Parse Emails + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from markdown import Markdown + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"parse_email": True})], +) + +assert md.convert('contact@example.com'), '<p><a href="mailto:contact@example.com">contact@example.com</a></p>' +``` + +#### Example: Custom TLDs + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from bleach.linkifier import build_url_re +from markdown import Markdown + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"url_re": build_url_re(["custom", "custom2"])})], +) + +assert md.convert('linked.custom'), '<p><a href="http://linked.custom">linked.custom</a></p>' +``` + +#### Example: Ignoring TLDs + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from markdown import Markdown + +def dont_linkify_net_tld(attrs, new=False): + if attrs["_text"].endswith(".net"): + return None + + return attrs + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"callbacks": [dont_linkify_net_tld]})], +) + +assert md.convert("not-linked.net"), '<p>not-linked.net</p>' +``` + +## Development + +``` +git clone git@github.com:daGrevis/mdx_linkify.git +virtualenv mdx_linkify/ +cd mdx_linkify/ +source bin/activate +python setup.py install +python setup.py test +``` + +Pull requests are much welcome! :+1: + +## Releasing + +_(more like a cheatsheet for me actually)_ + +- Change version in `setup.py`, +- Commit and tag it, +- Push it (including tag), +- Run `python setup.py register && python setup.py sdist upload`; + +%package help +Summary: Development documents and examples for mdx-linkify +Provides: python3-mdx-linkify-doc +%description help +# Mdx Linkify + +[](https://travis-ci.org/daGrevis/mdx_linkify) +[](https://coveralls.io/r/daGrevis/mdx_linkify?branch=master) +[](https://pypi.python.org/pypi/mdx_linkify) +[](https://pypi.python.org/pypi/mdx_linkify) + +This extension for [Python Markdown](https://github.com/waylan/Python-Markdown) +will convert text that look like links to HTML anchors. + +There's an alternative package that serves the same purpose called +[`markdown-urlize`](https://github.com/r0wb0t/markdown-urlize). The main +difference is that [`mdx_linkify`](https://github.com/daGrevis/mdx_linkify) is +utilizing the excellent [`bleach`](https://github.com/jsocol/bleach) for +searching links in text. :clap: + +## Usage + +### Minimal Example + +```python +from markdown import markdown + +markdown("minimal http://example.org/", extensions=["mdx_linkify"]) +# Returns '<p>minimal <a href="http://example.org/">http://example.org/</a></p>' +``` + +## Installation + +The project is [on PyPI](https://pypi.python.org/pypi/mdx_linkify)! + + pip install mdx_linkify + +If you want the bleeding-edge version (this includes unreleased-to-PyPI code), +you can always grab the master branch directly from Git. + + pip install git+git://github.com/daGrevis/mdx_linkify.git + +### Configuring Linker + +To configure used Linker instance, use `linker_options` parameter. It will be passed to [`bleach.linkifier.Linker`](https://bleach.readthedocs.io/en/latest/linkify.html#using-bleach-linkifier-linker) unchanged. + + +#### Example: Parse Emails + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from markdown import Markdown + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"parse_email": True})], +) + +assert md.convert('contact@example.com'), '<p><a href="mailto:contact@example.com">contact@example.com</a></p>' +``` + +#### Example: Custom TLDs + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from bleach.linkifier import build_url_re +from markdown import Markdown + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"url_re": build_url_re(["custom", "custom2"])})], +) + +assert md.convert('linked.custom'), '<p><a href="http://linked.custom">linked.custom</a></p>' +``` + +#### Example: Ignoring TLDs + +```python +from mdx_linkify.mdx_linkify import LinkifyExtension +from markdown import Markdown + +def dont_linkify_net_tld(attrs, new=False): + if attrs["_text"].endswith(".net"): + return None + + return attrs + +md = Markdown( + extensions=[LinkifyExtension(linker_options={"callbacks": [dont_linkify_net_tld]})], +) + +assert md.convert("not-linked.net"), '<p>not-linked.net</p>' +``` + +## Development + +``` +git clone git@github.com:daGrevis/mdx_linkify.git +virtualenv mdx_linkify/ +cd mdx_linkify/ +source bin/activate +python setup.py install +python setup.py test +``` + +Pull requests are much welcome! :+1: + +## Releasing + +_(more like a cheatsheet for me actually)_ + +- Change version in `setup.py`, +- Commit and tag it, +- Push it (including tag), +- Run `python setup.py register && python setup.py sdist upload`; + +%prep +%autosetup -n mdx-linkify-2.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-mdx-linkify -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 2.1-1 +- Package Spec generated @@ -0,0 +1 @@ +f32c7dd45524cdba923a68e58ee0f763 mdx_linkify-2.1.tar.gz |