<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://www.inkscape.org/namespace/inkscape/extension">
  <start>
    <element name="inkscape-extension">
      <element name="_name">
        <text/>
      </element>
      <element name="id">
        <text/>
      </element>
      <zeroOrMore>
        <element name="dependency">
          <attribute name="type">
            <ref name="inx.dependency-type.values"/>
          </attribute>
          <optional>
            <attribute name="location">
              <ref name="inx.location.values"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="_description">
              <text/>
            </attribute>
          </optional>
          <text/>
        </element>
      </zeroOrMore>
      <zeroOrMore>
        <choice>
          <ref name="inx.parameters"/>
          <element name="param">
            <attribute name="name"/>
            <attribute name="type">
              <value>notebook</value>
            </attribute>
            <oneOrMore>
              <element name="page">
                <attribute name="name"/>
                <attribute name="_gui-text"/>
                <oneOrMore>
                  <ref name="inx.parameters"/>
                </oneOrMore>
              </element>
            </oneOrMore>
          </element>
        </choice>
      </zeroOrMore>
      <choice>
        <element name="input">
          <ref name="inx.io.common"/>
          <optional>
            <element name="output_extension">
              <text/>
            </element>
          </optional>
        </element>
        <element name="output">
          <ref name="inx.io.common"/>
          <optional>
            <element name="dataloss">
              <data type="boolean"/>
            </element>
          </optional>
        </element>
        <element name="effect">
          <optional>
            <attribute name="needs-document">
              <data type="boolean"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="needs-live-preview">
              <data type="boolean"/>
            </attribute>
          </optional>
          <element name="object-type">
            <choice>
              <value type="token">all</value>
              <value type="token">path</value>
              <value type="token">rect</value>
            </choice>
          </element>
          <element name="effects-menu">
            <choice>
              <attribute name="hidden">
                <value type="boolean">true</value>
              </attribute>
              <group>
                <element name="submenu">
                  <attribute name="_name">
                    <text/>
                  </attribute>
                  <empty/>
                </element>
              </group>
            </choice>
          </element>
        </element>
        <element name="path-effect">
          <empty/>
        </element>
        <element name="print">
          <empty/>
        </element>
      </choice>
      <choice>
        <element name="script">
          <group>
            <element name="command">
              <ref name="inx.reldir.attr"/>
              <optional>
                <attribute name="interpreter">
                  <choice>
                    <value>python</value>
                    <value>perl</value>
                  </choice>
                </attribute>
              </optional>
              <text/>
            </element>
            <optional>
              <element name="helper_extension">
                <data type="NMTOKEN"/>
              </element>
            </optional>
            <zeroOrMore>
              <element name="check">
                <ref name="inx.reldir.attr"/>
                <text/>
              </element>
            </zeroOrMore>
          </group>
        </element>
        <element name="xslt">
          <element name="file">
            <ref name="inx.reldir.attr"/>
            <text/>
          </element>
        </element>
        <element name="plugin">
          <element name="name">
            <text/>
          </element>
        </element>
      </choice>
    </element>
  </start>
  <define name="inx.reldir.attr">
    <attribute name="reldir">
      <ref name="inx.location.values"/>
    </attribute>
  </define>
  <define name="inx.location.values">
    <choice>
      <value>extensions</value>
      <value>path</value>
      <value>plugins</value>
    </choice>
  </define>
  <define name="inx.dependency-type.values">
    <choice>
      <value>extension</value>
      <value>executable</value>
      <value>plugin</value>
    </choice>
  </define>
  <define name="inx.io.common">
    <element name="extension">
      <text/>
    </element>
    <element name="mimetype">
      <text/>
    </element>
    <optional>
      <element name="_filetypename">
        <text/>
      </element>
    </optional>
    <optional>
      <element name="_filetypetooltip">
        <text/>
      </element>
    </optional>
  </define>
  <define name="inx.parameter">
    <attribute name="name">
      <data type="token"/>
    </attribute>
    <optional>
      <attribute name="gui-hidden">
        <data type="boolean"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="_gui-text"/>
    </optional>
    <choice>
      <group>
        <attribute name="type">
          <value>int</value>
        </attribute>
        <optional>
          <attribute name="min">
            <data type="integer"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="max">
            <data type="integer"/>
          </attribute>
        </optional>
        <choice>
          <empty/>
          <data type="integer"/>
        </choice>
      </group>
      <group>
        <attribute name="type">
          <value>float</value>
        </attribute>
        <optional>
          <attribute name="precision">
            <data type="integer"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="min">
            <data type="float"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="max">
            <data type="float"/>
          </attribute>
        </optional>
        <data type="float"/>
      </group>
      <group>
        <attribute name="type">
          <value>boolean</value>
        </attribute>
        <data type="boolean"/>
      </group>
      <group>
        <attribute name="type">
          <value>string</value>
        </attribute>
        <optional>
          <attribute name="max_length">
            <data type="integer"/>
          </attribute>
        </optional>
        <choice>
          <empty/>
          <text/>
        </choice>
      </group>
      <group>
        <attribute name="type">
          <value>description</value>
        </attribute>
        <text/>
      </group>
      <group>
        <attribute name="type">
          <value>enum</value>
        </attribute>
        <oneOrMore>
          <choice>
            <element name="_item">
              <ref name="inx.parameter.enum.item"/>
            </element>
            <element name="item">
              <ref name="inx.parameter.enum.item"/>
            </element>
          </choice>
        </oneOrMore>
      </group>
      <group>
        <attribute name="type">
          <value>optiongroup</value>
        </attribute>
        <optional>
          <attribute name="appearance">
            <value>minimal</value>
          </attribute>
        </optional>
        <oneOrMore>
          <choice>
            <element name="option">
              <ref name="inx.parameter.optiongroup.option"/>
            </element>
            <element name="_option">
              <ref name="inx.parameter.optiongroup.option"/>
            </element>
          </choice>
        </oneOrMore>
      </group>
    </choice>
  </define>
  <define name="inx.parameters">
    <choice>
      <element name="param">
        <ref name="inx.parameter"/>
      </element>
      <element name="_param">
        <ref name="inx.parameter"/>
      </element>
    </choice>
  </define>
  <define name="inx.parameter.enum.item">
    <attribute name="value"/>
    <data type="token"/>
  </define>
  <define name="inx.parameter.optiongroup.option">
    <optional>
      <attribute name="value">
        <text/>
      </attribute>
    </optional>
    <text/>
  </define>
</grammar>
