diff --git a/TODO.md b/TODO.md index 049f41d..12e64c1 100644 --- a/TODO.md +++ b/TODO.md @@ -56,6 +56,10 @@ * tags: remove tags for modified line * undo: undo some cursor movements * xml: merge xml and htmlsrc modes, add submodes for plist and other config files +* tack library of ancillary files at the end of the binary: + - add protocol to read from library (lib:xxx) + - add html.min.css and docbook.min.css to library + - append lib: to default QE_PATH ## Priority 0 diff --git a/libqhtml/Makefile b/libqhtml/Makefile index e28d144..8ec7292 100644 --- a/libqhtml/Makefile +++ b/libqhtml/Makefile @@ -77,6 +77,7 @@ OBJS= css.o xmlparse.o cssparse.o html_style.o docbook_style.o DEPENDS:= qe.h config.h cutils.h display.h qestyles.h config.mak DEPENDS:= $(addprefix $(DEPTH)/, $(DEPENDS)) +DEPENDS+= css.h cssid.h htmlent.h BINDIR:=$(DEPTH)/bin diff --git a/libqhtml/csstoqe.c b/libqhtml/csstoqe.c index 698b9cf..c08efc0 100644 --- a/libqhtml/csstoqe.c +++ b/libqhtml/csstoqe.c @@ -20,9 +20,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include -#include +#include static int peekc(FILE *f) { @@ -32,6 +33,26 @@ static int peekc(FILE *f) return c; } +static int compat_char(int c1, int c2) +{ + if ((isalnum(c1) || c1 == '_' || c1 == '$') + && (isalnum(c2) || c2 == '_' || c2 == '$')) + return 0; + + if ((c1 == c2 && strchr("+-<>&|=", c1)) + || (c2 == '=' && strchr("<>!+-*/&|^%", c1)) + || (c1 == '-' && c2 == '>') + || (c1 == '/' && c2 == '/') + || (c1 == '/' && c2 == '*') + || (c1 == '*' && c2 == '/') + || (c1 == '<' && c2 == '/') + || (c1 == '.' && isdigit(c2)) + || (isdigit(c1) && c2 == '.')) + return 0; + + return 1; +} + int main(int argc, char **argv) { int c, n, last_c, got_space, in_string; @@ -95,18 +116,20 @@ int main(int argc, char **argv) printf(" \""); } /* add separator if needed */ - if (!in_string && got_space && isalnum(c) && isalnum(last_c)) { - putchar(' '); - n++; + if (!in_string && got_space) { + if (!compat_char(last_c, c)) { + putchar(' '); + n++; + } } if (c == '\"' || c == '\'' || c == '\\') { putchar('\\'); n++; } putchar(c); - if (c == '\"') { - /* CG: does not work for ' ' */ - in_string ^= 1; + if (c == '\"' || c == '\'') { + if (in_string == c || in_string == 0) + in_string ^= c; } last_c = c; got_space = 0;