Using External Tools feature to call Zip utility for ditamap

Oxygen general issues.
jspychka
Posts: 30
Joined: Fri Dec 10, 2010 9:43 pm

Using External Tools feature to call Zip utility for ditamap

Post by jspychka »

Hello,

Would it be possible to call a command line zip utility via the External Tools menu item, and zip a ditamap and all reference files. If so, what would the syntax be? This is related to my topic5501 post.

Thanks,

John
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by Radu »

Hi John,

You can either install Apache ANT and invoke a "build.xml" file to pack the DITA Map project or use a free zip utility which has a command line version like:
http://www.7-zip.org/download.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jspychka
Posts: 30
Joined: Fri Dec 10, 2010 9:43 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by jspychka »

Hi Radu,

I would like to give the Ant solution a try since I have Ant installed. Would you be able to walk me through the build.xml file config and explain how to invoke it?

Thanks,

John
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by Radu »

Hi John,

So on your disk you can create an ANT build file called build.xml with the following content:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="dist">
<target name="dist">
<dirname property="ditaProjectDir" file="${ditaMap}"/>
<zip basedir="${ditaProjectDir}" destfile="../ditaMapProject.zip"/>
</target>
</project>
Oxygen 12.2 will have support for creating generic ANT transformations but until then you can use the following workaround:

In the DITA Maps Manager view create a new DITA OT ANT transformation scenario for the current DITA Map (of any type).
In the Parameters tab add a new parameter ditaMap with the value ${cf}.
In the Advanced tab set the Custom build file value to point to your custom build.xml.
Run this transformation scenario each time you want to pack your DITA Map project.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jspychka
Posts: 30
Joined: Fri Dec 10, 2010 9:43 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by jspychka »

Thanks, Radu! I followed your instructions and got it to "generate" easily. One problem though: the whole project stucture is zipped whereas I would only need the ditamap hierarchy with referenced files zipped. I just want to zip the files that are used by the main ditamap. Is it possible to tweak the build.xml file to do this?

John
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by Radu »

Dear John,

It's very hard to find all dependencies for a DITA Map Project (referenced topics, images, etc).
It's impossible to do this directly from the build file but maybe you could create some Java extension and call it from the build file. But it would take a lot of time to account for all references.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jspychka
Posts: 30
Joined: Fri Dec 10, 2010 9:43 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by jspychka »

Thanks again, Radu!

I just found a DITA packager that does the job very nicely :) It is a utility offered by Suite Solutions: http://www.suite-sol.com/pages/resource ... ility.html. It works perfectly! Well, almost perfectly. It would be nice to call it from Oxygen but not being able to do that is no big deal.

John
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Using External Tools feature to call Zip utility for ditamap

Post by Radu »

Hi John,

You can configure External Tools in the Oxygen Preferences but the utility you found does not seem to allow creating the ZIP based on parameters sent from the command line.

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