patches/wv-02-w3m-dump.diff
author nonsea
Tue, 18 Sep 2007 11:19:44 +0000
changeset 489 68595c833e01
child 492 5c737a73fcd0
permissions -rw-r--r--
2007-09-18 Halton Huo <[email protected]> * SFEwv.spec: Add patch w3m-dump, Remove Requires SFElinks * patches/wv-02-w3m-dump.diff: add to use w3m convert html to txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
489
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     1
Index: wv-trunk/wvText.in
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     2
===================================================================
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     3
--- wv-trunk/wvText.in	(revision 21979)
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     4
+++ wv-trunk/wvText.in	(working copy)
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     5
@@ -18,20 +18,25 @@
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     6
 else
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     7
     which links >/dev/null 2>&1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     8
     if [ ${?} -eq "0" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
     9
-	USE_DUMP=2
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    10
+		USE_DUMP=2
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    11
     else
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    12
-	which lynx >/dev/null 2>&1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    13
-	if [ ${?} -eq "0" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    14
-	    USE_DUMP=1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    15
-	fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    16
+		which lynx >/dev/null 2>&1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    17
+		if [ ${?} -eq "0" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    18
+			USE_DUMP=1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    19
+		else
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    20
+			which w3m >/dev/null 2>&1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    21
+			if [ ${?} -eq "0" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    22
+				USE_DUMP=4
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    23
+			fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    24
+		fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    25
     fi    
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    26
 fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    27
 
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    28
 if [ $USE_DUMP -eq "1" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    29
-	echo "Could not find required program 'elinks' or 'links'"
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    30
+	echo "Could not find required program 'elinks' or 'links' or 'w3m'"
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    31
 	echo "Using lynx. Ouput will be pretty ugly."
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    32
 elif [ $USE_DUMP -eq "0" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    33
-	echo "Could not find required program 'elinks', 'links', or even 'lynx'"
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    34
+	echo "Could not find required program 'elinks', 'links', 'w3m', or even 'lynx'"
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    35
 	echo "Using wvWare -x wvText.xml. Ouput will be pretty bad."
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    36
 fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    37
 
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    38
@@ -45,7 +50,7 @@
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    39
     fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    40
 
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    41
     # intermediate file
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    42
-    TMP_FILE=`mktemp "$tmpdir/wv-XXXXXX"`
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    43
+    TMP_FILE=`mktemp "$tmpdir/wv-XXXXXX.html"`
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    44
     TMP_FILE=`basename "$TMP_FILE"`
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    45
 
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    46
     wvHtml -1 "${1}" --targetdir="${tmpdir}" "${TMP_FILE}" >/dev/null 2>&1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    47
@@ -54,8 +59,11 @@
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    48
 	exit 1
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    49
     fi
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    50
 
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    51
-    if [ $USE_DUMP -eq "3" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    52
+    if [ $USE_DUMP -eq "4" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    53
 	# elinks does the best
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    54
+	w3m -dump "${tmpdir}/${TMP_FILE}" > "${2}"
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    55
+    elif [ $USE_DUMP -eq "3" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    56
+	# elinks does the best
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    57
 	elinks -dump -force-html "${tmpdir}/${TMP_FILE}" > "${2}"
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    58
     elif [ $USE_DUMP -eq "2" ]; then
68595c833e01 2007-09-18 Halton Huo <[email protected]>
nonsea
parents:
diff changeset
    59
 	# links does a pretty good job