刘凡 9ff4d1d109 add S3,archive,truncate | 2 years ago | |
---|---|---|
.. | ||
html5lib_truncation | 2 years ago | |
tests | 2 years ago | |
.bumpversion.cfg | 2 years ago | |
.gitignore | 2 years ago | |
.pyup.yml | 2 years ago | |
.travis.yml | 2 years ago | |
LICENSE | 2 years ago | |
README.rst | 2 years ago | |
setup.cfg | 2 years ago | |
setup.py | 2 years ago | |
tox.ini | 2 years ago |
A very very long link
'A very'
>>> truncate_html(html, 8, break_words=True)
u'
A very ve'
>>> truncate_html(html, 20, end='...')
u'
A very very...'
>>> truncate_html(html, 20, end='...', break_words=True)
u'
A very very lon...'
.. _html5lib: https://github.com/html5lib/html5lib-python
Installation
------------
::
pip install html5lib-truncation
Don't forget to put it into your ``requirements.txt`` or ``setup.py``.
API Overview
------------
The core API of html5lib-truncation is the filter:
.. code-block:: python
import html5lib
from html5lib_truncation import TruncationFilter
etree = html5lib.parse(u'
A very very long link
')A very very lon...``.
Issues
------
If you want to report bugs or other issues, please create issues on
`GitHub Issues `_.
Contributes
-----------
You can send a pull reueqst on
`GitHub `_.
.. |Build Status| image:: https://img.shields.io/travis/tonyseek/html5lib-truncation.svg?style=flat
:target: https://travis-ci.org/tonyseek/html5lib-truncation
:alt: Build Status
.. |Coverage Status| image:: https://img.shields.io/coveralls/tonyseek/html5lib-truncation.svg?style=flat
:target: https://coveralls.io/r/tonyseek/html5lib-truncation
:alt: Coverage Status
.. |Wheel Status| image:: https://img.shields.io/pypi/wheel/html5lib-truncation.svg?style=flat
:target: https://warehouse.python.org/project/html5lib-truncation
:alt: Wheel Status
.. |PyPI Version| image:: https://img.shields.io/pypi/v/html5lib-truncation.svg?style=flat
:target: https://pypi.python.org/pypi/html5lib-truncation
:alt: PyPI Version