以下是这个问题:
Is it possible to pass custom ANT parameters into custom plugin with DITA-OT?
我的插件文件夹名为:
com.mymods.pdf
DITA-OT/plugins文件夹下。下面简要介绍了结构和文件(请密切关注此示例
http://dita-ot.github.io/1.8/readme/dita2pdf-customization.html
). 插件可以工作,但现在我想将ANT命令行参数传递到mycustom.xsl中:
com.mymods.pdf/
cfg/
common/
vars/
en.xml
fo/
attrs/
mycustom.xsl
xsl/
mycustom.xsl
catalog.xml
integrator.xml
plugin.xml
build_mymods_pdf_template.xml (dita2com.mymods.pdf.init target is here and it depends on dita2pdf2)
build.xml (<project><import file="build_mymods_pdf.xml"/></project>)
insertParameters.xml (see the linked question for contents)
那么我需要在哪里应用更改和/或添加新文件?
我使用其他位置的插件“mainANT.xml”,该插件具有使用“dita2myodsPDF”的目标和转换类型。
plugin.xml代码:
<?xml version='1.0' encoding='UTF-8'?>
<plugin id="com.mymods.pdf">
<require plugin="org.dita.pdf2" />
<feature extension="dita.conductor.transtype.check" value="com.mymods.pdf" />
<feature extension="dita.transtype.print" value="com.mymods.pdf" />
<feature extension="dita.conductor.target.relative" file="integrator.xml" />
<feature extension="dita.conductor.com.mymods.pdf.param" file="insertParameters.xml"/>
<extension-point id="dita.conductor.com.mymods.pdf.param" name="PDF XSLT parameters"/>
</plugin>
build_mymods_pdf_template.xml代码:
<?xml version='1.0' encoding='UTF-8'?>
<project name="com.mymods.pdf" default="com.mymods.pdf">
<property name="transtype" value="com.mymods.pdf"/>
<target name="dita2com.mymods.pdf.init">
<property location="${dita.plugin.com.mymods.pdf.dir}/cfg" name="customization.dir" />
<property location="${dita.plugin.com.mymods.pdf.dir}/xsl/fo/topic2fo_shell_fop.xsl" name="args.xsl.pdf" />
<property name="args.chapter.layout" value="BASIC" />
<property name="args.bookmark.style" value="COLLAPSED" />
<!--property name="args.fo.include.rellinks" value="nofamily" /-->
</target>
<target depends="dita2com.mymods.pdf.init, dita2pdf2" name="dita2com.mymods.pdf" />
</project>
另外,integrator.xml代码:
<?xml version='1.0' encoding='UTF-8'?>
<project name="com.mymods.pdf">
<target name="dita2com.mymods.pdf.init">
<property location="${dita.plugin.com.mymods.pdf.dir}/cfg" name="customization.dir" />
<property location="${dita.plugin.com.mymods.pdf.dir}/xsl/fo/topic2fo_shell_fop.xsl" name="args.xsl.pdf" />
<property name="args.chapter.layout" value="BASIC" />
<property name="args.bookmark.style" value="COLLAPSED" />
<!--property name="args.fo.include.rellinks" value="nofamily" /-->
</target>
<target depends="dita2com.mymods.pdf.init, dita2pdf2" name="dita2com.mymods.pdf" />
</project>
不完全确定integrator.xml或build_mymods_pdf_template.xml是否与实际相符。但是这个文件集可以工作并使用mycustom.xsl(其他用于属性,其他用于XSLT覆盖)。现在的问题是如何获取我自己的自定义ANT参数,以便插件可以看到它的值。
这对于pdf2插件来说非常简单,但仍然无法在我的
com.mymods.pdf
。我认为我不需要发布catalog.xml,因为它只会告诉正确工作的“mycustom.xsl”文件在哪里。