forked from pool/python-pytidylib
76 lines
2.6 KiB
RPMSpec
76 lines
2.6 KiB
RPMSpec
|
#
|
||
|
# spec file for package python-pytidylib
|
||
|
#
|
||
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||
|
#
|
||
|
# All modifications and additions to the file contributed by third parties
|
||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||
|
# upon. The license for this file, and modifications and additions to the
|
||
|
# file, is the same license as for the pristine package itself (unless the
|
||
|
# license for the pristine package is not an Open Source License, in which
|
||
|
# case the license is the MIT License). An "Open Source License" is a
|
||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||
|
# published by the Open Source Initiative.
|
||
|
|
||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||
|
#
|
||
|
|
||
|
|
||
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
||
|
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||
|
%else
|
||
|
BuildArch: noarch
|
||
|
%endif
|
||
|
Name: python-pytidylib
|
||
|
Version: 0.2.4
|
||
|
Release: 0
|
||
|
Summary: Python wrapper for HTML Tidy (tidylib) on Python 2 and 3
|
||
|
License: MIT
|
||
|
Group: Development/Languages/Python
|
||
|
Url: http://countergram.com/open-source/pytidylib/
|
||
|
Source: https://pypi.python.org/packages/b4/a0/b70cf2b7b4ee1f9d8fa0f1b4abbbac081a2638a580dabf29b8fb554d5fc1/pytidylib-%{version}.tar.gz
|
||
|
BuildRequires: libtidy-devel
|
||
|
BuildRequires: python-devel
|
||
|
Requires: libtidy5
|
||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||
|
|
||
|
%description
|
||
|
`PyTidyLib`_ is a Python package that wraps the `HTML Tidy`_ library. This
|
||
|
allows you, from Python code, to "fix" invalid (X)HTML markup. Some of the
|
||
|
library's many capabilities include:
|
||
|
|
||
|
* Clean up unclosed tags and unescaped characters such as ampersands
|
||
|
* Output HTML 4 or XHTML, strict or transitional, and add missing doctypes
|
||
|
* Convert named entities to numeric entities, which can then be used in XML
|
||
|
documents without an HTML doctype.
|
||
|
* Clean up HTML from programs such as Word (to an extent)
|
||
|
* Indent the output, including proper (i.e. no) indenting for ``pre`` elements,
|
||
|
which some (X)HTML indenting code overlooks.
|
||
|
|
||
|
Small example of use
|
||
|
====================
|
||
|
|
||
|
The following code cleans up an invalid HTML document and sets an option::
|
||
|
|
||
|
from tidylib import tidy_document
|
||
|
document, errors = tidy_document('''<p>fõo <img src="bar.jpg">''',
|
||
|
options={'numeric-entities':1})
|
||
|
print document
|
||
|
print errors
|
||
|
|
||
|
%prep
|
||
|
%setup -q -n pytidylib-%{version}
|
||
|
|
||
|
%build
|
||
|
python setup.py build
|
||
|
|
||
|
%install
|
||
|
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||
|
|
||
|
%files
|
||
|
%defattr(-,root,root,-)
|
||
|
%doc LICENSE README
|
||
|
%{python_sitelib}/*
|
||
|
|
||
|
%changelog
|