Dita XHTML chunk 1 file

Post here questions and problems related to editing and publishing DITA content.
kenzoclauw
Posts: 2
Joined: Tue Jul 07, 2015 4:40 pm

Dita XHTML chunk 1 file

Post by kenzoclauw »

Hello,

I am currently working on a dita plugin to generate a txt file containing all topics from a ditamap based on the XHTML plugin.
XHTML converts all dita topics to a seperate file.
Is there a way to chunk all topics to 1 big file?
There should be a chunk attribute in dita but i cant figure out how to make it work with the XHTML plugin.

Thanks
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Dita XHTML chunk 1 file

Post by Radu »

Hi,

On the DITA Map <map> root element you can set the attribute chunk="to-content". The DITA content should be output all in one contiguous HTML output file.

http://docs.oasis-open.org/dita/v1.2/os ... l#chunking

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kenzoclauw
Posts: 2
Joined: Tue Jul 07, 2015 4:40 pm

Re: Dita XHTML chunk 1 file

Post by kenzoclauw »

I understand that you can add a chunk attribute to the map in a ditamap file but i want the plugin to always make 1 file without having to chance all my ditamaps.
Is there a way to apply a chunk attribute to the maps?
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Dita XHTML chunk 1 file

Post by Radu »

Hi,

Actually the DITA to Web Slides plugin does that (as a coincidence I suggested some changes on that behavior a couple of days ago):

https://github.com/doctales/org.doctales.reveal

If you look inside its plugin.xml, it has a pre-processing extension:

Code: Select all


....
<feature extension="depend.preprocess.chunk.pre" value="setchunk"/>
....
and then the build file defines the setchunk target like:

Code: Select all

    <!-- Automatically set "chunk='to-content'" on the temporary input file. -->
<target name="setchunk" description="Set @chunk to-content on the temp input bookmap" if="isRevealJS">
<replace file="${dita.temp.dir}${file.separator}${dita.input.filename}" token="chunk=.to-content." value="" encoding="UTF-8"/>
<replace file="${dita.temp.dir}${file.separator}${dita.input.filename}" token="<bookmap " value="<bookmap chunk='to-content' " encoding="UTF-8"/>
<replace file="${dita.temp.dir}${file.separator}${dita.input.filename}" token="<map " value="<map chunk='to-content' " encoding="UTF-8"/>
</target>
What you need to be careful about is that your "setchunk" template will get called no matter what transtype is executed so in the case above it has a dependency on the isRevealJS condition which is set in the same build file if the publishing is of reveal JS type.

As an alternative I think DITA OT 2.1 (Oxygen comes bundled with DITA OT 1.8 ) can force a certain chunking on an entire DITA Map via a parameter but I have not tested that yet.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply