我已经创建了一个插件,并试图将我的输出生成为pdf。我的构建正在成功,但是我的插件没有运行。输出是默认的pdf。我错过了什么?
这是我的build_pdf2w_template/ant文件:-
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.dita.pdf2w" default="dita2pdf2w" basedir=".">
<property name="transtype" location="C:\Program Files\dita-ot-2.4"/>
<target name="dita2pdf2w" description="build PDF" depends="pdf"/>
<target name="pdf" description="build PDF">
<ant antfile="C:\Program Files\dita-ot-2.4\plugins\org.dita.pdf2w\build_pdf2w_template.xml">
<property name="args.input" value="D:\AutoCOM-Demo\AutoCOM.ditamap"/>
<property name="args.gen.task.lbl" value="YES"/>
<property name="args.rellinks" value="nofamily"/>
<property name="output.dir" value="C:\"/>
<property name="transtype" value="pdf"/>
</ant>
</target>
</project>插件:-
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="org.dita.pdf2w">
<require plugin="org.dita.pdf2w"/>
<feature extension="dita.conductor.transtype.check" value="pdf2w"/>
<feature extension="dita.transtype.print" value="pdf2w"/>
<feature extension="dita.conductor.target.relative" file="build.xml"/>
</plugin>集成商:-
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.dita.pdf2w">
<target name="dita2pdf2w.init">
<property name="customization.dir" location="${dita.plugin.org.dita.pdf2w.dir}/cfg"/>
</target>
<target name="dita2pdf2w" depends="dita2pdf2w.init , dita2pdf2w"/>
</project>构建:-
<?xml version="1.0" encoding="UTF-8"?>
<project>
<import file="build_pdf2w_template.xml"/>
</project>发布于 2016-12-15 15:25:50
你的plugin.xml看起来不错,它直接引用了"build.xml“,所以如果你有一个"integrator.xml",它根本不会被调用。在build.xml中,蚂蚁目标"dita2pdf2w“在最后有一个对自己的反调用,所以这是不好的。基本上,您的构建文件应该如下所示:
<project name="org.dita.pdf2w"> <target name="dita2pdf2w.init"> <property location="${dita.plugin.org.dita.pdf2w.dir}/cfg" name="customization.dir"/> </target> <target depends="dita2pdf2w.init, dita2pdf2" name="dita2pdf2w"/> </project>
您还可以使用Jarno Elovirta的PDF插件生成器生成一个启动定制插件:http://dita-generator.elovirta.com/
发布于 2016-12-29 21:53:03
根据@RaduCoravu的建议,我修改了您的插件相关文件。
pdf2w/plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="org.dita.pdf2w">
<feature extension="dita.conductor.transtype.check" value="pdf2w"/>
<feature extension="dita.transtype.print" value="pdf2w"/>
<feature extension="dita.conductor.target.relative" file="integrator.xml"/>
</plugin>pdf2w/integrator.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<import file="build.xml"/>
</project>pdf2w/build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.dita.pdf2w">
<target name="dita2pdf2w.init">
<property location="${dita.plugin.org.dita.pdf2w.dir}/cfg" name="customization.dir"/>
</target>
<target depends="dita2pdf2w.init, dita2pdf2" name="dita2pdf2w"/>
</project>如果您正确配置pdf2w/cfg目录,这肯定会起作用。
以下文件是一个简单的自定义示例:
pdf2w/cfg/catalog.xml
<?xml version="1.0" encoding="utf-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<!-- Custom XSL code entry.-->
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
</catalog>pdf2w/cfg/fo/xsl/custom.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="2.0">
<xsl:template match="*[contains(@class, ' task/cmd ')]" priority="1">
<fo:block xsl:use-attribute-sets="cmd">
<xsl:call-template name="commonattributes"/>
<xsl:attribute name="color" select="'red'"/>
<xsl:attribute name="font-size" select="'2em'"/>
<xsl:attribute name="font-weight" select="'bold'"/>
<xsl:if test="../@importance='optional'">
<xsl:call-template name="getVariable">
<xsl:with-param name="id" select="'Optional Step'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="../@importance='required'">
<xsl:call-template name="getVariable">
<xsl:with-param name="id" select="'Required Step'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
</xsl:stylesheet>Windows中的命令行
D:\DITA-OT\dita-ot-2.4>bin\dita -i docsrc/samples/sequence.ditamap -f pdf2w -o out
结果PDF

https://stackoverflow.com/questions/41120633
复制相似问题