Planet Linuxchix.org.in - Linuxchix India Chapter

July 02, 2009

Satya Komaragiri

DocBook Editor 2

Just completed a tiny DTD for DocBook corresponding to the small set of tags for which I had written the XSLs. I am so glad it works! (http://dev.gentooexperimental.org/~n9986/beacon/editor/ works best with firefox)

Now on it is just a matter of adding more elements to get a richer tag-set for DocBook till the mid-term evals. The basic infra is all set up (will try to keep improving usability though).

Also added a brand new and better CSS.

On the other side I think I should try and get more community involvement into developing the editor as the number of DocBook elements is *huge*.

I'll start by explaining what beacon is and how it works.

Beacon is a What you see is what you mean editor which relies heavily on XSL for XML to HTML conversions and vice-versa.

Most of the work involved in making a plugin is writing the two XSLs. One is required for converting the XML to HTML so that it can be displayed in the browser. And the other for converting the HTML back to XML. All these operations are done on the server side using PHP (or Python).

One may wonder, why rewrite XSLs if they already exists, like for Docbook for example. The reason is that Beacon needs some 'hooks' in the generated HTML so it can pick up the nodes using Javascript. This is required to do multitude of tasks like rendering inline editors, maintaining structural sanity, addition/deletion of new nodes, etc. Since HTML and Docbook XML tags are very different, there needs to be some way to map the XML tags over to HTML. These hooks are done using title attribute on tags. So for example, the tag will be rendered in HTML as:

p title = "docbookPara"> Somethings are best with a title /p >

Title tags tend to be most unobtrusive here and works well for DOM manipulation which is made even easier thanks to jQuery.

Once the HTML has been rendered, some Javascript magic makes it editable via inline editors of various types. We are still working on the node adding/deleting feature. Once that is done we will have a more or less a complete editor.

The validation of the generated HTML is kept in check via a Javascript based DTD.

So the user cycle of Beacon is:

new document -> XML -> HTML -> XML

All ajax-y communication is handled by JSON (except for file upload which uses an iframe of course).

Since its a web based it relies completely on Ajax for any post first page load. The UI is pretty much like a desktop Application with Tabs, sidebar etc.

To sum it up, a plugin now requires:
  1. Couple of XSLs
  2. Javascript based DTD
  3. Some trivial PHP code
  4. CSS + some template XMLs

I will write a tutorial on how to make a plugin for docbook next. Will be nice if folks chip in to get in as many tags supported as possible.

by satya (noreply@blogger.com) at July 02, 2009 01:34 PM

DocBook Editor 1

It's been very quiet in here. This month has been a marathon of coding and a lot of other events on the home front.

First off, a few non-GSoC related developments:
  • I finished college. (Phew!)
  • I got placed in Red Hat as an Associate Software Engineer. (gleee!)
  • I won the Sun India Code For Freedom contest for my B. Tech Project. (ZOMG!! yes that was COMPLETELY unexpected!)
  • I went out for a small trip this weekend after almost 2 years.
Now to the DocBook Editor...

I started off by learning XSLT (tough!) and making an initial RPM for Beacon and submitted it for review. I created a Feature page and worked on deciding on an initial subset with the help of the Fedora-docs list.

Here are a few links to complement the above:

https://fedoraproject.org/wiki/DocBook_Editor_Documentation
https://fedoraproject.org/wiki/Features/DocBookEditor
https://fedoraproject.org/wiki/DocBook_Editor

Then, I constructed an initial XSL by referring to the example DocBook file in the Fedora Documentation repository and based on the initial tag set that was selected after a community review.

Initially, I fixed a few bugs in Beacon to learn the source code and worked on making it more convenient to add plug-ins by changing the implementation so that beacon needs only a DTD from the plug-in makers (which is us) rather than having us code the whole Javascript. A successful implementation of this would save a lot of time in feature addition and creation of plugins.

Apart from the DTD, I was learning the tools more from implementation perspective like JavaScript and jQuery library used in Beacon.

The last week has been the most exciting. Working with Nandeep Mali, the lead Beacon dev and my point of contact for the Beacon upstream, we got the DTD feature implemented to some extent and its working like a charm. The WYSIWYM is also working and just few more additions need to be done to make this a solid XML editor.

The DTD is actually a giant Javascript object which contains details about every node and its structure (like child, parent, siblings). One may think that why not use an existing WYSIWYG editor like TinyMCE. This is not very feasible because WYSIWYG editors are notorious for
the output they produce. This is what Beacon is trying to avoid by adding a different type of editor. The user will be places with a fill-in-the-blanks type of editor so the generated XML will retain its sanity and conform to Docbook DTD. Makes it easy for the Docs team as well.

Now for the treat: http://dev.gentooexperimental.org/~n9986/beacon/editor/

The above URL is a demo of what we have been working with (I hope the Gentoo URL is not a problem. Beacon was a Gentoo SoC project and I cannot get PHP with JSON and XSLs on my fedora account).

The work till now mainly consisted of writing the XSLs for DocBook and making changes to the beacon core. One final enhancement in the usability of beacon would be a drag and drop feature that has not been committed so far as it is very slow at the moment. Once that is ready it will be very easy to add nodes at any point and still not mess up the corresponding XML.

I have been writing the DTD for DocBook since yesterday and will be able to commit it by very soon. So we can expect another blog post about it very soon.

Has been a fun journey so far. More to come in the next post.

by satya (noreply@blogger.com) at July 02, 2009 03:01 AM

June 30, 2009

Kadambari Devarajan

Cycle Jackie Chan...

It's a thriller coz he is dangerous for me and I beat it when he's around, bad guy that he is else there'll be blood on the dance floor which is unfotunately not dirty Diana's. Who is it that spilled the blood then? Heal the world even though all I wanna say is that they don't really care about us.Things are now just black and white...

* Although his name rhymes with the title, I've somehow found an uncanny association between Michael Jackson and Bruce Lee. His death just reaffirms it!
* He might be most famous for his music and gyrations but what really impressed me is his patent on Antigravity shoes! Seems so reverently Kramer-ish!
* Some trivia - his autobiography was apparently code named "Neil Armstrong", for obvious moonwalking reasons.
* Some references close home - (a) there was a music store near my house (in Madras) that was called "Moon Walk" that had a really catchy and interesting decor... They unfortunately closed it down a few years ago but their "Man on the Moon" work, visible at all times over the front shutter (there has to be a name for this!,) is still vividly memorable. (b) Surya's gyrations to the song "Yethi Yethi..." from the film "Vaaranam Aayiram", a tribute to MJ from Gautham Menon (c) Reality tv show on Prabhu Deva, who used to famously rip of MJ, and was his initial claim to fame before he stopped imitating and started displaying his actual genius in performances/choreography... I saw an episode of this because I underwent exactly ONE dance lesson (in Lambada) from one of the contestants!
* The first songs I heard by MJ and my favorites as a kid (under 10-er) were "Heal the World" and "All I Wanna Say is That", more for the lyrics than the music. Obviously.
* I, initially, heard more of MJ only because of Macaulay Culkin, who I think was a reincarnation of Winnie-the-Pooh for his "cuteness factor" alone, and the frequent mentions of "Neverland".
* Personally, I don't think someone with all the quirks mentioned above and who thought of himself as "Peter Pan" can molest anyone!

June 30, 2009 08:23 PM

Even Parallel Lines Meet at Infinity...

(Pardon the meter, and this terrible excuse for a poem. A literary disgrace, it might be, but 'tis necessary for me!)

Distance makes the heart grow fonder, they say
Many a time that might be true,
But sometimes, miles and miles away
Is simply just not right, I rue.

Happy, I should be, with life working out,
But why is being alone tearing me apart?
Why this hurt, this pain? I shout.
Handling all this with a smile is an art!

So used to staying in constant touch,
So used to sharing every smile, every tear.
Forced separation tears me too much,
I'm muddled,confused, and nothing's clear.

It should not be so painful or difficult.
Why is handling my emotions so hard?
The feelings are mutual and shared, but
Circumstance is making me the sad bard!

It has only been few months or less,
But what about the months to go?
When will these lines meet, not digress?
Such agony, such terrible woe!

A lament on communication, the lack of it?
When mobiles phones and internets abound?
Hoping is something I can do, and I can long wait,
But will this satellite start going around?

Narrowmindedness is to me a thorn,
Please break the dogmas and the rituals,
Stop the Old Indian/s with the horn!
Let me/us be. Banish the rules!

I know this separation ain't for long,
You can't stand it either, I know!
Missing you a lot, and hence this song
Just verse, wordifying my sorrow...

June 30, 2009 07:57 PM