[Libreoffice] fdo#42924: needs help with "tablehead" xml parsing
Jan Holesovsky
kendy at suse.cz
Mon Nov 28 09:33:23 PST 2011
Hi Korrawit,
On 2011-11-23 at 23:56 +0700, Korrawit Pruegsanusak wrote:
> Following https://bugs.freedesktop.org/show_bug.cgi?id=42924,
> this is an unfinished patch to check whether <tablecell> is empty.
> Hope I was on the right way :)
I'm terribly sorry I am answering this late :-( Thank you for the ping
on the IRC - unfortunately you were gone when I returned...
> Anyway, as commented in the code, how can I detect whether that row is
> "tablehead" or not? Currently I just set role = tablecontent.
> See http://cgit.freedesktop.org/libreoffice/help/tree/helpcontent2/source/text/scalc/01/04060107.xhp#n219
> as an example.
> The first tablecell (line 221-222) is empty.
> Next 3 are with <paragraph role="tablehead" ...>
> If I take an approach like in the patch, the first one won't be
> "tablehead", and formatting will be a bit incorrect.
> But IMHO the xml parser can't get back to parsed element, right?
> So, suggestions are appreciated.
That it is true, it cannot; but still we in fact have 2 passes in the
wikiconv2.py - 1) when it parses the xml, and builds the internal
representation, and 2) when it outputs the wiki page.
So in fact, you could check the parent of the cell (ie. row) later, in
get_all(), you have all the information there. If it is the first row,
and if there are any cells that are using tablehead style, you could use
that style for all I think.
To get a brief idea what I mean with the check in get_all(), please have
a look at the ListItem:
http://cgit.freedesktop.org/libreoffice/help/tree/helpcontent2/to-wiki/wikiconv2.py#n547
[where it checks "if self.parent.startwith > 0:"]
> Or, will we take another approach by fixing the help file instead?
> (bugzilla comment 2 by Andras)
I think fixing the parser will be easier, and actually more fun :-) To
test your change, I recommend you to do one output without your change,
then one with your change, diff -pur over those 2 directories, and check
the result...
Sorry again for my late response :-(
All the best,
Kendy
More information about the LibreOffice
mailing list