diff options
author | Graham Wilson <graham@mknod.org> | 2004-11-29 01:52:17 +0000 |
---|---|---|
committer | Graham Wilson <graham@mknod.org> | 2004-11-29 01:52:17 +0000 |
commit | 100fa76e5f1675dd18b9d35e5c7e88699a57ba7d (patch) | |
tree | 13016c26d6e058c9c72eee42fab928f5845988ec /dist-tools/html2txt | |
parent | 770aadf57878bf73f98d46b86cb719569da5a9f2 (diff) | |
download | fetchmail-100fa76e5f1675dd18b9d35e5c7e88699a57ba7d.tar.gz fetchmail-100fa76e5f1675dd18b9d35e5c7e88699a57ba7d.tar.bz2 fetchmail-100fa76e5f1675dd18b9d35e5c7e88699a57ba7d.zip |
Move the html2txt script to dist-tools.
svn path=/trunk/; revision=4012
Diffstat (limited to 'dist-tools/html2txt')
-rwxr-xr-x | dist-tools/html2txt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dist-tools/html2txt b/dist-tools/html2txt new file mode 100755 index 00000000..d2ae59a1 --- /dev/null +++ b/dist-tools/html2txt @@ -0,0 +1,49 @@ +#! /bin/sh + +# html2txt.sh - A program to convert fetchmail's HTML documentation to text +# Copyright (C) 2004 Matthias Andree + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# -------------------------------------------------------------------------- + +# Usage: html2txt.sh INPUT.html + +# -------------------------------------------------------------------------- + +# Abort on error +set -e + +# Parse arguments +if [ $# -ne 1 ] ; then + echo >&2 "Usage: `basename $0 || echo $0` input.html" + exit 1 +fi + +# Pull in variables +inp="$1" +tmp="html2txt.$$.html" + +# now preprocess +trap "rm -f \"$tmp\"" 0 1 2 3 15 +${AWK:=awk} '/<table .*summary="Canned/ { i=1; } + /<\/table>/ { i=0; } + { if (i == 0) print $0; }' "$inp" >"$tmp" + +# and go! +echo " (This file was generated from $inp)" +lynx -dump -nolist "$tmp" +rm -f "$tmp" +trap "" 0 1 2 3 15 |