Hi,
when transforming to HTML5 (and PDF), I want to render PlantUML diagrams that are embedded in markdown files. Therefore I have written a really small plugin that piggybacks on Radu's com.oxygenxml.plantuml.svg.
This is my plugin.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="dita-ot/plugin.rnc" type="application/relax-ng-compact-syntax"?>
<plugin id="mysoopadoopanamespace.plugin.mdita-plantuml">
<require plugin="com.oxygenxml.plantuml.svg"/>
<feature extension="dita.xsl.xhtml" value="xsl/xhtmlSVG.xsl" type="file"/>
<feature extension="dita.xsl.html5" value="xsl/xhtmlSVG.xsl" type="file"/>
<feature extension="dita.xsl.xslfo" value="xsl/pdfSVG.xsl" type="file"/>
</plugin>
This is the full xhtmlSVG.xsl
:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Oxygen Latex to SVG sample conversion plugin
Copyright (c) 1998-2019 Syncro Soft SRL, Romania. All rights reserved.
Licensed under the terms stated in the license file LICENSE
available in the base directory of this plugin.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:saxon="http://saxon.sf.net/"
xmlns:converter="java:com.oxygenxml.plantuml.svg.PlantumlToSVG">
<xsl:param name="plantuml.include.path"/>
<xsl:template match="*[contains(@class,' pr-d/codeblock ')][contains(@outputclass, 'plantuml')] | *[contains(@class,' pr-d/codeblock ')][contains(@outputclass, 'puml')]" priority="10">
<p>
<xsl:call-template name="commonattributes"/>
<xsl:copy-of select="parse-xml(converter:convert(text(), $plantuml.include.path))" use-when="not(function-available('saxon:parse'))"/>
<xsl:copy-of select="saxon:parse(converter:convert(text(), $plantuml.include.path)" use-when="function-available('saxon:parse')"/>
</p>
</xsl:template>
</xsl:stylesheet>
I just have changed the template to match the classes derived from the intermediary .md-document in the temp directory produced by DITA-OT.
First thing to say: Thank you, Radu, for putting so much effort in DITA-OT, the plugins and the community!
Second: The plugin com.oxygenxml.plantuml.svg works flawlessly. My piggyback solution on the other hand gets the svg rendering done, but destroys the layout and navigation of the HTML5 output. After further investigation of the intermediary .md-document in the temp directory produced by DITA-OT, it is missing these directives at the start of the document:
<?workdir /out/tempppppp/topic?><?workdir-uri file:/out/tempppppp/topic/?><?path2project ../?><?path2project-uri ../?><?path2rootmap-uri ../?>
The consequence of missing these directives is, that the directory containing the .md-document is used as the basedir, which messes up the internal links, the navigation and links to stylesheets, js, etc.
Intermediary .md-documents without plantuml code do include these directives and work fine. Real
DITA topics that embed plantuml and using com.oxygenxml.plantuml.svg do include these directives and work fine. So this is definitely caused by my plugin.
How can these directives be included? Does this have something to do with the order of the processing pipeline? I am stuck right now. Can you help?
Best regards
Alex
P.S.: I do not do any fancy chunking in my ditamap like in this maybe related issue.
--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dita-ot-users/1e67aa1d-bfb2-4c39-89dc-7205a04d0633n%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dita-ot-users/3dacaa20-81c7-4cc8-9fd3-2a23b83442a2n%40googlegroups.com.