vilistextum-2.6.9/ 0000777 0000764 0000144 00000000000 10517231456 011136 5 0000000 0000000 vilistextum-2.6.9/doc/ 0000777 0000764 0000144 00000000000 10517231456 011703 5 0000000 0000000 vilistextum-2.6.9/doc/screenshots.html 0000644 0000764 0000144 00000005411 10514645233 015045 0000000 0000000
Examples of vilistextum output
Example output
Unicode output
水<br>
Α Ω<br>
€<br>
Output of "vilistextum --output-utf-8"
水
Α Ω
€
Font styles
<b>bold</b><br>
<i>italic</i><br>
<u>underlined</u><br>
<em>emphasized<em><br>
<strong>strong</strong>
Output of "vilistextum --convert-tags"
*bold*
/italic/
_underlined_
/emphasized/
*strong*
Links
While processing the html document, vilistextum can collect all external links and
list them at the end or output them immediately after the closing tag.
Hypertext links:<br>
<a href="http://www.w3.org/">W3C Web site</a><br>
<a href="localdocument.html">A local document</a><br>
<a href="http://www.cnn.com/">CNN</a>
Output of "vilistextum --links"
Hypertext links:
[1]W3C Web site
A local document
[2]CNN
References:
1. http://www.w3.org/
2. http://www.cnn.com/
Output of "vilistextum --links-inline"
Hypertext links:
W3C Web site <http://www.w3.org/>
A local document
CNN <http://www.cnn.com/>
Transliteration
Vilistextum transliterates some entities that are not included in ISO-8859-1 (mainly
entities and characters from windows1252). The multibyte version of vilistextum only
transliterates when the entities don't fit into the target character set. This
behavior can be switched off with "--dont-convert-characters".
€ € €<br>
… … …<br>
™ ™ ™
Output of standard vilistextum
EUR EUR EUR
... ... ...
[tm] [tm] [tm]
Output of multibyte-enabled vilistextum
€ € €
… … …
™ ™ ™
Image options
<img href="..."><br>
<img href="..." alt=""><br>
<img href="..." alt="picture"><br>
Output with default options
[Image]
[]
[picture]
Output with "vilistextum --no-image --remove-empty-alt"
[picture]
Lists
<ul>
<li> first item </li>
<li> second item </li>
<ul>
<li> sub item </li>
</ul>
<li> third item </li>
</ul>
Output
* first item
* second item
o sub item
* third item
vilistextum-2.6.9/doc/vilistextum.1 0000644 0000764 0000144 00000005160 10517231454 014276 0000000 0000000 .TH VILISTEXTUM 1 "22 OCT 2006"
.SH NAME
vilistextum -
html to ascii converter
.SH SYNOPSIS
.B vilistextum
[OPTIONS] [inputfile |-] [outputfile | -]
.SH DESCRIPTION
vilistextum is a html to ascii converter specifically programmed to get the best out of incorrect html.
.SH OPTIONS
.TP
\fB\inputfile,- resp. outputfile,-
replace inputfile with '-' for reading from standard input, likewise outputfile with '-' for writing to standard output.
.TP
\fB\-a, --no-alt
don't output anything for IMG tags even if they have an ALT attribute. Implies --no-image.
.TP
\fB\-c, --convert-tags
some tags will be converted to special characters.
.TP
\fB\-e, --errorlevel NUMBER
increase level of verbosity for error messages (0: No error messages).
.TP
\fB\-i, --defimage STRING
IMG tags without alt attribute are output as [STRING].
.TP
\fB\-l, --links
numbers the links in the document and creates footnotes of each link at the end of the file.
.TP
\fB\-k, --links-inline
print the links directly after the html tag.
.TP
\fB\-m, --dont-convert-characters
don't convert the entities from windows1252 (- and their proper entity names)
.TP
\fB\-n, --no-image
don't output [Image] for IMG tags that have no ALT attribute.
.TP
\fB\-p, --palm
output text more suitable for reading on a PDA.
.TP
\fB\-r, --remove-empty-alt
if there is an empty ALT attribute in a IMG tag (eg
), don't output '[]'.
.TP
\fB\-s, --shrink-lines [NUMBER]
if there are more than NUMBER empty lines, output only NUMBER. Default: 1.
.TP
\fB\-t, --no-title
don't output title.
.TP
\fB\-w, --width NUMBER
maximum line width.
.SH
.TP
\fB\-h, --help
display this help and exit
.TP
\fB\-v, --version
output version information and exit
.SH MULTIBYTE OPTIONS (Only available if compiled with multibyte support)
.TP
\fB\-u, --output-utf-8
instead of the character set of the html document, everything will be output as utf-8.
.TP
\fB\-x, --translit
use the //TRANSLIT feature of libiconv. Consult the iconv manual for details.
.TP
\fB\-y, --charset CHARSET
if the HTML document doesn't provide a character set in the meta tags, use CHARSET.
.SH LIMITATIONS
The rendering of tables is not very good.
The handling of OL is incomplete. The program treats it as UL and more than 10 nested lists confuse it.
Text is never justified.
.SH REPORTING BUGS
Please report bugs to .
.SH AUTHOR
.B Vilistextum
was written by Patric Mueller and may be freely distributed under the terms of the GNU General Public License Version 2. There is ABSOLUTELY NO WARRANTY for this program.
.SH SEE ALSO
.BR iconv (3),
.BR lynx (1),
.BR links (1),
.BR w3m (1)
vilistextum-2.6.9/doc/htmlmail.html 0000644 0000764 0000144 00000007477 10426530172 014327 0000000 0000000
Reading HTML mail using vilistextum
<COMMERCIAL>
Do you suffer from relatives that always send html mails?
Do you hate those spam mails that are sent in html?
Have you subscribed to a newsletter but it doesn't offer a plain
ASCII version?
Stop puzzling what those tags mean! Stop trying to decipher
those html entities!
Try using the fabulous Vilistextum for converting your html mail
into readable ASCII!
</COMMERCIAL>
For the time being, I know how to convert HTML mails for mutt,
Gnus 5.8.8 and Gnus 5.10.
Instructions for other mail reader are welcome.
Put this in your .mailcap:
text/html; vilistextum %s - ; copiousoutput
And this in your .muttrc:
auto_view text/html
Put the following lines into your .gnus:
;; prefer to show plain text over markup for multipart/alternative
(setq mm-discouraged-alternatives (append mm-discouraged-alternatives
'("text/html" "text/richtext")))
;; add buttons and emphasize for html MIME parts
(add-to-list 'gnus-buttonized-mime-types '"text/html")
(add-to-list 'gnus-article-treat-types "text/html")
(add-to-list 'mm-text-html-renderer-alist
'(vilistextum mm-inline-render-with-file nil
"vilistextum" "-l" "-r" "-c" "-s" file "-"))
(add-to-list 'mm-text-html-washer-alist
'(vilistextum mm-inline-wash-with-file nil
"vilistextum" "-l" "-r" "-c" "-s" file "-"))
(setq mm-text-html-renderer 'vilistextum)
Put this in your .emacs, or .gnus or somewhere else where it might
be appropriate:
;; ---------------------------------------------------------------------
;; prefer to show plain text over markup for multipart/alternative
(setq mm-discouraged-alternatives (append mm-discouraged-alternatives
'("text/html" "text/richtext")))
;; adapted from Mark Thomas (swoon@bellatlantic.net)
;; use external program to view inline HTML
(when t ;; change to nil to comment out
(let ((old-text-html-test (assoc "text/html" mm-inline-media-tests))
(new-text-html-test '("text/html"
my:gnus-html2text
(lambda (handle)
(fboundp 'my:gnus-html2text)))))
(if old-text-html-test
(setcdr old-text-html-test (cdr new-text-html-test))
(setq mm-inline-media-tests (cons new-text-html-test
mm-inline-media-tests)))))
;; function to call to handle text/html attachments
(defun my:gnus-html2text (handle)
(let (text)
(with-temp-buffer
(mm-insert-part handle)
(save-window-excursion
(my:html2text-region (point-min) (point-max))
(setq text (buffer-string))))
(mm-insert-inline handle text)))
(defun my:html2text-region-vilistextum (min max)
"Replace the region with the result of running vilistextum on it. "
(interactive "r")
;; vilistextum accepts html on stdin
(call-process-region min max "vilistextum" t t t "-clrs" "-" "-"))
(defalias 'my:html2text-region 'my:html2text-region-vilistextum)
;; ---------------------------------------------------------------------
Patric Mueller
vilistextum-2.6.9/doc/manual.html 0000644 0000764 0000144 00000007423 10517231455 013767 0000000 0000000
Vilistextum man page
NAME
vilistextum -
html to ascii converter
SYNOPSIS
vilistextum
[OPTIONS] [inputfile |-] [outputfile | -]
DESCRIPTION
vilistextum is a html to ascii converter specifically programmed to get the best out of incorrect html.
OPTIONS
- inputfile,- resp. outputfile,-
-
replace inputfile with '-' for reading from standard input, likewise outputfile with '-' for writing to standard output.
- -a, --no-alt
-
don't output anything for IMG tags even if they have an ALT attribute. Implies --no-image.
- -c, --convert-tags
-
Some of the tags will be converted to special characters.
- -e, --errorlevel NUMBER
-
Increase level of verbosity for error messages.
- -i, --defimage STRING
-
IMG tags without alt attribute are output as [STRING].
Default: Image.
- -l, --links
-
Numbers the links in the document and creates footnotes of each link at the end of the file. Similar to 'lynx -dump'.
Relative URIs are not resolved and won't be printed.
- -k, --links-inline
-
print the links directly after the html tag.
- -m, --dont-convert-characters
-
The entities from windows1252 (€ - Ÿ and their proper entity names) will not be converted.
- -n, --no-image
-
don't output [Image] for IMG tags that have no ALT attribute.
- -p, --palm
-
This outputs text more suitable for reading on a PDA.
Palm textreaders do their own word wrapping, so the width is set to infinity and the program doesn't right justify or center the text.
- -r, --remove-empty-alt
-
if there is an empty ALT attribute in a IMG tag (eg <IMG href="..." alt="">), don't output '[]'.
- -s, --shrink-lines [NUMBER]
-
If there are more than number empty lines, output only NUMBER.
Default: 1.
- -t, --no-title
-
Don't output title of the HTML document
- -w, --width NUMBER
-
Maximum width of the output text.
Default: 72.
- -h, --help
-
print a list of the command line options.
- -v, --version
-
output version information and exit
MULTIBYTE OPTIONS (Only available if compiled with multibyte support)
- -u, --output-utf-8
-
instead of the character set of the html document, everything will be output as utf-8.
- -x, --translit
-
use the //TRANSLIT feature of libiconv. Consult the iconv manual for details.
- -y, --charset CHARSET
-
if the HTML document doesn't provide a character set in the meta tags, use CHARSET.
LIMITATIONS
The rendering of tables is not very good.
The handling of OL is incomplete. The program treats it as UL and more than 10 nested lists confuse it.
Text is never justified.
REPORTING BUGS
Please report bugs to bhaak@gmx.net.
AUTHOR
Vilistextum
was written by Patric Mueller <bhaak@gmx.net>.
It may be freely distributed under the terms of the GNU General Public License Version 2. There is ABSOLUTELY NO WARRANTY for this program.
SEE ALSO
iconv(3),
lynx(1),
links(1),
w3m(1)
vilistextum-2.6.9/doc/Makefile.am 0000664 0000764 0000144 00000000156 10142706462 013655 0000000 0000000
man_MANS = vilistextum.1
EXTRA_DIST = README.html manual.html screenshots.html htmlmail.html vilistextum.1
vilistextum-2.6.9/doc/Makefile.in 0000644 0000764 0000144 00000020121 10517222277 013661 0000000 0000000 # Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KAPTAIN = @KAPTAIN@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
man_MANS = vilistextum.1
EXTRA_DIST = README.html manual.html screenshots.html htmlmail.html vilistextum.1
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
NROFF = nroff
MANS = $(man_MANS)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
uninstall-info-am:
man1dir = $(mandir)/man1
install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man1dir)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
done
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
rm -f $(DESTDIR)$(man1dir)/$$inst; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(man1dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am:
install-info: install-info-am
install-man: install-man1
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man
uninstall-man: uninstall-man1
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am info info-am install \
install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-man1 install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
uninstall-am uninstall-info-am uninstall-man uninstall-man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
vilistextum-2.6.9/doc/README.html 0000644 0000764 0000144 00000003765 10517206310 013444 0000000 0000000
Vilistextum
Overview
This is release 2.6.9 (22 October 2006) of Vilistextum.
Vilistextum is a html to text / ascii converter specifically programmed to get the
best out of incorrect html. It is released as free software under the terms of the
GNU GPL Version 2.
Some features:
- small and fast
- understands HTML 3.2 upto 4.01 and XHTML 1.0
- creates footnotes for links
- can swallow multiple empty lines
- removes empty ALT attributes
- converts characters and entities between 128 and 159 from the
windows1252 charset to meaningful strings in ISO-8859-1. E.g. 0x93 is converted
to ".
- output can be optimized for ebook reading
- GUI-frontend using kaptain
- supports various multibyte encodings (e.g. Unicode, Shift_JIS)
REQUIREMENTS:
For multibyte support your system needs libiconv.
If you want to use the GUI-frontend, you need to have
kaptain installed.
How to read HTML mail with gnus or mutt using vilistextum
If you want to use vilistextum for automatically converting html mails to
ascii read htmlmail.
Bug reports or comments:
You can send your comments or bug reports in German or English to
bhaak@gmx.net.
If you've discovered a bug, please also include the link or attach a copy of the
html file that caused the bug.
There is a mailinglist on Sourceforge.
Patric Müller
vilistextum-2.6.9/src/ 0000777 0000764 0000144 00000000000 10517231456 011725 5 0000000 0000000 vilistextum-2.6.9/src/debug.h 0000664 0000764 0000144 00000000236 10327144206 013076 0000000 0000000
/* #define debug */
/* #define center_debug */
/* #define proc_debug */
/* #define attr_debug */
/* #define wort_ende_debug */
/* #define default_debug */
vilistextum-2.6.9/src/lists.c 0000644 0000764 0000144 00000006717 10364756612 013164 0000000 0000000 /*
* Copyright (c) 1998-2006 Patric Müller
* bhaak@gmx.net
* http://bhaak.dyndns.org/vilistextum/
*
* Released under the GNU GPL Version 2 - http://www.gnu.org/copyleft/gpl.html
*
* 04.09.01: added some more bullet_styles.
* 15.03.04: lists generate less newlines
*
*/
#include
#include
#include "html.h"
#include "text.h"
#include "debug.h"
CHAR bullet_style=' ';
/* ------------------------------------------------ */
int check_style()
{
while (ch!='>')
{
ch=get_attr();
#ifdef debug
printf("checkstyle; attr: %s; Inhalt: %s#\n",attr_name,attr_ctnt);
#endif
if CMP("TYPE", attr_name)
{
if CMP("disc", attr_ctnt) { return '*'; }
if CMP("square", attr_ctnt) { return '+'; }
if CMP("circle", attr_ctnt) { return 'o'; }
}
}
return 0;
} /* end check_style */
/* ------------------------------------------------ */
void start_uls()
{
/*int ret; */
#ifdef proc_debug
printf("start_uls()\n");
#endif
line_break();
push_align(LEFT);
/* * o + # @ - = ~ $ % */
if (bullet_style==' ') { bullet_style='*'; }
else if (bullet_style=='*') { bullet_style='o'; }
else if (bullet_style=='o') { bullet_style='+'; }
else if (bullet_style=='+') { bullet_style='#'; }
else if (bullet_style=='#') { bullet_style='@'; }
else if (bullet_style=='@') { bullet_style='-'; }
else if (bullet_style=='-') { bullet_style='='; }
else if (bullet_style=='=') { bullet_style='~'; }
else if (bullet_style=='~') { bullet_style='$'; }
else if (bullet_style=='$') { bullet_style='%'; }
spaces += tab;
#ifdef proc_debug
printf("start_uls() ende\n");
#endif
} /* end start_uls */
void end_uls()
{
spaces -= tab;
line_break();
if (bullet_style=='%') { bullet_style='$'; }
else if (bullet_style=='$') { bullet_style='~'; }
else if (bullet_style=='~') { bullet_style='='; }
else if (bullet_style=='=') { bullet_style='-'; }
else if (bullet_style=='-') { bullet_style='@'; }
else if (bullet_style=='@') { bullet_style='#'; }
else if (bullet_style=='#') { bullet_style='+'; }
else if (bullet_style=='+') { bullet_style='o'; }
else if (bullet_style=='o') { bullet_style='*'; }
else if (bullet_style=='*') { bullet_style=' '; }
pop_align();
} /* end end_uls */
/* ------------------------------------------------ */
void start_ols()
{
start_uls();
} /* end start_ols */
/* ------------------------------------------------ */
void end_ols()
{
end_uls();
} /* end end_ols */
/* ------------------------------------------------ */
void start_lis()
{
spaces-=2;
/* don't output line break, if this list item is immediately
after a start or end list tag. start_uls and end_uls have
already take care of the line break */
if (!is_zeile_empty()) { line_break(); }
wort_plus_ch(bullet_style);
/* } */
wort_ende();
spaces+=2;
} /* end start_lis */
/* ------------------------------------------------ */
void end_lis() { }
/* ------------------------------------------------ */
int definition_list=0;
void end_dd();
/* Definition List */
void start_dl()
{
end_dd();
start_p();
} /* end start_dl */
void end_dl()
{
paragraphen_ende();
end_dd();
} /* end_dl */
/* Definition Title */
void start_dt()
{
end_dd();
line_break();
} /* end start_dt */
void end_dt()
{
} /* end_dt */
/* Definition Description */
void start_dd()
{
end_dd();
line_break();
spaces+=tab;
definition_list=1;
} /* end */
void end_dd()
{
if (definition_list==1)
{
spaces-=tab;
definition_list=0;
}
} /* end_dd */
vilistextum-2.6.9/src/lists.h 0000644 0000764 0000144 00000000370 10025376454 013152 0000000 0000000 #ifndef lists_h
#define lists_h 1
void start_uls();
void end_uls();
void start_ols();
void end_ols();
void start_lis();
void end_lis();
void start_dl();
void end_dl();
void start_dt();
void end_dt();
void start_dd();
void end_dd();
#endif
vilistextum-2.6.9/src/charset.c 0000644 0000764 0000144 00000007726 10364756522 013460 0000000 0000000 /*
* Copyright (c) 1998-2006 Patric Müller
* bhaak@gmx.net
* http://bhaak.dyndns.org/vilistextum/
*
* Released under the GNU GPL Version 2 - http://www.gnu.org/copyleft/gpl.html
*
* history
* 14.10.2001: creation of this file
*
*/
#include <../config.h>
#include
#include
#include
#include
#include
#ifdef MULTIBYTE
#include
#endif
#include "main.h"
#include "text.h"
#include "multibyte.h"
char *default_charset = "iso-8859-1";
char iconv_charset[DEF_STR_LEN];
int usr=0;
#ifdef MULTIBYTE
iconv_t conv;
#endif
/* ------------------------------------------------ */
#ifdef MULTIBYTE
void init_multibyte()
{
char *ret;
ret = setlocale(LC_CTYPE, INTERNAL_LOCALE);
if (ret==NULL) {
fprintf(stderr, "setlocale failed with: %s\n\n", INTERNAL_LOCALE);
exit(1);
}
/*else { fprintf(stderr, "%s\n", ret); } */
}
#endif
/* ------------------------------------------------ */
#ifdef MULTIBYTE
int convert_character(int num, CHAR *outstring)
{
char in[33], out[33];
size_t result=(size_t)(-1);
int i;
int converted; /* has the entity been successfully converted */
char *inp, *outp;
size_t insize = 1, outsize = 32;
/* no conversion needed */
if (option_output_utf8) {
outstring[0] = num;
outstring[1] = L'\0';
return 1;
}
#ifdef proc_debug
printf("convert_character start\n");
#endif
/*#define iconv_debug 1 */
for (i=0; i<33; i++) { in[i]=0x00; out[i]=0x00; }
inp = in;
outp = out;
insize = wctomb(inp, num);
/* printf("iconv_charset: -%s-\n", iconv_charset); */
/* printf("insize %d\n", insize); */
if ((conv = iconv_open(iconv_charset, "utf-8"))==(iconv_t)(-1))
{ printf("iconv_open failed in convert_character: wrong character set?\n"); perror(iconv_charset); exit(1); }
result = iconv(conv, &inp, &insize, &outp, &outsize);
iconv_close(conv);
if (result==(size_t)(-1))
{
#ifdef iconv_debug
printf("convert_character: not converted: %d;", num);
#endif
/*swprintf (outstring, 32, L"%d;\0", num); */
/*fprintf(stdout, "%ls\n", outstring); */
converted = 0;
/* if the entity is 160 (nbsp), use ' ' instead */
if (num==160) {
converted = 1;
outstring[0] = L' '; outstring[1] = L'\0';
}
} else {
#ifdef iconv_debug
printf("convert_character: Input '%s'; Output '%s'\n", in, out);
#endif
converted = 1;
outstring[0] = num;
outstring[1] = L'\0';
#ifdef iconv_debug
printf("convert_character: Result %d; outstring: %ls: out %s\nstrlen(out) %d; \n", result, outstring, out, strlen(out));
#endif
}
#ifdef iconv_debug
printf("convert_character: fertig %d -%ls-\n", converted, outstring);
#endif
#ifdef proc_debug
printf("convert_character end\n\n");
#endif
return(converted);
} /* end convert_character */
#endif
/* ------------------------------------------------ */
char* get_iconv_charset()
{
return(iconv_charset);
}
/* ------------------------------------------------ */
void set_iconv_charset(char *charset) {
/* set charset for iconv conversion */
strcpy(iconv_charset, charset);
if (transliteration) { strcat(iconv_charset, "//TRANSLIT");}
/* printf("iconv_charset %s\n", iconv_charset); DEBUG */
}
/* ------------------------------------------------ */
void use_default_charset() { set_iconv_charset(default_charset); }
/* ------------------------------------------------ */
#ifdef MULTIBYTE
void strip_wchar(CHAR *locale, char *stripped_locale)
{
CHAR *in = locale;
char *out = stripped_locale;
int len;
int i;
#ifdef proc_debug
printf("strip_wchar start\n");
#endif
/*printf("locale: -%d-%d-\n", locale[0], locale[1]); */
len = STRLEN(locale);
/* copy stripped string to out */
for (i=0; i