summaryrefslogtreecommitdiff
path: root/tools/html2text.py
AgeCommit message (Collapse)AuthorFilesLines
2015-03-26html2text.py: Python 2.5 compatibility, improve Unicode supportPeter Wu1-13/+16
Add support for Python 2.5 (remove unicode_literals import which does not seem to be necessary), check before using break_on_hyphens (without this option in Python 2.5, the output is uglier though) and avoid the 'with' keyword. While at it, fix reading Unicode text from file in Python 2 (tested with: echo € | tools/html2text.py) and support reading from stdin using the '-' filename. Tested against Python 2.5.6, 2.6.6, 2.7.9, 3.2.6, 3.4.3 with the commands from the previous html2text.py commit message, and additionally with the Unicode character € as input (instead of the faq.py output). Change-Id: I3de3f7a4e7cf7d702463c3a59758803843338a54 Reviewed-on: https://code.wireshark.org/review/7823 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-25Always use html2text.py for FAQ, improve outputPeter Wu1-493/+159
A recent commit broke compilation with Python 3. The original author of html2text.py is deceased and the fork has increased the number of files for this "simple" helper. The html2text.py script in this patch was rewritten and its output matches with lynx (except for a few newlines around lists). This means that indentation has been added for headings, paragraphs and lists. Also, since it was written from scratch, a new license could be chosen that matches Wireshark. Since now the in-tree html2text.py script provides nicer output, remove detection of the alternative programs (elinks, links). lynx/w3m is somehow still necessary for asciidoc though. (I also looked into reusing html2text.py for the release notes to replace asciidoc, but the --format=html output produces different output (HTML adds a ToC and section numbers). For now still require lynx for release notes) Tested with Python 2.6.6, 2.7.9, 3.2.6 and 3.4.3 under LC_ALL=C and LC_ALL=en_US.UTF-8 on Linux. Tested reading from stdin and file, writing to file, pipe and tty. Tested with cmake (Ninja) and autotools on Arch Linux x86_64. Test: # For each $PATH per python version, execute (with varying LC_ALL) help/faq.py -b | tools/html2text.py /dev/stdin | md5sum help/faq.py -b | tools/html2text.py | md5sum help/faq.py -b | tools/html2text.py help/faq.py -b | tools/html2text.py >/dev/null Change-Id: I6409450a3e6c8b010ca082251f9db7358b0cc2fd Reviewed-on: https://code.wireshark.org/review/7779 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2008-12-17Update html2text.py to suit our needs. Add spaces in the faq.txt targetGerald Combs1-27/+83
so to fix a problem with OS X 10.4. Add html2text.py to the end of the faq.txt target. svn path=/trunk/; revision=27040
2008-12-17Add html2text.py 2.35 from http://www.aaronsw.com/2002/html2text/.Gerald Combs1-0/+448
svn path=/trunk/; revision=27039