views:

474

answers:

3

Is there a straightforward way to take docbook content and convert it into DokuWiki content? So far I've only found the DokuWiki plugin that will interpret docbook content and output it in XHTML, but this happens on every page load.

I would like to find a way to convert docbook content directly to DokuWiki's native formatting syntax so I only have to interpret it once. Any ideas?

A: 

I'm not familar with the tool you mentioned, but I have some thoughts on general strategies you might employ.

  1. If you're happy with the output from the DocuWiki plugin you could write some sort of script in perl, sh, ruby, etc. that executes the plugin and stores the content to be served up statically in the future.

  2. It appears that DocuWiki is simply calling the xsltproc program and serving up the output. If the plugin is working then you should be able to call xsltproc directly from the command line or your own script. Take a look at these lines from DocuWiki

    exec("$xsltproc -o $tmpXhtmlFile $docbookXsl $tmpDocbookFile 2>&1", $errors);

    $returnXhtml = shell_exec("$xsltproc " . DOKU_PLUGIN . "/docbook/xhtmlCleaner.xsl $tmpXhtmlFile");

  3. Once you have option 1 or 2 working. Setup a cron job or hook in your revision control system to watch for changes to the original docbook source and call the script to regenerate the static version.

zimbu668
A: 

One small (but possibly important) note: DokuWiki contains a caching mechanism which saves the outputted HTML file. This means that normally the plugin would be executed very infrequently (ie. only the first time a particular revision of the page is viewed).

Cd-MaN
+1  A: 

Another option will be to

  1. Use 'docbook2html' - [DocBook tools] to convert docbook to HTML, and then
  2. use something like this Perl Module to convert the HTML to wiki markup. http://search.cpan.org/~diberri/HTML-WikiConverter-0.61/lib/HTML/WikiConverter.pm
StackKrish