Re: Tags in Abiword XML


Subject: Re: Tags in Abiword XML
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sat Jan 12 2002 - 08:52:55 CST


On Thu, 10 Jan 2002, January Weiner 3 wrote:

> Hello,
>
> I'm working on a simple script which would allow to add bibliography to abw
> documents in a way similar to BibTex (actually, using BibTex databases).
> Right now it works very nicely -- you got styles, you can easily add your
> own styles, you feed the abw document through the parser and get a nicely
> formatted bibliography in the style of your choice.
>
> There is, however, one catch: once you've got the document you cannot
> reformat it in an other style, because the labels disappeared and my script
> has no way of knowing where the bibliography references were. I would need
> a special, custom tag, something like this:
>
> <bibentry style="something" key="weiner2000">
> <c prop="font-weight:bold">Weiner</c>, 2000
> </bibentry>
>
> <bibliography>
> <c prop="font-weight:bold">Weiner</c>, 2000.
> <c prop="font-style:italic">Transcription in Mycoplasma pneumoniae.</c>
> Nucleic Acids Res. 28:4488-96.
> </c>
> </bibliography>
>
> Some custom tag I could put in the document, ignored by Abiword (which is
> does), but *preserved by Abiword* when I save the document (which it does
> not). Is there any existing mechanism which would work like that? Could I
> use any of the existing, defined tags for my purpose?

You could use "list-tag" which is totally ignored by the formatter but
preserved upon import/export.

Alternatively you could invent your own tag just add a line or two to
make sure it is recognised by the abiword importer.

see src/wp/impexp/ap/ie_imp_AbiWord_1.cpp

Just add you own tag to the list of recognised tags you'll find in the
file.

AbiWord will automatically export the tag to it's XML fileformat for you.

>
> I know, something like that should be coded as a plugin, but I am a
> full-time scientist and there is a huge time-consumption difference between
> writing a simple, yet useful perl script (which I did with a couple of
> hours investement, and the results are already functional) and coding a
> plugin.
>

Actually for a plugin you could just subclass ie_imp_AbiWord_1.cpp with
your own custom importer methods. Most of the rest of the code is boiler
plate.

Look at Dom's Open Office importer plugin for clues.

Cheers

Martin

(Also a full-time scientist :-)

-----------------------------------------------
To unsubscribe from this list, send a message to
abiword-user-request@abisource.com with the word
unsubscribe in the message body.



This archive was generated by hypermail 2b25 : Sat Jan 12 2002 - 08:53:13 CST