diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 17:46:28 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 17:46:28 +0000 |
| commit | 2f81ff881a632d0fb21dc9ae372770725c3f478a (patch) | |
| tree | 5d8595b5b96b3140f8f6f7b9f1bb6e8b9a68dc0b | |
| parent | bc2039bc312962165bdfe736c9cdba3a56603331 (diff) | |
automatic import of python-prettierfier
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-prettierfier.spec | 354 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 356 insertions, 0 deletions
@@ -0,0 +1 @@ +/prettierfier-1.0.3.tar.gz diff --git a/python-prettierfier.spec b/python-prettierfier.spec new file mode 100644 index 0000000..2a3d1c5 --- /dev/null +++ b/python-prettierfier.spec @@ -0,0 +1,354 @@ +%global _empty_manifest_terminate_build 0 +Name: python-prettierfier +Version: 1.0.3 +Release: 1 +Summary: Intelligently pretty-print HTML/XML with inline tags. +License: MIT +URL: https://github.com/annedo/prettierfier +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3a/80/c1bb6cb21ef8a7b228394c8fdadec6c064074852c3374a4204285d9e3f11/prettierfier-1.0.3.tar.gz +BuildArch: noarch + + +%description +# prettierfier +While I love [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) as a parser, `BeautifulSoup.prettify()` adds a linebreak between *every* tag. +This results in unwanted white space between tags that should be inline, like `<sup>`, `<a>`, `<span>`, etc: + +``` +<p>Introducing GitHub<sup>®</sup></p> +``` +<p>Introducing GitHub<sup>®</sup></p> + +vs. + +``` +<p> + Introducing GitHub + <sup> + ® + </sup> +</p> +``` +<p> + Introducing GitHub + <sup> + ® + </sup> +</p> + +This module parses HTML/XML as a raw string to more intelligently format tags. + +## Installation + +You have two options: +1. `pip install prettierfier` in your command line +2. Copy the contents of [prettierfier.py](prettierfier.py) to your own module. + +This module is built with just the Python Standard Library and contains no external third-party dependencies. + +## Functions + +**prettify_xml**(*xml_string, indent=2, debug=False*) + +* Can be used with no prior formatting. + +``` + Args: + xml_string (str): XML text to prettify. + indent (int, optional): Set size of XML tag indents. + + Test-only args: + debug (bool, optional): Show results of each regexp application. + + Returns: + str: Prettified XML. +``` + +**prettify_html**(*html_string, debug=False*) + +* Originally created to process `BeautifulSoup.prettify()` output. +* Does not add or remove regular line breaks. Can be used with regular HTML if it already has the newlines you want to keep. + +``` + Args: + html_string (str): HTML string to parse. + + Test-only args: + debug (bool, optional): Show results of each regexp application. + + Returns: + str: Prettified HTML. +``` + +## Example + +``` +import prettierfier + +ugly_html = """<p> + Introducing GitHub + <sup> + ® + </sup> +</p>""" + +pretty_html = prettierfier.prettify_html(ugly_html) +print(pretty_html) + +# Output +>>> <p>Introducing GitHub<sup>®</sup></p> +``` + +### Links + +* [GitHub](https://github.com/annedo/prettierfier) +* [PyPi](https://pypi.org/project/prettierfier/) + + + +%package -n python3-prettierfier +Summary: Intelligently pretty-print HTML/XML with inline tags. +Provides: python-prettierfier +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-prettierfier +# prettierfier +While I love [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) as a parser, `BeautifulSoup.prettify()` adds a linebreak between *every* tag. +This results in unwanted white space between tags that should be inline, like `<sup>`, `<a>`, `<span>`, etc: + +``` +<p>Introducing GitHub<sup>®</sup></p> +``` +<p>Introducing GitHub<sup>®</sup></p> + +vs. + +``` +<p> + Introducing GitHub + <sup> + ® + </sup> +</p> +``` +<p> + Introducing GitHub + <sup> + ® + </sup> +</p> + +This module parses HTML/XML as a raw string to more intelligently format tags. + +## Installation + +You have two options: +1. `pip install prettierfier` in your command line +2. Copy the contents of [prettierfier.py](prettierfier.py) to your own module. + +This module is built with just the Python Standard Library and contains no external third-party dependencies. + +## Functions + +**prettify_xml**(*xml_string, indent=2, debug=False*) + +* Can be used with no prior formatting. + +``` + Args: + xml_string (str): XML text to prettify. + indent (int, optional): Set size of XML tag indents. + + Test-only args: + debug (bool, optional): Show results of each regexp application. + + Returns: + str: Prettified XML. +``` + +**prettify_html**(*html_string, debug=False*) + +* Originally created to process `BeautifulSoup.prettify()` output. +* Does not add or remove regular line breaks. Can be used with regular HTML if it already has the newlines you want to keep. + +``` + Args: + html_string (str): HTML string to parse. + + Test-only args: + debug (bool, optional): Show results of each regexp application. + + Returns: + str: Prettified HTML. +``` + +## Example + +``` +import prettierfier + +ugly_html = """<p> + Introducing GitHub + <sup> + ® + </sup> +</p>""" + +pretty_html = prettierfier.prettify_html(ugly_html) +print(pretty_html) + +# Output +>>> <p>Introducing GitHub<sup>®</sup></p> +``` + +### Links + +* [GitHub](https://github.com/annedo/prettierfier) +* [PyPi](https://pypi.org/project/prettierfier/) + + + +%package help +Summary: Development documents and examples for prettierfier +Provides: python3-prettierfier-doc +%description help +# prettierfier +While I love [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) as a parser, `BeautifulSoup.prettify()` adds a linebreak between *every* tag. +This results in unwanted white space between tags that should be inline, like `<sup>`, `<a>`, `<span>`, etc: + +``` +<p>Introducing GitHub<sup>®</sup></p> +``` +<p>Introducing GitHub<sup>®</sup></p> + +vs. + +``` +<p> + Introducing GitHub + <sup> + ® + </sup> +</p> +``` +<p> + Introducing GitHub + <sup> + ® + </sup> +</p> + +This module parses HTML/XML as a raw string to more intelligently format tags. + +## Installation + +You have two options: +1. `pip install prettierfier` in your command line +2. Copy the contents of [prettierfier.py](prettierfier.py) to your own module. + +This module is built with just the Python Standard Library and contains no external third-party dependencies. + +## Functions + +**prettify_xml**(*xml_string, indent=2, debug=False*) + +* Can be used with no prior formatting. + +``` + Args: + xml_string (str): XML text to prettify. + indent (int, optional): Set size of XML tag indents. + + Test-only args: + debug (bool, optional): Show results of each regexp application. + + Returns: + str: Prettified XML. +``` + +**prettify_html**(*html_string, debug=False*) + +* Originally created to process `BeautifulSoup.prettify()` output. +* Does not add or remove regular line breaks. Can be used with regular HTML if it already has the newlines you want to keep. + +``` + Args: + html_string (str): HTML string to parse. + + Test-only args: + debug (bool, optional): Show results of each regexp application. + + Returns: + str: Prettified HTML. +``` + +## Example + +``` +import prettierfier + +ugly_html = """<p> + Introducing GitHub + <sup> + ® + </sup> +</p>""" + +pretty_html = prettierfier.prettify_html(ugly_html) +print(pretty_html) + +# Output +>>> <p>Introducing GitHub<sup>®</sup></p> +``` + +### Links + +* [GitHub](https://github.com/annedo/prettierfier) +* [PyPi](https://pypi.org/project/prettierfier/) + + + +%prep +%autosetup -n prettierfier-1.0.3 + +%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-prettierfier -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.3-1 +- Package Spec generated @@ -0,0 +1 @@ +01b2ddddef23b44bc91c5519382a99ef prettierfier-1.0.3.tar.gz |
