Create new plug-in

  1. Create a new directory in /demo directory, such as /plugin/pluginA. Under the created directory, include the following subdirectories:

    demo/
          pluginA/
                dtd
                schema
                catalog
                xsl
                lib

    Note: Not all above subdirectories are required. However, it is strongly suggested to use the structure and those subdirectories above to make all files systematically. You also can create files under other directories, such as python/ or vb/.
  2. Specify the types of topic, such as task, reference or concept.
    1. Put the dtd files into dtd directory.
    2. Put schema files into schema directory.
  3. Put the necessary catalog information about the plug-in from your own catalog file into catalog directory.
  4. Define the transformation for the new specialization and put it into xsl directory.
  5. Provide the Ant script to use the xsl file with preprocess with default ant script template, and put it into pluginA root directory.
  6. Put the complied necessary JAR files into lib directory.
  7. Provide a description file named puglin.xml in pluginA root directory. It informs the toolkit how to integrate the function of the new plug-in. This file is an xml file. It's not validated by either dtd file or schema file. Following specification shows you how to write the description file:
    1. An example of the plugin.xml is shown below:

      <plugin id="org.dita.dost.pluginA">
          <require plugin="base_pluginA"/>
          <feature extension="dita.conductor.lib.import" value="pluginA.jar" type="file"/>
          <feature extension="dita.conductor.transtype.check" value="newoutput" type="txt"/>
          <feature extension="dita.conductor.target" value="pluginA_antscript.xml" type="file"/>
          <feature extension="dita.specialization.catalog" value="pluginA_catalog-dita.xml" type="file"/>
          <feature extension="dita.xsl.xhtml" value="xsl/pluginA2xhtml.xsl" type="file"/>
      </plugin>

    2. Use <plugin></plugin> tagsto define the root element for plugin.xml. Set the id attribute, which is uniqute and necessary for each plug-in.
    3. Under <plugin> element, use <require> element to specify which plug-in is needed by pluginA. The plugin attribute is used to specify the ID of the plug-in which is needed by pluginA. This element is not necessary if pluginA is loaded as an independent plug-in. However, pluginA might not function after being loaded if another plug-in is needed, which is not specified by a <require> element.
    4. The <feature> tag specifies the extension point that is extended and how it's extended in pluginA. For example, <feature extension="dita.xsl.xhtml" value="xsl/pluginA2xhtml.xsl" type="file"/> means adding new specific logic transformed from DITA to xhtml into pluginA. The logic is written in file xsl/pluginA2xhtml.xsl in pluginA directory. type="file" means that the type of value is file name. Another example, <feature extension="dita.conductor.transtype.check" value="newoutput" type="txt"/> means extending "dita.conductor.transtype.check" in pluginA. Another type of transformation output for DITA-OT and the check logic for parameter transtype in DITA-OT are to be added. The new transformation output is named newoutput. type="txt" means the value is text not a file name. There are certain extension point which can be defined here. See Extension point for more details.
  8. Package all the subdirectories and files under pluginA to a zip binary file. Create a DITA Open Toolkit plug-in file for distribution.
  9. Test the usability of plug-in files when integrating into DITA Opent Toolkit base.
  10. Put the zip binary file on a Web site, such as the DITA OT SourceForge Web site.