Hacking &appname;
In the spirit of Free Software, you're welcome to hack on &appname; as much as you like. You should be able to write scripts to import, export, or modify data very easily. This chapter gives you more information about doing that.
File Format
The default &appname; data file is a zip archive, normally with a .tc file extension. Inside the archive is a top-level tellico.xml file. Images may be included inside the images/ directory in the archive., or they may be included in the &xml; data directly in a base64 encoding. Images may also be saved inside the application data directory, in which case, they are not in the data file at all. &appname; can also load the &xml; file, by itself, uncompressed.
&xml; DataCollection
]]>
The file begins with the required &xml; declaration and encoding, followed by the doctype. When a new field type is added or additional properties are set on the default fields, the doctype DTD version is incremented. &appname; is always able to open and read any previous DTD version, but will save files in the current version. The DTD location does point to an actual DTD file.
The top-level element is a <tellico> element, containing the default namespace declaration and the syntax version of the file, which should always match the DTD.
The <tellico> element contains one <collection> element. Multiple collections are ignored, for now. The title attribute contains the collection title, while the type specifies what kinds of entries are contained in the collection. The allowable types are in listed in a later section. An optional entryTitle attribute may be used to specify the title of the entries for a custom collection, and should be plural.
Fields
]]>
All of the fields are defined inside a <fields> element, of which there can be only one. All of the information for a field, except for any extended properties, are included as attributes of the <field> element. The allowable values for the flags, format, and type attributes are given in a following section.
A <field> element with a name attribute equal to _default tells &appname; to include all the default fields for that collection type.
EntriesC++ Programming Language, TheStroustrup, BjarneAddison-Wesley Pub Co3rd19970-201-88954-4Non-FictionProgrammingComputerscf65a2f023b6cb9e9233323dca10ac7c.jpeg
]]>
For every field in the collection, an <entry> may contain an element whose name is identical to the field name. If multiple values are allowed for the field, then the letter s is added to the field name to create an element, and each value is added as a child of the element, as in the case of the author, genre, and keyword fields above.
As a result, if additional fields are added to the collection, the date file will no longer conform to the DTD. However, &appname; uses a non-validating &xml; parser, so additional fields do not cause problems.
Images
]]>
Inside the <images> element, each image referenced by an entry is listed, along with attributes describing the image's size, format, and id. If the image is contained inside the Zip file, the element is empty. Otherwise, the image data may be contained in the &xml; stream as base64-encoded text.
Collection Type Values
The type of collection is given in the type attribute of the collection element. The value is equal to the Type enum value in src/collection.h.
Collection Type ValuesCollection TypeValueCustom Collection1Book Collection2Video Collection3Music Collection4Bibliography5Comic Book Collection6Wine Collection7Coin Collection8Stamp Collection9Trading Card Collection10Video Game Collection11File Catalog12Board Game Collection13
Field Type Values
&appname; will include all the default fields for a collection if the first field element has the name _default. For Paragraph, Table, or Image fields, the field category should be identical to the field title.
The type of field is given in the type attribute of the field element. The value is equal to the FieldType enum value in src/field.h. ReadOnly fields were intended for fields which should be retained in the collection, but which should not be editable by the user, such as some fields added when importing a collection from another file format. It is not currently used.
Field Type ValuesField TypeValueSimple Text1Paragraph2Choice3Checkbox4ReadOnly5Number6URL7Single-Column Table8Image10Dependent11Date12Rating14
The field may have different flags set, given as a bitwise OR'd value in the flags attribute on the field element. The flag for preventing the user from deleting a field is intended for such things as the citation key for bibliographic entries.
Field Flag ValuesField FlagsValueAllow Multiple Values0x01Allow Grouping0x02Allow Completion0x04Disallow Deleting0x08
The format of the field is given in the format attribute on the field element. Date Formatting is not currently used. Grouping by People uses all the fields which use Name Formatting.
Field Format ValuesField FormatValueCapitalization Only0Title Formatting1Name Formatting2Date Formatting3No Formatting4
Hidden Configuration Options
&appname; has some additional configuration options that are not visible in the &config-dialog;. They are not important enough to warrant cluttering the dialog with more settings, but as they represent options which may appeal to various users, the application does read them from the configuration file.
The settings for &appname; are saved in a file in the user's home folder, namely $TDEHOME/share/config/tellicorc. Within that file, settings are put in groups, which appear with bracketed names, such as [General Options]. To add a setting to the General Options group, find the line in the settings file with that group name. If it does not appear, then create it yourself by adding a line saying [General Options]. Then, the setting can be added underneath the group name.
[General Options]
These settings should be placed in the General Options group.
Max Icon Size
The maximum size of the icons in the &icon-view; may be changed with this setting. The default value is 96. The size must be in the range of 32 to 128.
ExampleMax Icon Size=72[Options - bibtex]
These settings should be placed in the Options - bibtex group.
lyxpipe
This setting is for the location of the lyxpipe for sending bibliographic citations. It should not include the .in suffix.
Examplelyxpipe=$HOME/.lyx/lyxpipe[Export Options - PilotDB]
These settings should be placed in the Export Options - PilotDB group.
Charset
The encoding of the exported data within the PilotDB file may be changed with this setting. The default value is the character set for the user's locale.
ExampleCharset=Windows-1250Bibtex Character Translation
When bibtex files are imported or exported, certain characters are translated between their TeX equivalents and the Unicode characters. Those character mappings are contained in the bibtex-translation.xml file, located in the installation data directory. The mappings can be modified, as desired. The key element contains the Unicode character, and the string elements within contain the TeX equivalents, which may be a one-to-many mapping. The first one is the one used when exporting to bibtex.
{\`A}\`{A}
]]>
XSLT Tricks
Here are some tips for writing XSLT to parse &appname; &xml; data: (TBD).