VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/docsrc/dev_ref/plugin-newextensions.dita@ 99040

最後變更 在這個檔案從99040是 98584,由 vboxsync 提交於 2 年 前

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 7.3 KB
 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
3<reference id="plugin-newextensions" xml:lang="en-us">
4 <title>Creating a new plug-in extension point</title>
5 <shortdesc>If your plug-in needs to define its own extension point in an XML file, add the string
6 "<codeph>_template</codeph>" to the filename before the file suffix. During integration, this
7 file will be processed like the built-in DITA-OT templates.</shortdesc>
8 <refbody>
9 <section><p>Template files are used to integrate most DITA-OT extensions. For example, the file
10 <filepath>dita2xhtml_template.xsl</filepath> contains all of the default rules for
11 converting DITA topics to XHTML, along with an integration point for plug-in extensions.
12 When the integrator runs, the file dita2xhtml.xsl is recreated, and the integration point is
13 replaced with references to all appropriate plug-ins.</p><p>To mark a new file as a template
14 file, use the <codeph>&lt;template></codeph> element.</p>
15 <p>The template extension namespace has the URI
16 <codeph>http://dita-ot.sourceforge.net</codeph>. It is used to identify elements and
17 attributes that have a special meaning in template processing. This documentation uses a
18 prefix of  <codeph>dita:</codeph>  for referring to elements in the template extension
19 namespace. However, template files are free to use any prefix, provided that there is a
20 namespace declaration that binds the prefix to the URI of the template extension namespace.
21 </p>
22 </section>
23 <section>
24 <title><codeph>dita:extension</codeph> element</title>
25 <p>The <codeph>dita:extension</codeph> elements are used to insert generated content during
26 integration process. There are two required attributes:</p>
27 <ul>
28 <li>The <codeph>id</codeph> attribute defines the extension point ID which provides the
29 argument data.</li>
30 <li>The <codeph>behaviour</codeph> attribute defines which processing action is used.</li>
31 </ul>
32 <p>Supported values for <codeph>behavior</codeph> attribute:</p>
33 <dl>
34 <dlentry>
35 <dt><codeph>org.dita.dost.platform.CheckTranstypeAction</codeph></dt>
36 <dd>Create Ant condition elements to check if <codeph>${transtype}</codeph> property value
37 equals a supported transtype value.</dd>
38 </dlentry>
39 <dlentry>
40 <dt><codeph>org.dita.dost.platform.ImportAntLibAction</codeph></dt>
41 <dd>Create Ant <codeph>pathelement</codeph> elements for <xref href="plugin-javalib.dita"
42 format="dita">library imported extension point</xref>. The <codeph>id</codeph>
43 attribute is used to define the extension point ID.</dd>
44 </dlentry>
45 <dlentry>
46 <dt><codeph>org.dita.dost.platform.ImportPluginCatalogAction</codeph></dt>
47 <dd>Include plug-in metadata catalog content.</dd>
48 </dlentry>
49 <dlentry>
50 <dt><codeph>org.dita.dost.platform.ImportPluginInfoAction</codeph></dt>
51 <dd>Create plug-in metadata Ant properties.</dd>
52 </dlentry>
53 <dlentry>
54 <dt><codeph>org.dita.dost.platform.ImportStringsAction</codeph></dt>
55 <dd>Include plug-in string file content base on <xref href="plugin-addgeneratedtext.dita"
56 format="dita">generated text extension point</xref>. The <codeph>id</codeph> attribute
57 is used to define the extension point ID.</dd>
58 </dlentry>
59 <dlentry>
60 <dt><codeph>org.dita.dost.platform.ImportXSLAction</codeph></dt>
61 <dd>Create <codeph>xsl:import</codeph> elements based on <xref
62 href="plugin-overridestyle.dita">XSLT import extension point</xref>. The
63 <codeph>id</codeph> attribute is used to define the extension point ID.</dd>
64 </dlentry>
65 <dlentry>
66 <dt><codeph>org.dita.dost.platform.InsertAction</codeph></dt>
67 <dd>Include plug-in conductor content based on <xref href="plugin-anttarget.dita"
68 format="dita">Ant import extension point</xref>. The <codeph>id</codeph> attribute is
69 used to define the extension point ID.</dd>
70 </dlentry>
71 <dlentry>
72 <dt><codeph>org.dita.dost.platform.InsertAntActionRelative</codeph></dt>
73 <dd>Include plug-in conductor content based on <xref href="plugin-anttarget.dita"
74 format="dita">relative Ant import extension point</xref>. The <codeph>id</codeph>
75 attribute is used to define the extension point ID.</dd>
76 </dlentry>
77 <dlentry>
78 <dt><codeph>org.dita.dost.platform.InsertCatalogActionRelative</codeph></dt>
79 <dd>Include plug-in catalog content based on <xref href="plugin-xmlcatalog.dita"
80 format="dita">catalog import extension point</xref>. The <codeph>id</codeph> attribute
81 is used to define the extension point ID.</dd>
82 </dlentry>
83 <dlentry>
84 <dt><codeph>org.dita.dost.platform.ListTranstypeAction</codeph></dt>
85 <dd>Create a pipe delimited list of supported transtypes.</dd>
86 </dlentry>
87 </dl>
88 </section>
89 <section id="section_vfc_gvw_mg">
90 <title><codeph>dita:extension</codeph> attribute</title>
91 <p>The <codeph>dita:extension</codeph> attribute is used to process attributes in elements
92 which are not in template extension namespace. The value of the attribute is a space
93 delimited tuple, where the first item is the name of the attribute to process and the second
94 item is the action ID.</p>
95 <p>Supported values:</p>
96 <dl>
97 <dlentry>
98 <dt><codeph>depends org.dita.dost.platform.InsertDependsAction</codeph></dt>
99 <dd>Ant target dependency list is processed to replace all target names which start with
100 an open curly bracket and end with a close curly bracket. The value of the extension
101 point is the ID between the curly brackets.</dd>
102 </dlentry>
103 </dl>
104 </section>
105 <example><title>Example</title><p>The following plug-in defines
106 <filepath>myBuildFile_template.xml</filepath> as a new template for extensions, and two
107 new extension points.</p><?Pub Caret -1?><codeblock>&lt;plugin id="com.example.new-extensions">
108 &lt;extension-point id="com.example.new-extensions.pre"
109 name="Custom target preprocess"/>
110 &lt;extension-point id="com.example.new-extensions.content"
111 name="Custom target content"/>
112 &lt;template file="myBuildFile_template.xml"/>
113&lt;/plugin></codeblock>
114 <p>When the integrator runs, this will be used to recreate
115 <filepath>myBuildFile.xml</filepath>, replacing Ant file content based on extension point
116 use.</p>
117 <codeblock>&lt;project xmlns:dita="http://dita-ot.sourceforge.net">
118 &lt;target name="dita2custom"
119 depends="dita2custom.init,
120 {com.example.new-extensions.pre},
121 dita2xhtml"
122 dita:extension="depends org.dita.dost.platform.InsertDependsAction">
123 &lt;dita:extension id="com.example.new-extensions.content"
124 behaviour="org.dita.dost.platform.InsertAction"/>
125 &lt;target>
126&lt;/project></codeblock></example>
127 </refbody>
128</reference>
129<?Pub *0000001608?>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette