* bug in docbook-tools text backend using w3m
@ 2007-11-16 14:25 Christian Bünnig
2007-11-22 15:06 ` Ondřej Vašík
0 siblings, 1 reply; 2+ messages in thread
From: Christian Bünnig @ 2007-11-16 14:25 UTC (permalink / raw)
To: docbook-tools-discuss
Hey,
I've experienced a bug in the text backend of the docbook tools. The bug
is about converting from HTML to TEXT with w3m. The backend creates a
temporary HTML file to make a TEXT file from. However, the temporary
HTML has no '.html' suffix and in that case w3m does not convert it to
plain text - the resulting <FILE>.txt is still HTML.
Below is a workaround. I just appended '.html' to the variable HTML
(line 22). Now it works.
---------- snip -----------
# Backend to convert something into ASCII text
# Send any comments to Eric Bischoff <eric@caldera.de>
# This program is under GPL license. See LICENSE file for details.
if [ -x /usr/bin/lynx ]
then
CONVERT=/usr/bin/lynx
ARGS="-force_html -dump -nolist -width=72"
elif [ -x /usr/bin/links ]
then
CONVERT=/usr/bin/links
ARGS="-dump"
elif [ -x /usr/bin/w3m ]
then
CONVERT=/usr/bin/w3m
ARGS="-dump"
else
echo >&2 "No way to convert HTML to text found."
exit 1
fi
HTML=$(mktemp /tmp/html-XXXXXX).html || exit 1
trap 'rm -f "$HTML"; exit' 0 1 2 3 7 13 15
# Convert to HTML
$SGML_JADE -V nochunks -t sgml ${SGML_ARGUMENTS} >${HTML}
if [ $? -ne 0 ]
then exit 1
fi
# Convert from HTML to ASCII
${CONVERT} ${ARGS} ${HTML} > "${SGML_FILE_NAME}.txt"
if [ $? -ne 0 ]
then
exit 2
fi
exit 0
---------- snip -----------
Here is some info about my configuration:
- DocBook-utils version 0.6.14 (jw version 1.1)
- w3m version 0.5.1+cvs-1.968
- Ubuntu 7.10
Btw .. the e-mail address <eric@caldera.de> seems to be not valid
anymore.
Regards,
Christian
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bug in docbook-tools text backend using w3m
2007-11-16 14:25 bug in docbook-tools text backend using w3m Christian Bünnig
@ 2007-11-22 15:06 ` Ondřej Vašík
0 siblings, 0 replies; 2+ messages in thread
From: Ondřej Vašík @ 2007-11-22 15:06 UTC (permalink / raw)
To: Christian Bünnig; +Cc: docbook-tools-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1000 bytes --]
Hi,
Actually I would prefer to modify ARGS of w3m as is suggested in
man pages and as is done in xmlto docbook txt formatter.
(done in attached patch - I'll commit that one to Fedora)
About Eric Bischoffs current address - after a bit of google
searching, it seems that now he is using ebischoff@nerim.net
- but nothing guaranteed.
Greetings,
Ondrej Vasik
Christian Bünnig wrote:
> Hey,
>
> I've experienced a bug in the text backend of the docbook tools. The bug
> is about converting from HTML to TEXT with w3m. The backend creates a
> temporary HTML file to make a TEXT file from. However, the temporary
> HTML has no '.html' suffix and in that case w3m does not convert it to
> plain text - the resulting <FILE>.txt is still HTML.
>
> Below is a workaround. I just appended '.html' to the variable HTML
> (line 22). Now it works.
>
> Btw .. the e-mail address <eric@caldera.de> seems to be not valid
> anymore.
>
> Regards,
>
> Christian
>
>
[-- Attachment #1.2: docbook-utils-w3mtxtconvert.patch --]
[-- Type: text/x-patch, Size: 355 bytes --]
diff -urNp original/txt new/txt
--- original/backends/txt 2007-11-05 18:44:52.000000000 +0100
+++ new/backends/txt 2007-11-22 15:21:36.000000000 +0100
@@ -13,7 +13,7 @@ then
elif [ -x /usr/bin/w3m ]
then
CONVERT=/usr/bin/w3m
- ARGS="-dump"
+ ARGS="-T text/html -dump"
else
echo >&2 "No way to convert HTML to text found."
exit 1
[-- Attachment #2: Toto je digitálně podepsaná část zprávy --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-22 15:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-16 14:25 bug in docbook-tools text backend using w3m Christian Bünnig
2007-11-22 15:06 ` Ondřej Vašík
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).