-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use an integrator instead of directly embedding build script #9
- Loading branch information
Showing
2 changed files
with
141 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
|
||
<target name="docx.init"> | ||
<property name="docx.dir" location="${dita.plugin.com.elovirta.ooxml.dir}/docx"/> | ||
<property name="dotx.file" location="${dita.plugin.com.elovirta.ooxml.dir}/resources/Normal.dotm"/> | ||
<property name="args.rellinks" value="nofamily"/> | ||
</target> | ||
|
||
<target name="dita2docx" | ||
depends="docx.init, | ||
build-init, | ||
preprocess, | ||
docx.image-metadata, | ||
docx.template, | ||
docx.convert, | ||
docx.package"/> | ||
|
||
<target name="docx.image-metadata" description="Read image metadata"> | ||
<pipeline message="Read image metadata." taskname="image-metadata" tempdir="${dita.temp.dir}"> | ||
<module class="org.dita.dost.module.ImageMetadataModule"> | ||
<param name="outputdir" location="${output.dir}"/> | ||
</module> | ||
</pipeline> | ||
</target> | ||
|
||
<target name="docx.template"> | ||
<unzip src="${dotx.file}" dest="${dita.temp.dir}/dotx"> | ||
<patternset> | ||
<exclude name="**/.DS_Store"/> | ||
<exclude name="__MACOSX/**"/> | ||
</patternset> | ||
</unzip> | ||
<copy todir="${dita.temp.dir}/docx" overwrite="true"> | ||
<fileset dir="${dita.temp.dir}/dotx"/> | ||
</copy> | ||
</target> | ||
|
||
<target name="docx.convert"> | ||
<dirname property="dita.temp.dir.fullpath" file="${dita.temp.dir}/dummy.file"/> | ||
<pipeline message="topicmerge" | ||
inputmap="${dita.temp.dir.fullpath}/${user.input.file}" | ||
tempdir="${dita.temp.dir.fullpath}"> | ||
<module class="org.dita.dost.module.TopicMergeModule"> | ||
<param name="output" location="${dita.temp.dir.fullpath}/${dita.map.filename.root}_MERGED.xml"/> | ||
<param name="style" location="${dita.plugin.org.dita.pdf2.dir}/xsl/common/topicmerge.xsl"/> | ||
</module> | ||
</pipeline> | ||
|
||
<property name="image.dir" location="${user.input.dir}/.."/> | ||
<property name="clean.input.file" location="${dita.temp.dir.fullpath}/${dita.map.filename.root}_CLEANED.xml"/> | ||
<xslt style="${docx.dir}/word/document.flat.xsl" | ||
in="${dita.temp.dir.fullpath}/${dita.map.filename.root}_MERGED.xml" | ||
out="${clean.input.file}" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
|
||
<xslt style="${docx.dir}/docProps/core.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/docProps/core.xml" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
|
||
<makeurl property="dotx.dir.uri" file="${dita.temp.dir}/dotx"/> | ||
<makeurl property="user.input.dir.url" file="${user.input.dir}"/> | ||
<property name="document.xsl" location="${docx.dir}/word/document.xsl"/> | ||
<xslt style="${document.xsl}" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/document.xml" | ||
force="true"> | ||
<param name="image.dir" expression="${image.dir}"/> | ||
<param name="template.dir" expression="${dotx.dir.uri}"/> | ||
<param name="input.dir.url" expression="${user.input.dir.url}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<xslt style="${docx.dir}/word/comments.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/comments.xml" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<property name="numbering.xsl" location="${docx.dir}/word/numbering.xsl"/> | ||
<xslt style="${numbering.xsl}" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/numbering.xml" | ||
force="true"> | ||
<param name="template.dir" expression="${dotx.dir.uri}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<xslt style="${docx.dir}/word/footnotes.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/footnotes.xml" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<xslt style="${docx.dir}/word/_rels/document.xml.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/_rels/document.xml.rels" | ||
force="true"> | ||
<param name="template.dir" expression="${dotx.dir.uri}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<makeurl property="clean.input.file.uri" file="${clean.input.file}"/> | ||
<xslt style="${docx.dir}/[Content_Types].xsl" | ||
in="${dita.temp.dir}/dotx/[Content_Types].xml" | ||
out="${dita.temp.dir}/docx/[Content_Types].xml" | ||
force="true"> | ||
<param name="input.uri" expression="${clean.input.file.uri}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
</target> | ||
|
||
<target name="docx.package" depends="docx.package.media"> | ||
<condition property="outputFile.extension" value="docm" else="docx"> | ||
<matches string="${dotx.file}" pattern="\.dotm$"/> | ||
</condition> | ||
<property name="outputFile" location="${dita.map.output.dir}/${dita.map.filename.root}.${outputFile.extension}"/> | ||
<delete file="${outputFile}"/> | ||
<zip zipfile="${outputFile}"> | ||
<fileset dir="${dita.temp.dir}/docx"/> | ||
</zip> | ||
</target> | ||
|
||
<target name="docx.package.media" depends="docx.package.media.check" unless="media.skip"> | ||
<copy todir="${dita.temp.dir}/docx/word/media"> | ||
<fileset dir="${user.input.dir}/" includesfile="${dita.temp.dir}/${imagefile}"> | ||
<exclude name="**/*.mml"/> | ||
<exclude name="**/*.svg"/> | ||
</fileset> | ||
</copy> | ||
</target> | ||
<target name="docx.package.media.check"> | ||
<condition property="media.skip"> | ||
<length file="${dita.temp.dir}/${imagefile}" length="0"/> | ||
</condition> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,140 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
|
||
<target name="docx.init"> | ||
<property name="docx.dir" location="${dita.plugin.com.elovirta.ooxml.dir}/docx"/> | ||
<property name="dotx.file" location="${dita.plugin.com.elovirta.ooxml.dir}/resources/Normal.dotm"/> | ||
<property name="args.rellinks" value="nofamily"/> | ||
</target> | ||
|
||
<target name="dita2docx" | ||
depends="docx.init, | ||
build-init, | ||
preprocess, | ||
docx.image-metadata, | ||
docx.template, | ||
docx.convert, | ||
docx.package"/> | ||
|
||
<target name="docx.image-metadata" description="Read image metadata"> | ||
<pipeline message="Read image metadata." taskname="image-metadata" tempdir="${dita.temp.dir}"> | ||
<module class="org.dita.dost.module.ImageMetadataModule"> | ||
<param name="outputdir" location="${output.dir}"/> | ||
</module> | ||
</pipeline> | ||
</target> | ||
|
||
<target name="docx.template"> | ||
<unzip src="${dotx.file}" dest="${dita.temp.dir}/dotx"> | ||
<patternset> | ||
<exclude name="**/.DS_Store"/> | ||
<exclude name="__MACOSX/**"/> | ||
</patternset> | ||
</unzip> | ||
<copy todir="${dita.temp.dir}/docx" overwrite="true"> | ||
<fileset dir="${dita.temp.dir}/dotx"/> | ||
</copy> | ||
</target> | ||
|
||
<target name="docx.convert"> | ||
<dirname property="dita.temp.dir.fullpath" file="${dita.temp.dir}/dummy.file"/> | ||
<pipeline message="topicmerge" | ||
inputmap="${dita.temp.dir.fullpath}/${user.input.file}" | ||
tempdir="${dita.temp.dir.fullpath}"> | ||
<module class="org.dita.dost.module.TopicMergeModule"> | ||
<param name="output" location="${dita.temp.dir.fullpath}/${dita.map.filename.root}_MERGED.xml"/> | ||
<param name="style" location="${dita.plugin.org.dita.pdf2.dir}/xsl/common/topicmerge.xsl"/> | ||
</module> | ||
</pipeline> | ||
|
||
<property name="image.dir" location="${user.input.dir}/.."/> | ||
<property name="clean.input.file" location="${dita.temp.dir.fullpath}/${dita.map.filename.root}_CLEANED.xml"/> | ||
<xslt style="${docx.dir}/word/document.flat.xsl" | ||
in="${dita.temp.dir.fullpath}/${dita.map.filename.root}_MERGED.xml" | ||
out="${clean.input.file}" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
|
||
<xslt style="${docx.dir}/docProps/core.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/docProps/core.xml" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
|
||
<makeurl property="dotx.dir.uri" file="${dita.temp.dir}/dotx"/> | ||
<makeurl property="user.input.dir.url" file="${user.input.dir}"/> | ||
<property name="document.xsl" location="${docx.dir}/word/document.xsl"/> | ||
<xslt style="${document.xsl}" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/document.xml" | ||
force="true"> | ||
<param name="image.dir" expression="${image.dir}"/> | ||
<param name="template.dir" expression="${dotx.dir.uri}"/> | ||
<param name="input.dir.url" expression="${user.input.dir.url}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<xslt style="${docx.dir}/word/comments.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/comments.xml" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<property name="numbering.xsl" location="${docx.dir}/word/numbering.xsl"/> | ||
<xslt style="${numbering.xsl}" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/numbering.xml" | ||
force="true"> | ||
<param name="template.dir" expression="${dotx.dir.uri}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<xslt style="${docx.dir}/word/footnotes.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/footnotes.xml" | ||
force="true"> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<xslt style="${docx.dir}/word/_rels/document.xml.xsl" | ||
in="${clean.input.file}" | ||
out="${dita.temp.dir}/docx/word/_rels/document.xml.rels" | ||
force="true"> | ||
<param name="template.dir" expression="${dotx.dir.uri}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
<makeurl property="clean.input.file.uri" file="${clean.input.file}"/> | ||
<xslt style="${docx.dir}/[Content_Types].xsl" | ||
in="${dita.temp.dir}/dotx/[Content_Types].xml" | ||
out="${dita.temp.dir}/docx/[Content_Types].xml" | ||
force="true"> | ||
<param name="input.uri" expression="${clean.input.file.uri}"/> | ||
<xmlcatalog refid="dita.catalog"/> | ||
</xslt> | ||
</target> | ||
|
||
<target name="docx.package" depends="docx.package.media"> | ||
<condition property="outputFile.extension" value="docm" else="docx"> | ||
<matches string="${dotx.file}" pattern="\.dotm$"/> | ||
</condition> | ||
<property name="outputFile" location="${dita.map.output.dir}/${dita.map.filename.root}.${outputFile.extension}"/> | ||
<delete file="${outputFile}"/> | ||
<zip zipfile="${outputFile}"> | ||
<fileset dir="${dita.temp.dir}/docx"/> | ||
</zip> | ||
</target> | ||
|
||
<target name="docx.package.media" depends="docx.package.media.check" unless="media.skip"> | ||
<copy todir="${dita.temp.dir}/docx/word/media"> | ||
<fileset dir="${user.input.dir}/" includesfile="${dita.temp.dir}/${imagefile}"> | ||
<exclude name="**/*.mml"/> | ||
<exclude name="**/*.svg"/> | ||
</fileset> | ||
</copy> | ||
</target> | ||
<target name="docx.package.media.check"> | ||
<condition property="media.skip"> | ||
<length file="${dita.temp.dir}/${imagefile}" length="0"/> | ||
</condition> | ||
</target> | ||
|
||
<import file="build.xml"/> | ||
</project> |