Difference between revisions of "INX extension descriptor format"

From Inkscape Wiki
Jump to navigation Jump to search
(Added page, notebook and enum.)
Line 19: Line 19:
More example INX files are available in the Inkscape distribution or in the Inkscape [http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/|SVN repository].
More example INX files are available in the Inkscape distribution or in the Inkscape [http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/|SVN repository].


  <inkscape-extension>
<pre>
    <_name>{Friendly Extension Name}</_name>
<inkscape-extension>
    <id>{org.domain.sub-domain.extension-name}</id>
  <_name>{Friendly Extension Name}</_name>
      <dependency type="executable"
  <id>{org.domain.sub-domain.extension-name}</id>
                  location="[extensions|{location}]">program.ext</dependency>
  <dependency type="executable" location="[extensions|path|plugins|{location}]">program.ext</dependency>
       <param name="{argumentName}" type="[int|float|string|boolean|description]"
  <param name="tab" type="notebook"> 
            min="{number}" max="{number}"
    <page name="controls" _gui-text="Controls">
            _gui-text="{Friendly Argument Name}">{default value}</param>
       <param name="{argumentName}" type="[int|float|string|boolean|description]" min="{number}" max="{number}"
     <effect>
        _gui-text="{Friendly Argument Name}">{default value}</param>
      <object-type>[all|{element type}]</object-type>
     </page>
        <effects-menu>
    <page name="help" _gui-text="Help">
          <submenu _name="{Extension Group Name}"/>
      <param name="help_text" type="description">{Friendly Extension Help}</param>
        </effects-menu>
    </page>
    </effect>
  </param>
    <script>
  <effect>
      <command reldir="extensions"
    <object-type>[all|{element type}]</object-type>
              interpreter="[python|perl|bash|{some other}]">program.ext</command>
      <effects-menu>
    </script>
        <submenu _name="{Extension Group Name}"/>
  </inkscape-extension>
      </effects-menu>
  </effect>
  <script>
    <command reldir="extensions" interpreter="[python|perl|ruby|bash|{some other}]">program.ext</command>
  </script>
</inkscape-extension>
</pre>


== DTD ==
== DTD ==
Line 50: Line 56:
  <!ELEMENT id (#PCDATA)>
  <!ELEMENT id (#PCDATA)>
  <!ELEMENT dependency (#PCDATA)>
  <!ELEMENT dependency (#PCDATA)>
  <!ELEMENT param (#PCDATA)>
  <!ELEMENT param (#PCDATA, page*)>
<!ELEMENT page (#PCDATA, param*)>
  <!ELEMENT extension (#PCDATA)>
  <!ELEMENT extension (#PCDATA)>
  <!ELEMENT mimetype (#PCDATA)>
  <!ELEMENT mimetype (#PCDATA)>
Line 64: Line 71:
  <!ATTLIST check reldir (absolute|path|extensions|plugins) #REQUIRED>
  <!ATTLIST check reldir (absolute|path|extensions|plugins) #REQUIRED>
  <!ATTLIST command reldir (absolute|path|extensions|plugins) #REQUIRED>
  <!ATTLIST command reldir (absolute|path|extensions|plugins) #REQUIRED>
<!ATTLIST command interpreter CDATA #REQUIRED>
  <!ATTLIST dependency type (executable|extension) #REQUIRED>
  <!ATTLIST dependency type (executable|extension) #REQUIRED>
  <!ATTLIST dependency location (absolute|path|extensions|plugins) #IMPLIED>
  <!ATTLIST dependency location (absolute|path|extensions|plugins) #IMPLIED>
  <!ATTLIST dependency description CDATA #IMPLIED>
  <!ATTLIST dependency description CDATA #IMPLIED>
<!ATTLIST page name CDATA #REQUIRED>
<!ATTLIST page gui-text CDATA #IMPLIED>
  <!ATTLIST param name CDATA #REQUIRED>
  <!ATTLIST param name CDATA #REQUIRED>
  <!ATTLIST param type (float|int) #REQUIRED>
  <!ATTLIST param type (int|float|string|boolean|enum|notebook|description) #REQUIRED>
<!ATTLIST param min CDATA #IMPLIED>
<!ATTLIST param max CDATA #IMPLIED>
<!ATTLIST param gui-text CDATA #IMPLIED>
<!ATTLIST submenu name CDATA #REQUIRED>
 


== See Also ==
== See Also ==

Revision as of 16:48, 26 April 2007

Introduction

In order for Inkscape to make use of an external script or program, you must describe that script to inkscape using an INX file. See the inkscape share directory for examples. The INX file allows the author to:

  • label strings for translation
  • define parameters
  • chain extensions
  • etc

Be sure to read through the INX files that come with Inkscape. Nothing beats a working example.

Localisation of extensions

To allow localisation of strings in extension for Inkscape, some xml tags have to be adapted to variant readable by intltool. It means that tags or parametres has to have "_" prepended to their name, e.g. <_name>name of extension</_name>

Also the path to the extension has to be included in POTFILES.in file to tell intltool where to look for translatable content.

Usefull information, before this section gets fully updated, can be found at Ted's blog.

Example

More example INX files are available in the Inkscape distribution or in the Inkscape repository.

<inkscape-extension>
  <_name>{Friendly Extension Name}</_name>
  <id>{org.domain.sub-domain.extension-name}</id>
  <dependency type="executable" location="[extensions|path|plugins|{location}]">program.ext</dependency>
  <param name="tab" type="notebook">  
    <page name="controls" _gui-text="Controls">
      <param name="{argumentName}" type="[int|float|string|boolean|description]" min="{number}" max="{number}"
        _gui-text="{Friendly Argument Name}">{default value}</param>
    </page>
    <page name="help" _gui-text="Help">
      <param name="help_text" type="description">{Friendly Extension Help}</param>
    </page>
  </param>
  <effect>
    <object-type>[all|{element type}]</object-type>
      <effects-menu>
        <submenu _name="{Extension Group Name}"/>
      </effects-menu>
  </effect>
  <script>
    <command reldir="extensions" interpreter="[python|perl|ruby|bash|{some other}]">program.ext</command>
  </script>
</inkscape-extension>

DTD

<!ELEMENT inkscape-extension (name, id, dependency*, param*,(input|output|effect),(script|plugin))>
<!ELEMENT input (extension, mimetype, filetype, filetypetooltip, output_extension?)>
<!ELEMENT output (extension, mimetype, filetype, filetypetooltip, dataloss?)>
<!ELEMENT effect (object-type)>
<!ELEMENT script (command, helper_extension*, check*)>
<!ELEMENT plugin (name)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT id (#PCDATA)>
<!ELEMENT dependency (#PCDATA)>
<!ELEMENT param (#PCDATA, page*)>
<!ELEMENT page (#PCDATA, param*)>
<!ELEMENT extension (#PCDATA)>
<!ELEMENT mimetype (#PCDATA)>
<!ELEMENT filetype (#PCDATA)>
<!ELEMENT filetooltip (#PCDATA)>
<!ELEMENT object-type (#PCDATA)>
<!ELEMENT command (#PCDATA)>
<!ELEMENT check (#PCDATA)>
<!ELEMENT dataloss (#PCDATA)>
<!ELEMENT helper_extension (#PCDATA)>
<!ELEMENT output_extension (#PCDATA)>

<!ATTLIST check reldir (absolute|path|extensions|plugins) #REQUIRED>
<!ATTLIST command reldir (absolute|path|extensions|plugins) #REQUIRED>
<!ATTLIST command interpreter CDATA #REQUIRED>
<!ATTLIST dependency type (executable|extension) #REQUIRED>
<!ATTLIST dependency location (absolute|path|extensions|plugins) #IMPLIED>
<!ATTLIST dependency description CDATA #IMPLIED>
<!ATTLIST page name CDATA #REQUIRED>
<!ATTLIST page gui-text CDATA #IMPLIED>
<!ATTLIST param name CDATA #REQUIRED>
<!ATTLIST param type (int|float|string|boolean|enum|notebook|description) #REQUIRED>
<!ATTLIST param min CDATA #IMPLIED>
<!ATTLIST param max CDATA #IMPLIED>
<!ATTLIST param gui-text CDATA #IMPLIED>
<!ATTLIST submenu name CDATA #REQUIRED>


See Also