DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Post by msambasiva »
Hi Team,
DITA-OT: 3.4.1
We are able to transform dita content into markdown using default markdown transformation. The images also copied to target location same as markdown files.
But we want to store the image files into separate folder (/images folder)
Below is the ant command using to run the transformation process, with params defined into build.properties file,
ant -f integrator.xml && ant -f build.xml -propertyfile build.properties
transtype=markdown
args.input=C:\\doc.ditamap
output.dir=C:\\docoutput
Please suggest if there is an option to store images into separate folder like(/images)
If not possible using default plugin , please confirm if we can customize the markdown plugin to have images into separate folder. It would be great help if you can suggest reference to customize markdown plugin.
Thanks in advance,
Samba.
DITA-OT: 3.4.1
We are able to transform dita content into markdown using default markdown transformation. The images also copied to target location same as markdown files.
But we want to store the image files into separate folder (/images folder)
Below is the ant command using to run the transformation process, with params defined into build.properties file,
ant -f integrator.xml && ant -f build.xml -propertyfile build.properties
transtype=markdown
args.input=C:\\doc.ditamap
output.dir=C:\\docoutput
Please suggest if there is an option to store images into separate folder like(/images)
If not possible using default plugin , please confirm if we can customize the markdown plugin to have images into separate folder. It would be great help if you can suggest reference to customize markdown plugin.
Thanks in advance,
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Hi,
You seem to be using an old DITA Open Toolkit and your problem also does not seem to be related to Oxygen's functionality.
From what I'm testing with Oxygen 27.0 and its bundled DITA OT 4.2.3, if in my original DITA XML content all images are placed inside an "images" folder, then also in the generated Markdown content the images are placed inside an "images" folder, so the original folder structure is preserved.
Regards,
Radu
You seem to be using an old DITA Open Toolkit and your problem also does not seem to be related to Oxygen's functionality.
From what I'm testing with Oxygen 27.0 and its bundled DITA OT 4.2.3, if in my original DITA XML content all images are placed inside an "images" folder, then also in the generated Markdown content the images are placed inside an "images" folder, so the original folder structure is preserved.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Post by msambasiva »
Thanks Radu for quick response.
Unfortunately we are getting all dita content like topics, ditamaps, images in single folder without subfolders.
Please confirm if we can customize markdown plugin to have custom rules like below, Please suggest the extension point if we need to customize the markdown plugin.
https://www.dita-ot.org/dev/topics/plugin-rewrite-rules
<xsl:template match="file[@format = 'image']/@result">
<xsl:attribute name="{local-name()}" select="concat('images/', .)"/>
</xsl:template>
Unfortunately we are getting all dita content like topics, ditamaps, images in single folder without subfolders.
Please confirm if we can customize markdown plugin to have custom rules like below, Please suggest the extension point if we need to customize the markdown plugin.
https://www.dita-ot.org/dev/topics/plugin-rewrite-rules
<xsl:template match="file[@format = 'image']/@result">
<xsl:attribute name="{local-name()}" select="concat('images/', .)"/>
</xsl:template>
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Post by msambasiva »
Hi Radu,
Able to transform the dita content to markdown using custom plugin created without folder for images. Below are the sample code.
Here are the steps. Somehow I am not getting messages in console while I tried to print using <xsl:message>. Please correct me if Iam wrong. Thanks
plugin.xml,
integrator.xml
cfg/custom-rules.xsl
Thanks,
Samba.
Able to transform the dita content to markdown using custom plugin created without folder for images. Below are the sample code.
Here are the steps. Somehow I am not getting messages in console while I tried to print using <xsl:message>. Please correct me if Iam wrong. Thanks
plugin.xml,
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://www.dita-ot.org/rng/plugin.rnc" type="application/relax-ng-compact-syntax"?>
<plugin id="infodev.markdown">
<require plugin="org.lwdita"/>
<transtype name="infodev-markdown" extends="markdown" desc="InfoDev Markdown"/>
<feature extension="dita.transtype.print" value="infodev-markdown"/>
<feature extension="ant.import" file="integrator.xml"/>
</plugin>
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<project>
<target name="dita2infodev-markdown"
depends="dita2infodev-markdown.init, dita2markdown"/>
<target name="dita2infodev-markdown.init">
<property name="customization.dir"
location="${infodev.markdown.dir}/cfg"/>
<property name="result.rewrite-rule.xsl"
value="${infodev.markdown.dir}/cfg/custom-rules.xsl"/>
</target>
</project>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="2.0">
<!-- Move figure title to top and description to bottom -->
<xsl:template match="node() | @*">
<xsl:message>******************Hello node</xsl:message>
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="file[@format = 'image']/@result">
<xsl:message>#################Hello image</xsl:message>
<xsl:attribute name="{local-name()}" select="concat('images/', .)"/>
</xsl:template>
</xsl:stylesheet>
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Hi Samba,
Can you add a "terminate=yes" attribute on the xsl:message from the custom-rules.xsl and run the publishing? If the publishing does not break, it means your XSLT is not called at all.
Maybe you can debug this problem, open the build file "DITA-OT/plugins/org.dita.base/build_preprocess.xml" look for the target "clean-preprocess" and maybe add some echo's inside it to see if it gets called, if the "result.rewrite-rule.xsl" is set when it gets called...
Maybe another way to approach fixing this would be for you to use some kind of python script and fixup the output folder after the publishing, move images to a folder, update references to them.
Regards,
Radu
Can you add a "terminate=yes" attribute on the xsl:message from the custom-rules.xsl and run the publishing? If the publishing does not break, it means your XSLT is not called at all.
Maybe you can debug this problem, open the build file "DITA-OT/plugins/org.dita.base/build_preprocess.xml" look for the target "clean-preprocess" and maybe add some echo's inside it to see if it gets called, if the "result.rewrite-rule.xsl" is set when it gets called...
Maybe another way to approach fixing this would be for you to use some kind of python script and fixup the output folder after the publishing, move images to a folder, update references to them.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Post by msambasiva »
Hi Radu,
As you suspect, clean-preprocess of build_preprocess.xml(org.dita.base) has not been called. Tried to put echo in 'clean-preprocess' target as below. I don't find message in the console.
As per the documentation, https://www.dita-ot.org/dev/topics/plugin-rewrite-rules
To dynamically adjust the names and locations of output files in the map-first pre-processing routine (preprocess2), you can create a custom plug-in and specify the code that contains your custom rewrite rules.
Am I setting result.rewrite-rule.xsl parameter in the correct place?
Could you please review the below code?
infodev.markdown/integrator.xml
Could you please confirm on required plugin from the below plugin.xml?
Thanks,
Samba.
As you suspect, clean-preprocess of build_preprocess.xml(org.dita.base) has not been called. Tried to put echo in 'clean-preprocess' target as below. I don't find message in the console.
Code: Select all
<target name="clean-preprocess" unless="preprocess.clean-preprocess.skip" description="Clean preprocess">
<echo message="###################clean-preprocess"/>
To dynamically adjust the names and locations of output files in the map-first pre-processing routine (preprocess2), you can create a custom plug-in and specify the code that contains your custom rewrite rules.
Am I setting result.rewrite-rule.xsl parameter in the correct place?
Could you please review the below code?
infodev.markdown/integrator.xml
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<project>
<target name="dita2infodev-markdown.init">
<property name="customization.dir"
location="${dita.plugin.infodev.markdown.dir}/cfg"/>
<property name="result.rewrite-rule.xsl"
value="${customization.dir}/custom-rules.xsl"/>
<echo message="###################Hello, world ${dita.plugin.infodev.markdown.dir}"
/>
<echo message="###################custom dir ${customization.dir}"/>
</target>
<target name="dita2infodev-markdown"
depends="dita2infodev-markdown.init, dita2markdown">
</target>
</project>
Code: Select all
<plugin id="infodev.markdown">
[b] <require plugin="org.lwdita"/>[/b]
<transtype name="infodev-markdown" extends="markdown" desc="InfoDev Markdown"/>
<feature extension="dita.transtype.print" value="infodev-markdown"/>
<feature extension="ant.import" file="integrator.xml"/>
</plugin>
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT: 3.4.1 Markdown transformation - Store images to separate folder
Hi Samba,
I'm afraid you will need to debug this problem on your own.
So in the ANT build file your "dita2infodev-markdown" ANT target calls the base "dita2markdown" target which is defined in "DITA-OT/plugins/org.lwdita/build-markdown.xml" and it calls the "preprocess" target which is defined in the ANT build file DITA-OT/plugins/org.dita.base/build_preprocess.xml
and depends on the "clean-preprocess" target.
So maybe you can add some <echo>s in the build file to understand why the "clean-preprocess" target is not getting called.
Regards,
Radu
I'm afraid you will need to debug this problem on your own.
So in the ANT build file your "dita2infodev-markdown" ANT target calls the base "dita2markdown" target which is defined in "DITA-OT/plugins/org.lwdita/build-markdown.xml" and it calls the "preprocess" target which is defined in the ANT build file DITA-OT/plugins/org.dita.base/build_preprocess.xml
and depends on the "clean-preprocess" target.
So maybe you can add some <echo>s in the build file to understand why the "clean-preprocess" target is not getting called.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service