[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    html input filter status report
From:       Frank Dekervel <Frank.dekervel () student ! kuleuven ! ac ! Be>
Date:       2001-09-12 0:24:56
[Download RAW message or body]

Hello,

i worked a bit more on my html filter. Here are the results:
- moved to using a stack explicitly (QStack) to keep track of the current 
state. The 'current state' tracking should be okay, but i needed hacks to 
implement things like 'BR' that infact do create a new paragraph in the 
'parent' state (because a BR tag has no childs, and kword does not support 
line breaks instead of paragraphs, right ?)
- implemented a lot of tags. implemented tags include:

P (no attributes are parsed yet),BR,TABLE (with sizes and bgcolor -- no 
borders yet),PRE,UL,OL,FONT (face,size,color),HR (almost)
B,STRONG,U,I,CENTER,LEFT,RIGHT

It doesn't seem like a lot, but its enough to convert dot.kde.org and 
slashdot to something recognisable.
I could now add more and more tags to make my filter complete, but i'll have 
to think a bit first:

- maybe once the khtml guys will implement getComputedStyle() to do something 
more than "return 0;", so i'll be able to get rid of almost everything (i'll 
need a little code for parsing special tags like table and so, but no more 
state-tracking, no more writing c++ code for translating both align="left" 
and <left> to ALIGN value=left ...
I'll just need a style->kword format/layout/layoutformat/style mapping.
and have perfect html+styles support for free. that would be the ideal
world...

- to support things like <UL> and <BR> i had to add several ugly hacks to my 
code, and since i didn't want to extend kwdwriter to huge proportions, bye 
bye nice design... I'll think about a cleanup or even yet another rewrite (if 
i'll rewrite i'll use a totally different approach for kwdwriter with a lot 
of classes (like a KWDParagraph, KWDFormat, KWDLayout, ... childs of 
QDomElement), because i saw it would be much nicer/better than with the 
current kwdwriter code..

I have a bit more problems with kword:
- i now make a 'guess' for table cell sizes thats vertically a bit too small 
because i don't know the font sizes and so... (this will get better if 
getComputedStyle will be there i think), kword does a nice job of 
autoresizing them to the right height, but only if i click on them. And if i 
click on them it triggers a cascade of resizes and repaints, often resulting 
in an endless loop.
- kword has severe painting problems with imported docs. I don't know if its 
due to my buggy kwd code (no kword styles yet, eg) or due to kword bugs. Try 
to convert dot.kde.org and click on the table cells to see what i mean.

I think now would make a nice moment to import my filter into CVS, even when 
considering a possible rewrite, because the thing i have now is usable, and 
it would be easier for other people to give some toughts on the 
design/implementation.
But i have a few problems here too: i'm still using kde 2.2 - so does my 
filter (upgrading when i earned the money to buy a new disk .. :p), and the 
filter has a broken build system based on a kdevelop app template (that does 
not compile) + a build_shared_lib.sh that builds libhtmlimport.so. (to build 
do make, ignore the errors and then run that script, and to install overwrite 
your old libhtmlimport.so).
Nicolas Goutte said said he'd help me a bit with cvs and qt3 porting already 
...

(the filter is at the usual place: 
http://www.student.kuleuven.ac.be/~m9823990/html2kwd.tbz2
i changed the license to LGPL)

greetings,
Frank
_______________________________________________
Koffice-devel mailing list
Koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic