这个问题如下:Is it possible to pass custom ANT parameters into custom plugin with DITA-OT?
我在 DITA-OT/plugins 文件夹下有一个名为: com.mymods.pdf的插件文件夹。下面简要解释一下结构和文件(紧跟这个例子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”一起使用,该插件具有使用“dita2mymodsPDF”的目标和转换类型。
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”文件在哪里正常工作。