Extending Quanta Plus

Christopher Hornbaker <chrishornbaker@earthlink.net>

This chapter describes how to customize Quanta Plus to your particular needs and how you can help Quanta Plus become better.

Document Type Editing Package (DTEP)

Document Type Editing Packages (DTEPs) are used in Quanta Plus to add support for markup, scripting languages, and CSS™. They allow Quanta Plus to provide features like auto-completion and node trees. Their simplicity and flexibility are what make Quanta Plus a fast, developer friendly IDE for web developers. They are what make Quanta Plus an easy-to-use, productive environment.

DTEPs come in two flavors, Family 1, which are markups, and Family 2, which are scripting and CSS™. DTEPs are made up of two parts, the Tag Folder and the Toolbars. Tag Folders are composed of two types of files, the description.rc and TagXML files, which carry the extension .tag. Toolbars are the handy, icon-oriented tabs of buttons (above the editing window) which place text into a document faster than the user can type.

This document describes how to make TagXML files, the description.rc, and toolbars. In short, a DTEP.

TagXML files (.tag) define both the attributes specific to a tag and the layout and contents of the properties dialog Quanta Plus shows for the tag. The description.rc file provides rules and information on the DTEP itself. Toolbars provide a quick means for adding tags into a document without worry of mis-spellings and such.

Packaging

Tag Folders are just that, folders. They are composed only of the description.rc and TagXML files. Tag Folders carry the name of the mark-up language and version, if applicable. (For example, html-4.01-strict)

TagXML

The table below lists the elements defined in TagXML and declares whether they are required or not. While not all are required, it is recommended that you use as many as you can so that other users can have a better experience and more information to work with.

ElementDefault UsageCase Usage
TAGSrequiredalways
tagrequiredalways
labeloptionalrequired to create a properties dialog
attroptionalrequired to define an attribute
tooltipoptionalrequired to have the properties dialog display a tooltip
whatsthisoptionalrequired to have the properties dialog display a “What's This ”
listoptionalrequired when an attr is of the type “list”
itemoptionalrequired when <list> is used
textlocationoptionalalways
locationoptionalrequired when label is used
textoptionalrequired when label is used
childrenoptionallist of tags that can appear within the tag being defined
childrequireda children entry
stoppingtagsoptionallist of tags that tell another tag to end
stoppingtagrequireda stoppingtags entry

TagXML Element Descriptions

The following sections will describe, in detail, each element. Everything from where they can go to what goes in them is layed out in an easy-to-follow manner.

TAGS

This is the root element of a TagXML document. It may appear in a document only once. It can contain the definition of multiple tags. This is an element-only type element.

Parent(s)Children
NONEtag
tag

Wrapper for tag being defined. This is an element-only type element.

Parent(s)Children
TAGSlabel, attr, stoppingtags
AttributeTypeValuesDefaultUseDescription
namestring  requiredSpecifies the name of the tag being defined.
singleboolean  optionalSpecifies whether or not the tag requires a closing tag </(tagname)>.
typestring xmltagoptionalSpecifies the type of tag being defined.
  xmltag  Type of tag is XML-based. (Family 1 only.)
  property  Type of tag is CSS™ related. (Family 2 only.)
  function  Type of tag is a script function. When used, <attr> becomes arguments of the function. (Family 2 only.)
  class  Type of tag is a script class. (Family 2 only.)
returnTypestring void optionalSpecifies the return type of tag being defined. (Family 2 only.)
  void  Type of tag returns void.
  int  Type of tag returns int.
  float  Type of tag returns float.
  long  Type of tag returns long.
  string  Type of tag returns string.
label

Place a label in the dialog. The text is specified by the <text> tag. This is an element-only type element.

Parent(s)Children
tagtext, location
attr

Defines an attribute of the tag. This element occurs once for each attribute. It defines the name and type of attribute. It also contains additional tags that specify how this attribute should be displayed, et cetera. This is an element-only type element.

Parent(s)Children
taglocation, list, tooltip, whatsthis, textlocation
AttributeTypeValuesDefaultUseDescription
namestring  requiredSpecifies the name of the attribute being defined.
typestring inputrequiredSpecifies the type of the attribute being defined.
  input  Field supports free text entries (text field).
  check  Field value is boolean (check box).
  color  Field value is a color.
  url  Field value is a URL. (Local file to refer to.)
  list  Field value is an item from a specified list.
statusstring optionalrequiredSpecifies whether or not the argument is required. (Family 2 only.)
  optional  Argument is optional.
  required  Argument is required.
  implied  Argument is implied.
tooltip

Defines the tooltip for a field in the dialog. This element is text-only.

Note

Currently only plain text is supported (you cannot use any markup).

Parent(s)Children
attrNONE
whatsthis

Defines the 'What's This' help for a field in the dialog. This element is text-only.

Note

Currently only plain text is supported (you cannot use any markup).

Parent(s)Children
attrNONE
list

A container tag that groups together the items in a list. It may appear only once for each attribute description. This is an element-only type element.

Parent(s)Children
attritem
item

Defines an item in a list. This element is text-only.

Parent(s)Children
listNONE
textlocation

Specifies the position of a tag's attribute text within a dialog. This tag can only occur once for each attribute in the dialog (i.e. one for each <attr> tag). This element is empty.

Parent(s)Children
attrNONE
AttributeTypeUseDescription
rownonNegativeIntegerrequiredSpecifies the row in the dialog layout of a field or label.
colnonNegativeIntegerrequiredSpecifies the column in the dialog layout of a field or label.
rowspannonNegativeIntegeroptionalSpecifies the number of rows a field should span.
colspannonNegativeIntegeroptionalSpecifies the number of columns a field should span.
location

Specifies the position and size of a field in the dialog. This tag should occur once for each field in the dialog (i.e. one for each <attr> and <label> tag). This element is empty.

Parent(s)Children
label, attrNONE
AttributeTypeUseDescription
rownonNegativeIntegerrequiredSpecifies the row in the dialog layout of a field or label.
colnonNegativeIntegerrequiredSpecifies the column in the dialog layout of a field or label.
rowspannonNegativeIntegeroptionalSpecifies the number of rows a field should span.
colspannonNegativeIntegeroptionalSpecifies the number of columns a field should span.
text

Define the text for a label or check box. This element is text-only.

Parent(s)Children
label, attrNONE
children

Defines a list of elements that can appear within the tag being specified. This element is an element-only type element.

Parent(s)Children
tagchild
child

Defines a child tag. This element is empty.

Parent(s)Children
childrenNONE
AttributeTypeUseDescription
namestringrequiredSpecifies a tag that can appear within the a certain tag.
stoppingtags

Defines a list of elements that force a tag to end. This element is an element-only type element.

Parent(s)Children
tagstoppingtag
stoppingtag

Defines a stopping tag. This element is empty.

Parent(s)Children
stoppingtagsNONE
AttributeTypeUseDescription
namestringrequiredSpecifies which tags force the ending of another tag.

TagXML Usage

All TagXML files must begin with the XML™ declaration: <?xml version="1.0" encoding="UTF-8"?> and must be properly nested and closed.

Important

White space does not adversely affect anything, but watch out for & and < characters. These should likely be replaced with an &amp; and &lt;, respectively, in elements such as <tooltip>, <whatsthis>, and <text>. Not doing so will not cause a crash, but you will have chunks of your work disappear if you do not.

TagXML Validation

To validate your TagXML files, simply click the “Tools” pop-up dialog at the top of Quanta Plus and select “Validate TagXML.” A dialog will present itself and you need only to follow the simple directions.

Note

This feature is currently not present. Currently validation occurs when the TagXML files are loaded into Quanta Plus.

TagXML Examples

Family 1

The following will show you a valid Family 1 TagXML file. This file happens to describe W3C® XML™ Schema's <schema> element. The file name for this TagXML file would be schema.tag. Simple, eh?



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TAGS>
<TAGS>
 <tag name="schema">
  <label>
   <text>id</text>
   <location col="0" row="0"/>
  </label>
  <attr name="id" type="input">
   <tooltip>A unique ID for the element.</tooltip>
   <whatsthis>A unique ID for the element.</whatsthis>
   <location col="1" row="0"/>
  </attr>

  <label>
   <text>version</text>
   <location col="0" row="1"/>
  </label>
  <attr name="version" type="input">
   <tooltip>Version of the schema.</tooltip>
   <whatsthis>Version of the schema.</whatsthis>
   <location col="1" row="1"/>
  </attr>

  <label>
   <text>targetNamespace</text>
   <location col="0" row="2"/>
  </label>
  <attr name="targetNamespace" type="input">
   <tooltip>URI reference of the namespace of this schema.</tooltip>
   <whatsthis>URI reference of the namespace of this schema.</whatsthis>
   <location col="1" row="2"/>
  </attr>

  <label>
   <text>xmlns</text>
   <location col="0" row="3"/>
  </label>
  <attr name="xmlns" type="input">
   <tooltip>URI reference for one or more namespaces for use in this schema.
   If no prefix is used, then components of that namespace may be used unqualified.</tooltip>
   <whatsthis>URI reference for one or more namespaces for use in this schema.
   If no prefix is used, then components of that namespace may be used unqualified.</whatsthis>
   <location col="1" row="3"/>
  </attr>

  <label>
   <text>attributeFormDefault</text>
   <location col="0" row="4"/>
  </label>
  <attr name="attributeFormDefault" type="list">
   <items>
    <item>qualified</item>
    <item>unqualified</item>
   </items>
   <tooltip>Default form for all attributes within this schema.</tooltip>
   <whatsthis>Default form for all attributes within this schema.</whatsthis>
   <location col="1" row="4"/>
  </attr>

  <label>
   <text>elementFormDefault</text>
   <location col="0" row="5"/>
  </label>
  <attr name="elementFormDefault" type="list">
   <items>
    <item>qualified</item>
    <item>unqualified</item>
   </items>
   <tooltip>Default form for all elements within this schema.</tooltip>
   <whatsthis>Default form for all elements within this schema.</whatsthis>
   <location col="1" row="5"/>
  </attr>

  <label>
   <text>blockDefault</text>
   <location col="0" row="6"/>
  </label>
  <attr name="blockDefault" type="input">
   <location col="1" row="6"/>
  </attr>

  <label>
   <text>finalDefault</text>
   <location col="0" row="7"/>
  </label>
  <attr name="finalDefault" type="input">
   <location col="1" row="7"/>
  </attr>
 </tag>
</TAGS>

Family 2

The following will show you a valid Family 2 TagXML file. This file happens to describe PHP's overload function. The file name for this TagXML file would be overload.tag.



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tags>
<tags>
  <tag name="overload" type="function" returnType="void">
<attr name="class_name" type="string" status="optional"/>
  </tag>
</tags>

description.rc

The description.rc file is, also, quite simple. Not all of the following need be used. The basic structure of the description.rc file is as follows.

Family 1 Structure



[General] - Generic information.
Version = Use 1 for Quanta Plus version <=3.1.2 and 2 for any version greater.
Name = DTD definition string. (-//W3C®//DTD HTML 4.01 Transitional//EN)
NickName = The beautified name of the DTD. (HTML 4.01 Transitional). If not defined, Name is
used as NickName.
URL = URL pointing to the DTD definition. (http://www.w3.org/TR/html4/loose.dtd)
DoctypeString = The string that should appear in the !DOCTYPE declaration.
(HTML PUBLIC "-//W3C®//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd")
Inherits = The name of the DTD from where this DTD inherits its tags. (-//W3C®//DTD HTML 4.01//EN)
DefaultExtension = New files are created with this extension. (html)
Groups = The list of common attribute groups, which may be present in more than one tag.
(Core, I18n, Script) See below. (Group1, Group2...)
NumOfPages = How many pages does a tag dialog have, aside of the page containing the
attributes defined in the tag file? See below. (Page1,...)
CaseSensitive = Case-sensitiveness of the DTD. (true|false)
Family = 1This type of DTEP is of family 1, since it is a markup.

[Toolbars] - Information about DTEP toolbars.
Location = The folder name inside $KDEDIR($KDEHOME)/share/apps/quanta/toolbars
where the toolbars for this DTEP are.
Names = The list of toolbar file names, minus the .toolbar.tgz extension, that
are loaded for this DTEP from the above folder.

[Group1] - Replace with one of the Groups listed below.
Attributes = The list of attributes for this group. Currently, all of the listed attributes are
 treated as strings.
Example:
[Core]
Attributes = id, class, style, title

[Page1] - Description of a tag editor page.
Title = The title of this page in the tag editing dialog.
Groups = List of groups appearing on this page. (Core, I18n)

[Extra rules] - Some rules not fitted in other places.
BooleanAttributes = (simple|complex)
Example for simple: <tag booleanAttr>.
Example for complex: <tag booleanAttr="1"> or <tag booleanAttr="true">
Single Tag Style = (html|XML)
Example for html: <single_tag>
Example for XML:  <single_tag />
StructGroupsCount = The number of structure groups. See below.
MinusAllowedInWords = If true "this-is-a-word" is treated like a word. Otherwise,
it is treated like 4 words.
TagAutoCompleteAfter = CHAR. The auto-completion box is brought up automatically
once this CHAR is entered or SPACE is pressed after this CHAR. For DTEP family 1,
it is usually "<" The text "none" instead of a CHAR specifies that the tag
completion box should not be brought up automatically, only if the user requests it.
AttributeSeparator = CHAR. This CHAR means that the attribute name has ended.
It is " for XML DTEPs.
TagSeparator = CHAR. Similar to the above.

[StructGroup_1] - Definition of structure group 1.
Name = The text that appears if there are tags matching this group settings.
No_Name = The text that appears if there are NO tags matching this group settings.
Icon = The name of the icon appearing before the above texts.
Tag = tagname(attribute1, attribute2, ...). Tags with name tagname will appear
under this group. The item text will be "attribute1_value | attribute2_value | ..."
Currently only one tag may be listed here.
HasFileName = (true|false) True, if the item text (above attribute values) contains a file name.
FileNameRx = Regular expression used to remove the unnecessary chars from the item text.

[Parsing rules] - Rules used when parsing the document.
SpecialAreas = The beginning and ending string of special areas, separatted by a comma.
Special areas are not parsed according to this DTEP's rules, but as their own rules.
A special area can be a DTEP of another family, a comment, or something to that effect.
Eg. <!-- -->
SpecialAreaNames = Comma separated list of the above special area names. Eg. comment
SpecialTags = tagname(attributename) - Specifies a tag which defines the start of a special area.
MayContain = Comma separated list of family 2 DTEPs that can be present in the document.
(php, css)

Family 2 Structure



[General] - Generic information.
Version = Use 1 for Quanta Plus version <=3.1.2 and 2 for any version greater.
Name = Proper name
NickName = What every calls it. If not defined, Name is used as NickName.
Inherits = The name of the DTEP from where this DTEP inherits tags. (The Name, not NickName)
DefaultExtension = New files are created with this extension. (php)
NumOfPages = 0   Always zero because there is not a tag editing dialog for
Family 2 DTEPs.
CaseSensitive = Case-sensitiveness of the DTEP. (true|false)
Family = 2This type of DTEP is of family 2, since it is not markup.

[Toolbars] - Information about DTEP toolbars.
Location = The folder name inside $KDEDIR($KDEHOME)/share/apps/quanta/toolbars
where the toolbars for this DTEP are.
Names = The list of toolbar file names, minus the .toolbar.tgz extension, that
are loaded for this DTEP from the above folder.

[Extra rules] - Some rules not fitted in other places.
BooleanAttributes = (simple|complex)
Example for simple: <tag booleanAttr>.
Example for complex: <tag booleanAttr="1"> or <tag booleanAttr="true">
StructGroupsCount = The number of structure groups. See below.
MinusAllowedInWords = If true "this-is-a-word" is treated like a word. Otherwise,
it is treated like 4 words.
TagAutoCompleteAfter = CHAR. The auto-completion box is brought up automatically
once this CHAR is entered or SPACE is pressed after this CHAR. For DTEP family 1,
it is usually "<" The text "none" instead of a CHAR specifies that the tag
completion box should not be brought up automatically, only if the user requests it.
AttributeSeparator = CHAR. This CHAR means that the attribute name has ended.
It is " for XML DTEPs.
TagSeparator = CHAR. Similar to the above.
AttributeAutoCompletionAfter = CHAR. Similar to the TagAutoCompletionAfter, but
for tag attributes. It is "(" by default and ":" for CSS.

[StructGroup_1] - Definition of structure group 1.
Name = The text that appears if there are tags matching this group settings.
No_Name = The text that appears if there are NO tags matching this group settings.
Icon = The name of the icon appearing before the above texts.
Tag = tagname(attribute1, attribute2, ...). Tags with name tagname will appear
under this group. The item text will be "attribute1_value | attribute2_value | ..."
Currently only one tag may be listed here.
HasFileName = (true|false) True, if the item text (above attribute values) contains a file name.
FileNameRx = Regular expression used to remove the unnecessary chars from the item text.
SearchRx = regular expression used to find text areas in the Family 2 DTEP, which
will belong to this group
ClearRx = regular expression used to clear unwanted text/chars from the above
search result. The cleaned string will appear in the structure tree.

[Parsing rules] - Rules used when parsing the document.
SpecialAreas = The beginning and ending string of special areas, separated by a comma.
Special areas are not parsed according to this DTEP's rules, but as their own rules.
A special area can be a DTEP of another family, a comment, or something to that effect.
Eg. <!-- -->
SpecialAreaNames = Comma separated list of the above special area names. Eg. comment
SpecialTags = tagname(attributename) - Specifies a tag which defines the start of a special area.
AreaBorders = Comma separated list of the area borders encapsulating this Family 2 DTEP. In the
case of PHP, it is: <? ?>, <* *>, <% %>
Tags = tagname(attribute). If the parent(real) DTD has a tag with tagname and
the attribute value of this tag is equal with the DTD name, the tag area
is parsed according to the rules of this DTD.
Comments = comma separated list of area borders for comments. EOL means end-of-line.
Eg: // EOL, /* */
StructKeywords = Semicolon separated list of structure keywords. Structures are treated
as new nodes in the structure tree.
StructBeginStr = A string specifying the beginning of a structure (like {)
StructEndStr = A string specifying the beginning of a structure (like })
StructRx = Regular expression containing the beginning or the end of the structure
area. Eg. \\{ | \\} (structure area border can be { or })