Write a script to complete all DocBook image tag updatesBRL-CAD
Status: ClosedTime to complete: 72 hrs Mentors: starseeker, SeanTags: script, docbook, image tags, perl, python, ruby, shell, javascript

The majority of BRL-CAD's documentation is defined as DocBook XML files, from which other formats (HTML, PDF, man page, etc.) can be generated. PDF files present a particular challenge, and have some very specific requirements to achieve ''good'' formatting.


BRL-CAD's DocBook files need to uniformly use a style of image inclusion that is aware of what ''role'' the image is supposed to serve. A ''basic'' image inclusion example looks like this:

mediaobject
imageobject
imagedata align="center" fileref="../../lessons/en/images/img.png" format="PNG"/
/imageobject

para
Caption goes here.
/para

/mediaobject

This task involves switching image inclusions that use the above style to something like the following:

mediaobject
imageobject role="html"
imagedata align="center" fileref="../../books/en/images/img.png" format="PNG"/
/imageobject
imageobject role="fo"
imagedata align="center" fileref="../../books/en/images/img.png" format="PNG"/
/imageobject

para
Caption goes here.
/para

/mediaobject

The ''role'' flag to imageobject provides the opportunity to specify different image formatting options when the output is HTML (role=''html'') or PDF (role=''fo'').

The captions should be preserved as above on mediaobjects that have them, but mediaobjects without a caption should also be converted and there is no need to add a caption in such cases.

Any patch that makes changes to the DocBook sources should result in a successful ''make doc'' build test. This won't generate PDF documents, but it will validate the XML files and produce HTML. Your updated files must pass ''make doc'' to be accepted, preferably submitted in patch format.

This task is specifically to write some sort of automated script that can scan our DocBook xml hierarchy and perform the above change for all unmodified instances of the image tag - it should leave image tags that have already been updated alone.

Write the script to do the above coversion

Test it on the BRL-CAD doc/docbook source directory

Submit the script files and a patch with the changes the script has introduced into the xml files (via svn diff)


Uploaded Work
File name/URLFile sizeDate submitted
imageobject-fix.tar.gz14.4 KBDecember 16 2013 17:23 UTC
imageobject-fix.tar.gz14.4 KBDecember 16 2013 17:26 UTC
imageobject-fix.tar.gz14.4 KBDecember 16 2013 17:27 UTC
Comments
Peter Amidonon December 16 2013 15:56 UTCTask Claimed

I would like to work on this task.

Daniel Rossberg on December 16 2013 16:03 UTCTask Assigned

This task has been assigned to Andromeda Galaxy. You have 72 hours to complete this task, good luck!

Peter Amidonon December 16 2013 17:23 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 17 2013 04:46 UTCReview

Starseeker, would you review this?  Looks reasonable to me at a glance, but not sure if you had anything different in mind.


 

starseeker on December 18 2013 01:44 UTCLooks good

Nice!  Needed slight tweaking in the diff for symbols that had their DocBook specifications of special characters replaced, but not a big problem.  Applied r58973

starseeker on December 18 2013 01:44 UTCTask Closed

Congratulations, this task has been completed successfully.