Hi,
On 10/27/07, Aidan Morgan <aidos(a)westnet.com.au> wrote:
Hi guys,
This is my first post, so I am sorry if I am posting it to the wrong email
list.
This is the right list if you intend to share with the community the
resulting applications, but the users list would have been better.
I am currently working on a PhD at the University of
Western Australia and
am interested in using a Wiki to manage all of my references/publications. I
have used Confluence before, however I have decided to switch to XWiki
because it's open source and I can make the changes I want (and contribute
them back to the group).
For a bit of background I am currently a Senior Software Engineer for a
software company in Perth Western Australia, and I have had experience using
Hibernate, Velocity, Struts and some JEE architectural work.
What I plan to do is build two applications/plugins that will run inside
XWiki with some interaction between them. I want to create a Class and
associated editors for storing/retrieving all of my citations (in BibTeX
format). Once I have done that I would also like to create an editor that
allows me to create papers in LaTeX format and render them using the LaTeX
-> XHTML converter, allowing me to work on my papers from home, work or uni.
To get started I have a few questions, I will start with just the one and I
expect to be asking more as time goes on :-)
1. I have used the FAQ tutorial to create a new "Class" for rendering the
FAQ pages however my BibTeX pages need a bit more structure than one class.
Basically I expect two objects to be persisted in the database, a BibTeX
header and an object that represents the type (in a map I assume). Each
entry type (paper, confrence proceeding, book, URL etc.) has different
fields that are mandatory and are able to be set. I imagine I would have a
simple Interface called BibTexData that is associated with a BibTexEntry,
and put the correct version in depending on what it is. It is feasable that
I want to change the "type" after the page is created (as most decent BibTeX
database applications allow me to do). How do I design this using the class
editor wizard, or am I better off creating this structure manually in the
hibernate mappings and code?
First of all, all objects are persisted in the database, but not as
you usually expect from a object2relational mapping. You should not
try to change the mapping files or alter the database structure in any
way. XWiki allows defining custom mappings for XObjects, but that is
only for special needs.
The easiest way to handle the differences in the BibTeX entry types is
to put all the possible fields in one XClass, and filter the needed
properties in the display sheet. This will require more if-else
programming in the sheet and BibTeX-processing code, but will save you
of a lot of trouble. To illustrate how this would work, you will have
to manually create the sheet, or to edit the sheet after creating it
using the class wizard, and write stuff like:
#if($obj.type == "book" || $obj.type == "inproceedings")
$doc.display("publisher", $obj)
#end
The second way would be to create one common class, BibType, with only
one field, "type", and one class for each bibtex entry type. A
document would contain one BibType object, and one object of the other
classes, like BibBook, and the sheet would be generic, displaying all
the fields of the other object, something like:
#set($bibtypeobj = $doc.getObject("XWiki.BibType"))
#set($bibtype = $bibtypeobj.getProperty('type').value)
#set($obj = $doc.getObject("XWiki.Bib${bibtype}"))
#set($class = $obj.xWikiClass)
## the same code as in skins/albatross/editobject.vm for displaying
the properties
Now, if you want to change the object type, you would have to write a
velocity template that is able to create a new object, clone the
common fields from the existing object, add it to the document and
remove the old object.
The second way is better at the level of semantics and data
organization, but requires more programming and more advanced
programming.
Once you manage to create this application, it would be nice if you
export it and upload on the
xwiki.org code zone.
For the second part, LaTeX to HTML, the way I see things you should:
1. Create a plugin that uses an external tool for the conversion,
using a shell command, for example
2. Write a velocity template (latex2html.vm) that calls the plugin,
something like $xwiki.getPlugin('latex2html').convert($doc.getContent)
3. Put somewhere in the page a link to $doc.getURL("view",
"xpage=latex2html"), for example in the Export section of the menu.
Good luck!
Sergiu
--
http://purl.org/net/sergiu