Hello community, here is the log from the commit of package python3-html2text for openSUSE:Factory checked in at 2016-09-21 18:50:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-html2text (Old) and /work/SRC/openSUSE:Factory/.python3-html2text.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-html2text" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-html2text/python3-html2text.changes 2016-07-05 09:53:14.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-html2text.new/python3-html2text.changes 2016-09-21 18:50:43.000000000 +0200 @@ -1,0 +2,11 @@ +Wed Sep 21 02:04:41 UTC 2016 - a...@gmx.de + +- update to version 2016.9.19: + * Default image alt text option created and set to a default of + empty string "" to maintain backward compatibility + * Fix #136: --default-image-alt now takes a string as argument + * Fix #113: Stop changing quiet levels on /script tags. + * Merge #126: Fix deprecation warning on py3 due to html.escape + * Fix #145: Running test suite on Travis CI for Python 2.6. + +------------------------------------------------------------------- Old: ---- html2text-2016.5.29.tar.gz New: ---- html2text-2016.9.19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-html2text.spec ++++++ --- /var/tmp/diff_new_pack.ZWXXPT/_old 2016-09-21 18:50:44.000000000 +0200 +++ /var/tmp/diff_new_pack.ZWXXPT/_new 2016-09-21 18:50:44.000000000 +0200 @@ -17,7 +17,7 @@ Name: python3-html2text -Version: 2016.5.29 +Version: 2016.9.19 Release: 0 Url: https://github.com/Alir3z4/html2text/ Summary: Turn HTML into equivalent Markdown-structured text ++++++ html2text-2016.5.29.tar.gz -> html2text-2016.9.19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/ChangeLog.rst new/html2text-2016.9.19/ChangeLog.rst --- old/html2text-2016.5.29/ChangeLog.rst 2016-05-29 18:12:58.000000000 +0200 +++ new/html2text-2016.9.19/ChangeLog.rst 2016-09-19 00:03:35.000000000 +0200 @@ -1,3 +1,14 @@ +2016.9.19 +========= +---- + +* Default image alt text option created and set to a default of empty string "" to maintain backward compatibility +* Fix #136: --default-image-alt now takes a string as argument +* Fix #113: Stop changing quiet levels on \/script tags. +* Merge #126: Fix deprecation warning on py3 due to html.escape +* Fix #145: Running test suite on Travis CI for Python 2.6. + + 2016.5.29 ========= ---- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/PKG-INFO new/html2text-2016.9.19/PKG-INFO --- old/html2text-2016.5.29/PKG-INFO 2016-05-29 18:16:19.000000000 +0200 +++ new/html2text-2016.9.19/PKG-INFO 2016-09-19 00:08:46.000000000 +0200 @@ -1,98 +1,128 @@ Metadata-Version: 1.1 Name: html2text -Version: 2016.5.29 +Version: 2016.9.19 Summary: Turn HTML into equivalent Markdown-structured text. Home-page: https://github.com/Alir3z4/html2text/ Author: Alireza Savand Author-email: alireza.sav...@gmail.com License: GNU GPL 3 -Description: # html2text +Description: html2text + ========= - [![Build Status](https://secure.travis-ci.org/Alir3z4/html2text.png)](http://travis-ci.org/Alir3z4/html2text) - [![Coverage Status](https://coveralls.io/repos/Alir3z4/html2text/badge.png)](https://coveralls.io/r/Alir3z4/html2text) - [![Downloads](http://badge.kloud51.com/pypi/d/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![Version](http://badge.kloud51.com/pypi/v/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![Wheel?](http://badge.kloud51.com/pypi/wheel/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![Format](http://badge.kloud51.com/pypi/format/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![License](http://badge.kloud51.com/pypi/license/html2text.png)](https://pypi.python.org/pypi/html2text/) - - - html2text is a Python script that converts a page of HTML into clean, easy-to-read plain ASCII text. Better yet, that ASCII also happens to be valid Markdown (a text-to-HTML format). - - - Usage: `html2text [(filename|url) [encoding]]` - - | Option | Description - |--------------------------------------------------------|--------------------------------------------------- - | `--version` | Show program's version number and exit - | `-h`, `--help` | Show this help message and exit - | `--ignore-links` | Don't include any formatting for links - |`--escape-all` | Escape all special characters. Output is less readable, but avoids corner case formatting issues. - | `--reference-links` | Use reference links instead of links to create markdown - | `--mark-code` | Mark preformatted and code blocks with [code]...[/code] - - For a complete list of options see the [docs](docs/usage.md) - - - Or you can use it from within `Python`: - - ``` - >>> import html2text - >>> - >>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>")) - **Zed's** dead baby, _Zed's_ dead. - - ``` + |Build Status| |Coverage Status| |Downloads| |Version| |Wheel?| |Format| + |License| + html2text is a Python script that converts a page of HTML into clean, + easy-to-read plain ASCII text. Better yet, that ASCII also happens to be + valid Markdown (a text-to-HTML format). + + Usage: ``html2text [(filename|url) [encoding]]`` + + +---------------------------------------+------------------------------------+ + | Option | Description | + +=======================================+====================================+ + | ``--version`` | Show program's version number and | + | | exit | + +---------------------------------------+------------------------------------+ + | ``-h``, ``--help`` | Show this help message and exit | + +---------------------------------------+------------------------------------+ + | ``--ignore-links`` | Don't include any formatting for | + | | links | + +---------------------------------------+------------------------------------+ + | ``--escape-all`` | Escape all special characters. | + | | Output is less readable, but | + | | avoids corner case formatting | + | | issues. | + +---------------------------------------+------------------------------------+ + | ``--reference-links`` | Use reference links instead of | + | | links to create markdown | + +---------------------------------------+------------------------------------+ + | ``--mark-code`` | Mark preformatted and code blocks | + | | with [code]...[/code] | + +---------------------------------------+------------------------------------+ + + For a complete list of options see the + `docs <https://github.com/Alir3z4/html2text/blob/master/docs/usage.md>`__ + + Or you can use it from within ``Python``: + + :: + + >>> import html2text + >>> + >>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>")) + **Zed's** dead baby, _Zed's_ dead. Or with some configuration options: - ``` - >>> import html2text - >>> - >>> h = html2text.HTML2Text() - >>> # Ignore converting links from HTML - >>> h.ignore_links = True - >>> print h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!") - Hello, world! - >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) + :: - Hello, world! + >>> import html2text + >>> + >>> h = html2text.HTML2Text() + >>> # Ignore converting links from HTML + >>> h.ignore_links = True + >>> print h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!") + Hello, world! - >>> # Don't Ignore links anymore, I like links - >>> h.ignore_links = False - >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) - Hello, [world](http://earth.google.com/)! + >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) - ``` + Hello, world! - *Originally written by Aaron Swartz. This code is distributed under the GPLv3.* + >>> # Don't Ignore links anymore, I like links + >>> h.ignore_links = False + >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) + Hello, [world](http://earth.google.com/)! + *Originally written by Aaron Swartz. This code is distributed under the + GPLv3.* - ## How to install + How to install + -------------- - `html2text` is available on pypi + ``html2text`` is available on pypi https://pypi.python.org/pypi/html2text - ``` - $ pip install html2text - ``` + :: + + $ pip install html2text + How to run unit tests + --------------------- - ## How to run unit tests + :: PYTHONPATH=$PYTHONPATH:. coverage run --source=html2text setup.py test -v To see the coverage results: - + + :: + coverage combine coverage html - then open the `./htmlcov/index.html` file in your browser. + then open the ``./htmlcov/index.html`` file in your browser. + + Documentation + ------------- - ## Documentation + Documentation lives + `here <https://github.com/Alir3z4/html2text/blob/master/docs/usage.md>`__ - Documentation lives [here](docs/index.md) + .. |Build Status| image:: https://secure.travis-ci.org/Alir3z4/html2text.png + :target: http://travis-ci.org/Alir3z4/html2text + .. |Coverage Status| image:: https://coveralls.io/repos/Alir3z4/html2text/badge.png + :target: https://coveralls.io/r/Alir3z4/html2text + .. |Downloads| image:: http://badge.kloud51.com/pypi/d/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |Version| image:: http://badge.kloud51.com/pypi/v/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |Wheel?| image:: http://badge.kloud51.com/pypi/wheel/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |Format| image:: http://badge.kloud51.com/pypi/format/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |License| image:: http://badge.kloud51.com/pypi/license/html2text.png + :target: https://pypi.python.org/pypi/html2text/ Platform: OS Independent Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/README.md new/html2text-2016.9.19/README.md --- old/html2text-2016.5.29/README.md 2016-05-29 18:08:48.000000000 +0200 +++ new/html2text-2016.9.19/README.md 2016-09-18 23:51:18.000000000 +0200 @@ -23,7 +23,7 @@ | `--reference-links` | Use reference links instead of links to create markdown | `--mark-code` | Mark preformatted and code blocks with [code]...[/code] -For a complete list of options see the [docs](docs/usage.md) +For a complete list of options see the [docs](https://github.com/Alir3z4/html2text/blob/master/docs/usage.md) Or you can use it from within `Python`: @@ -84,4 +84,4 @@ ## Documentation -Documentation lives [here](docs/index.md) +Documentation lives [here](https://github.com/Alir3z4/html2text/blob/master/docs/usage.md) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text/__init__.py new/html2text-2016.9.19/html2text/__init__.py --- old/html2text-2016.5.29/html2text/__init__.py 2016-05-29 18:14:12.000000000 +0200 +++ new/html2text-2016.9.19/html2text/__init__.py 2016-09-19 00:03:55.000000000 +0200 @@ -4,14 +4,13 @@ from __future__ import division import re import sys -import cgi try: from textwrap import wrap except ImportError: # pragma: no cover pass -from html2text.compat import urlparse, HTMLParser +from html2text.compat import urlparse, HTMLParser, html_escape from html2text import config from html2text.utils import ( @@ -31,7 +30,7 @@ pad_tables_in_text ) -__version__ = (2016, 5, 29) +__version__ = (2016, 9, 19) # TODO: @@ -69,6 +68,7 @@ self.images_with_size = config.IMAGES_WITH_SIZE # covered in cli self.ignore_emphasis = config.IGNORE_EMPHASIS # covered in cli self.bypass_tables = config.BYPASS_TABLES # covered in cli + self.ignore_tables = config.IGNORE_TABLES # covered in cli self.google_doc = False # covered in cli self.ul_item_mark = '*' # covered in cli self.emphasis_mark = '_' # covered in cli @@ -79,6 +79,7 @@ self.mark_code = config.MARK_CODE self.wrap_links = config.WRAP_LINKS # covered in cli self.pad_tables = config.PAD_TABLES # covered in cli + self.default_image_alt = config.DEFAULT_IMAGE_ALT # covered in cli self.tag_callback = None if out is None: # pragma: no cover @@ -176,14 +177,14 @@ def handle_charref(self, c): charref = self.charref(c) if not self.code and not self.pre: - charref = cgi.escape(charref) + charref = html_escape(charref) self.handle_data(charref, True) def handle_entityref(self, c): entityref = self.entityref(c) if (not self.code and not self.pre and entityref != ' _place_holder;'): - entityref = cgi.escape(entityref) + entityref = html_escape(entityref) self.handle_data(entityref, True) def handle_starttag(self, tag, attrs): @@ -445,7 +446,7 @@ if 'src' in attrs: if not self.images_to_alt: attrs['href'] = attrs['src'] - alt = attrs.get('alt') or '' + alt = attrs.get('alt') or self.default_image_alt # If we have images_with_size, write raw html including width, # height, and alt attributes @@ -547,7 +548,16 @@ self.start = 1 if tag in ["table", "tr", "td", "th"]: - if self.bypass_tables: + if self.ignore_tables: + if tag == 'tr': + if start: + pass + else: + self.soft_br() + else: + pass + + elif self.bypass_tables: if start: self.soft_br() if tag in ["td", "th"]: @@ -721,9 +731,6 @@ self.outcount += 1 def handle_data(self, data, entity_char=False): - if r'\/script>' in data: - self.quiet -= 1 - if self.style: self.style_def.update(dumb_css_parser(data)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text/cli.py new/html2text-2016.9.19/html2text/cli.py --- old/html2text-2016.5.29/html2text/cli.py 2016-05-29 18:08:48.000000000 +0200 +++ new/html2text-2016.9.19/html2text/cli.py 2016-09-18 23:51:18.000000000 +0200 @@ -24,6 +24,13 @@ version='%prog ' + ".".join(map(str, __version__)) ) p.add_option( + "--default-image-alt", + dest="default_image_alt", + action="store", + type="str", + default=config.DEFAULT_IMAGE_ALT, + help="The default alt string for images with missing ones") + p.add_option( "--pad-tables", dest="pad_tables", action="store_true", @@ -147,6 +154,13 @@ help="Format tables in HTML rather than Markdown syntax." ) p.add_option( + "--ignore-tables", + action="store_true", + dest="ignore_tables", + default=config.IGNORE_TABLES, + help="Ignore table-related tags (table, th, td, tr) while keeping rows." + ) + p.add_option( "--single-line-break", action="store_true", dest="single_line_break", @@ -270,6 +284,7 @@ h.hide_strikethrough = options.hide_strikethrough h.escape_snob = options.escape_snob h.bypass_tables = options.bypass_tables + h.ignore_tables = options.ignore_tables h.single_line_break = options.single_line_break h.inline_links = options.inline_links h.unicode_snob = options.unicode_snob @@ -279,5 +294,6 @@ h.mark_code = options.mark_code h.wrap_links = options.wrap_links h.pad_tables = options.pad_tables + h.default_image_alt = options.default_image_alt wrapwrite(h.handle(data)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text/compat.py new/html2text-2016.9.19/html2text/compat.py --- old/html2text-2016.5.29/html2text/compat.py 2016-05-29 18:08:43.000000000 +0200 +++ new/html2text-2016.9.19/html2text/compat.py 2016-09-18 23:51:18.000000000 +0200 @@ -6,8 +6,12 @@ import urlparse import HTMLParser import urllib + from cgi import escape as html_escape else: import urllib.parse as urlparse import html.entities as htmlentitydefs import html.parser as HTMLParser import urllib.request as urllib + from html import escape + def html_escape(s): + return escape(s, quote=False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text/config.py new/html2text-2016.9.19/html2text/config.py --- old/html2text-2016.5.29/html2text/config.py 2016-05-29 18:08:48.000000000 +0200 +++ new/html2text-2016.9.19/html2text/config.py 2016-09-18 23:51:18.000000000 +0200 @@ -38,6 +38,7 @@ IGNORE_EMPHASIS = False MARK_CODE = False DECODE_ERRORS = 'strict' +DEFAULT_IMAGE_ALT = '' PAD_TABLES = False # Convert links with same href and text to <href> format if they are absolute links @@ -119,7 +120,11 @@ 'rlm': '' } +# Format tables in HTML rather than Markdown syntax BYPASS_TABLES = False +# Ignore table-related tags (table, th, td, tr) while keeping rows +IGNORE_TABLES = False + # Use a single line break after a block element rather an two line breaks. # NOTE: Requires body width setting to be 0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text/utils.py new/html2text-2016.9.19/html2text/utils.py --- old/html2text-2016.5.29/html2text/utils.py 2016-05-29 18:08:48.000000000 +0200 +++ new/html2text-2016.9.19/html2text/utils.py 2016-09-18 23:51:18.000000000 +0200 @@ -31,7 +31,7 @@ """ :returns: A hash of css attributes """ - out = dict([(x.strip(), y.strip()) for x, y in + out = dict([(x.strip().lower(), y.strip().lower()) for x, y in [z.split(':', 1) for z in style.split(';') if ':' in z ] @@ -149,7 +149,7 @@ font_family = '' if 'font-family' in style: font_family = style['font-family'] - if 'Courier New' == font_family or 'Consolas' == font_family: + if 'courier new' == font_family or 'consolas' == font_family: return True return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text.egg-info/PKG-INFO new/html2text-2016.9.19/html2text.egg-info/PKG-INFO --- old/html2text-2016.5.29/html2text.egg-info/PKG-INFO 2016-05-29 18:16:19.000000000 +0200 +++ new/html2text-2016.9.19/html2text.egg-info/PKG-INFO 2016-09-19 00:08:46.000000000 +0200 @@ -1,98 +1,128 @@ Metadata-Version: 1.1 Name: html2text -Version: 2016.5.29 +Version: 2016.9.19 Summary: Turn HTML into equivalent Markdown-structured text. Home-page: https://github.com/Alir3z4/html2text/ Author: Alireza Savand Author-email: alireza.sav...@gmail.com License: GNU GPL 3 -Description: # html2text +Description: html2text + ========= - [![Build Status](https://secure.travis-ci.org/Alir3z4/html2text.png)](http://travis-ci.org/Alir3z4/html2text) - [![Coverage Status](https://coveralls.io/repos/Alir3z4/html2text/badge.png)](https://coveralls.io/r/Alir3z4/html2text) - [![Downloads](http://badge.kloud51.com/pypi/d/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![Version](http://badge.kloud51.com/pypi/v/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![Wheel?](http://badge.kloud51.com/pypi/wheel/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![Format](http://badge.kloud51.com/pypi/format/html2text.png)](https://pypi.python.org/pypi/html2text/) - [![License](http://badge.kloud51.com/pypi/license/html2text.png)](https://pypi.python.org/pypi/html2text/) - - - html2text is a Python script that converts a page of HTML into clean, easy-to-read plain ASCII text. Better yet, that ASCII also happens to be valid Markdown (a text-to-HTML format). - - - Usage: `html2text [(filename|url) [encoding]]` - - | Option | Description - |--------------------------------------------------------|--------------------------------------------------- - | `--version` | Show program's version number and exit - | `-h`, `--help` | Show this help message and exit - | `--ignore-links` | Don't include any formatting for links - |`--escape-all` | Escape all special characters. Output is less readable, but avoids corner case formatting issues. - | `--reference-links` | Use reference links instead of links to create markdown - | `--mark-code` | Mark preformatted and code blocks with [code]...[/code] - - For a complete list of options see the [docs](docs/usage.md) - - - Or you can use it from within `Python`: - - ``` - >>> import html2text - >>> - >>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>")) - **Zed's** dead baby, _Zed's_ dead. - - ``` + |Build Status| |Coverage Status| |Downloads| |Version| |Wheel?| |Format| + |License| + html2text is a Python script that converts a page of HTML into clean, + easy-to-read plain ASCII text. Better yet, that ASCII also happens to be + valid Markdown (a text-to-HTML format). + + Usage: ``html2text [(filename|url) [encoding]]`` + + +---------------------------------------+------------------------------------+ + | Option | Description | + +=======================================+====================================+ + | ``--version`` | Show program's version number and | + | | exit | + +---------------------------------------+------------------------------------+ + | ``-h``, ``--help`` | Show this help message and exit | + +---------------------------------------+------------------------------------+ + | ``--ignore-links`` | Don't include any formatting for | + | | links | + +---------------------------------------+------------------------------------+ + | ``--escape-all`` | Escape all special characters. | + | | Output is less readable, but | + | | avoids corner case formatting | + | | issues. | + +---------------------------------------+------------------------------------+ + | ``--reference-links`` | Use reference links instead of | + | | links to create markdown | + +---------------------------------------+------------------------------------+ + | ``--mark-code`` | Mark preformatted and code blocks | + | | with [code]...[/code] | + +---------------------------------------+------------------------------------+ + + For a complete list of options see the + `docs <https://github.com/Alir3z4/html2text/blob/master/docs/usage.md>`__ + + Or you can use it from within ``Python``: + + :: + + >>> import html2text + >>> + >>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>")) + **Zed's** dead baby, _Zed's_ dead. Or with some configuration options: - ``` - >>> import html2text - >>> - >>> h = html2text.HTML2Text() - >>> # Ignore converting links from HTML - >>> h.ignore_links = True - >>> print h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!") - Hello, world! - >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) + :: - Hello, world! + >>> import html2text + >>> + >>> h = html2text.HTML2Text() + >>> # Ignore converting links from HTML + >>> h.ignore_links = True + >>> print h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!") + Hello, world! - >>> # Don't Ignore links anymore, I like links - >>> h.ignore_links = False - >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) - Hello, [world](http://earth.google.com/)! + >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) - ``` + Hello, world! - *Originally written by Aaron Swartz. This code is distributed under the GPLv3.* + >>> # Don't Ignore links anymore, I like links + >>> h.ignore_links = False + >>> print(h.handle("<p>Hello, <a href='http://earth.google.com/'>world</a>!")) + Hello, [world](http://earth.google.com/)! + *Originally written by Aaron Swartz. This code is distributed under the + GPLv3.* - ## How to install + How to install + -------------- - `html2text` is available on pypi + ``html2text`` is available on pypi https://pypi.python.org/pypi/html2text - ``` - $ pip install html2text - ``` + :: + + $ pip install html2text + How to run unit tests + --------------------- - ## How to run unit tests + :: PYTHONPATH=$PYTHONPATH:. coverage run --source=html2text setup.py test -v To see the coverage results: - + + :: + coverage combine coverage html - then open the `./htmlcov/index.html` file in your browser. + then open the ``./htmlcov/index.html`` file in your browser. + + Documentation + ------------- - ## Documentation + Documentation lives + `here <https://github.com/Alir3z4/html2text/blob/master/docs/usage.md>`__ - Documentation lives [here](docs/index.md) + .. |Build Status| image:: https://secure.travis-ci.org/Alir3z4/html2text.png + :target: http://travis-ci.org/Alir3z4/html2text + .. |Coverage Status| image:: https://coveralls.io/repos/Alir3z4/html2text/badge.png + :target: https://coveralls.io/r/Alir3z4/html2text + .. |Downloads| image:: http://badge.kloud51.com/pypi/d/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |Version| image:: http://badge.kloud51.com/pypi/v/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |Wheel?| image:: http://badge.kloud51.com/pypi/wheel/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |Format| image:: http://badge.kloud51.com/pypi/format/html2text.png + :target: https://pypi.python.org/pypi/html2text/ + .. |License| image:: http://badge.kloud51.com/pypi/license/html2text.png + :target: https://pypi.python.org/pypi/html2text/ Platform: OS Independent Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/html2text.egg-info/SOURCES.txt new/html2text-2016.9.19/html2text.egg-info/SOURCES.txt --- old/html2text-2016.5.29/html2text.egg-info/SOURCES.txt 2016-05-29 18:16:19.000000000 +0200 +++ new/html2text-2016.9.19/html2text.egg-info/SOURCES.txt 2016-09-19 00:08:46.000000000 +0200 @@ -41,6 +41,8 @@ test/css_import_no_semicolon.md test/decript_tage.html test/decript_tage.md +test/default_image_alt.html +test/default_image_alt.md test/doc_with_table.html test/doc_with_table.md test/doc_with_table_bypass.html @@ -51,6 +53,8 @@ test/empty-link.md test/flip_emphasis.html test/flip_emphasis.md +test/google-like_font-properties.html +test/google-like_font-properties.md test/header_tags.html test/header_tags.md test/horizontal_rule.html @@ -107,6 +111,8 @@ test/protect_links.md test/single_line_break.html test/single_line_break.md +test/table_ignore.html +test/table_ignore.md test/test_html2text.py test/test_memleak.py test/text_after_list.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/default_image_alt.html new/html2text-2016.9.19/test/default_image_alt.html --- old/html2text-2016.5.29/test/default_image_alt.html 1970-01-01 01:00:00.000000000 +0100 +++ new/html2text-2016.9.19/test/default_image_alt.html 2016-09-18 23:51:18.000000000 +0200 @@ -0,0 +1 @@ +<a href="http://google.com"><img src="images/google.png"></a> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/default_image_alt.md new/html2text-2016.9.19/test/default_image_alt.md --- old/html2text-2016.5.29/test/default_image_alt.md 1970-01-01 01:00:00.000000000 +0100 +++ new/html2text-2016.9.19/test/default_image_alt.md 2016-09-18 23:51:18.000000000 +0200 @@ -0,0 +1,2 @@ +[![Image](images/google.png)](http://google.com) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/google-like_font-properties.html new/html2text-2016.9.19/test/google-like_font-properties.html --- old/html2text-2016.5.29/test/google-like_font-properties.html 1970-01-01 01:00:00.000000000 +0100 +++ new/html2text-2016.9.19/test/google-like_font-properties.html 2016-09-18 23:51:18.000000000 +0200 @@ -0,0 +1,15 @@ +<HTML> + <HEAD> + <TITLE>CAPS-LOCK TEST</TITLE> + </HEAD> + <BODY> + <p><span style="font-weight: bold">font-weight: bold</span></p> + <P><SPAN STYLE="FONT-WEIGHT: BOLD">FONT-WEIGHT: BOLD</SPAN></P> + <p><span style="font-style: italic">font-style: italic</span></p> + <P><SPAN STYLE="FONT-STYLE: ITALIC">FONT-STYLE: ITALIC</SPAN></P> + <p><span style="font-weight: bold;font-style: italic"> + font-weight: bold;font-style: italic</span></p> + <P><SPAN STYLE="FONT-WEIGHT: BOLD;FONT-STYLE: ITALIC"> + FONT-WEIGHT: BOLD;FONT-STYLE: ITALIC</SPAN></P> + </BODY> +</HTML> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/google-like_font-properties.md new/html2text-2016.9.19/test/google-like_font-properties.md --- old/html2text-2016.5.29/test/google-like_font-properties.md 1970-01-01 01:00:00.000000000 +0100 +++ new/html2text-2016.9.19/test/google-like_font-properties.md 2016-09-18 23:51:18.000000000 +0200 @@ -0,0 +1,6 @@ +**font-weight: bold** +**FONT-WEIGHT: BOLD** +_font-style: italic_ +_FONT-STYLE: ITALIC_ +_**font-weight: bold;font-style: italic**_ +_**FONT-WEIGHT: BOLD;FONT-STYLE: ITALIC**_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/table_ignore.html new/html2text-2016.9.19/test/table_ignore.html --- old/html2text-2016.5.29/test/table_ignore.html 1970-01-01 01:00:00.000000000 +0100 +++ new/html2text-2016.9.19/test/table_ignore.html 2016-09-18 23:51:18.000000000 +0200 @@ -0,0 +1,26 @@ +<!DOCTYPE html> <html> + <head lang="en"> <meta charset="UTF-8"> <title></title> </head> + <body> <h1>This is a test document</h1> With some text, <code>code</code>, <b>bolds</b> and <i>italics</i>. <h2>This is second header</h2> <p style="display: none">Displaynone text</p> + <table> + <tr> <th>Header 1</th> <th>Header 2</th> <th>Header 3</th> </tr> + <tr> <td>Content 1</td> <td>2</td> <td><img src="http://lorempixel.com/200/200" alt="200"/> Image!</td> </tr> + <tr> <td>Content 1 longer</td> <td>Content 2</td> <td>blah</td> </tr> + <tr> <td>Content </td> <td>Content 2</td> <td>blah</td> </tr> + <tr> <td>t </td> <td>Content 2</td> <td>blah blah blah</td> </tr> + </table> + + + <table> <tr> <th>H1</th> <th>H2</th> <th>H3</th> </tr> + <tr> <td>C1</td> <td>Content 2</td> <td>x</td> </tr> + <tr> <td>C123</td> <td>Content 2</td> <td>xyz</td> </tr> + </table> + +some content between the tables<br> + + <table> <tr> <th>Header 1</th> <th>Header 2</th> <th>Header 3</th> </tr> + <tr> <td>Content 1</td> <td>Content 2</td> <td><img src="http://lorempixel.com/200/200" alt="200"/> Image!</td> </tr> + <tr> <td>Content 1</td> <td>Content 2 longer</td> <td><img src="http://lorempixel.com/200/200" alt="200"/> Image!</td> </tr> + </table> + +something else entirely +</body> </html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/table_ignore.md new/html2text-2016.9.19/test/table_ignore.md --- old/html2text-2016.5.29/test/table_ignore.md 1970-01-01 01:00:00.000000000 +0100 +++ new/html2text-2016.9.19/test/table_ignore.md 2016-09-18 23:51:18.000000000 +0200 @@ -0,0 +1,22 @@ +# This is a test document + +With some text, `code`, **bolds** and _italics_. + +## This is second header + +Displaynone text + +Header 1 Header 2 Header 3 +Content 1 2 ![200](http://lorempixel.com/200/200) Image! +Content 1 longer Content 2 blah +Content Content 2 blah +t Content 2 blah blah blah +H1 H2 H3 +C1 Content 2 x +C123 Content 2 xyz +some content between the tables +Header 1 Header 2 Header 3 +Content 1 Content 2 ![200](http://lorempixel.com/200/200) Image! +Content 1 Content 2 longer ![200](http://lorempixel.com/200/200) Image! +something else entirely + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/html2text-2016.5.29/test/test_html2text.py new/html2text-2016.9.19/test/test_html2text.py --- old/html2text-2016.5.29/test/test_html2text.py 2016-05-29 18:08:48.000000000 +0200 +++ new/html2text-2016.9.19/test/test_html2text.py 2016-09-18 23:51:18.000000000 +0200 @@ -114,6 +114,10 @@ func_args = {} base_fn = os.path.basename(fn).lower() + if base_fn.startswith('default_image_alt'): + module_args['default_image_alt'] = 'Image' + cmdline_args.append('--default-image-alt=Image') + if base_fn.startswith('google'): module_args['google_doc'] = True cmdline_args.append('--googledoc') @@ -134,6 +138,10 @@ module_args['bypass_tables'] = True cmdline_args.append('--bypass-tables') + if base_fn.startswith('table_ignore'): + module_args['ignore_tables'] = True + cmdline_args.append('--ignore-tables') + if base_fn.startswith('bodywidth'): # module_args['unicode_snob'] = True module_args['body_width'] = 0 @@ -161,7 +169,7 @@ if base_fn.startswith('no_inline_links'): module_args['inline_links'] = False cmdline_args.append('--reference-links') - + if base_fn.startswith('no_wrap_links'): module_args['wrap_links'] = False cmdline_args.append('--no-wrap-links')