Hi,
I'm trying to add odt rendering to the
cli syntax plugin. In the end I'll need to get the odt equivalent of this html snippet :
<pre><span style="color:red">prompt $</span><span style="color: green">command</span></pre>
There is a bit of documentation in
https://www.dokuwiki.org/plugin:odt:implementodtsupport and I tried to understand the code in renderer/page.php, but I still don't know how to properly style preformatted text in this renderer.
First question. There are methods whose name start with an underscore. What does it mean ? are these methods special in any way ?
Second, I don't seem to be able to add colored spans whith renderer_plugin_odt_page->preformatted() nor with renderer_plugin_odt_page->_preformatted() and there is no method to open a preformatted paragraph. Did I miss something ?
So far, I can't use preformatted text, so I resort to using standard paragraph, with monospace font. But this collapses multiple spaces into one single space (just like html does with spaces), which is not good. So I also replace all pairs of spaces by <space><non-breakable-space>. spaces are visually preserved, but this is just a hack. I'm looking for something nicer that wouldn't modify the data. Current code looks like this :
$renderer->_odtParagraphOpenUseProperties(array('font-family' => 'Bitstream Vera Sans Mono',....));
$renderer->_odtSpanOpenUseProperties(array('color' => 'red'));
$renderer->cdata(str_replace(' ', $sp_and_nbsp, $line[0]));
$renderer->_odtSpanClose();
$renderer->_odtSpanOpenUseProperties(array('color' => 'green'));
$renderer->cdata(str_replace(' ', $sp_and_nbsp, $line[1]));
$renderer->_odtSpanClose();
etc...
Any idea how I could do this correctly ?