This package provides methods to access information stored in a BibTex file. During parsing it is possible to let the data be validated. In addition. the creation of BibTex Strings as well as RTF Strings is also supported.
Пример 57-1. Loading a BibTex File and printing the parsed array
|
Options can be set either in the constructor or with the method setOption(). When setting in the constructor the options are given in an associative array. The options are:
stripDelimiter (default: true) Stripping the delimiter surrounding the entries.
validate (default: true) Validation while parsing.
unwrap (default: false) Unwrapping entries while parsing.
wordWrapWidth (default: false) If set to a number higher one that the entries are wrapped after that amount of characters.
wordWrapBreak (default: \n) String used to break the line (attached to the line).
wordWrapCut (default: 0) If set to zero the line will we wrapped at the next possible space, if set to one the line will be wrapped exactly after the given amount of characters.
removeCurlyBraces (default: false) If set to true Curly Braces will be removed.
Пример 57-2. Setting options in the constructor
|
Пример 57-3. Setting options using setOption
|
The data is stored in the class variable data. This is a a list where each entry is a hash table representing one bibtex-entry. The keys of the hash table correspond to the keys used in bibtex and the values are the corresponding values. Some of these keys are:
cite - The key used in a LaTeX source to do the citing.
type - The type of the entry, like techreport, book and so on.
author - One or more authors of the entry. This entry is also a list with hash tables representing the authors as entries. The author has table is explained later.
title - Title of the entry.
As described before the authors are stored in a list. Every entry representing one author as a has table. The hash table consits of four keys: first, von, last and jr. The keys are explained in the following list:
first - The first name of the author.
von - Some names have a 'von' part in their name. This is usually a sign of nobleness.
last - The last name of the author.
jr - Sometimes a author is the son of his father and has the same name, then the value would be jr. The same is true for the value sen but vice versa.
To add an entry simply create a hash table with the needed keys and values and call the method addEntry().
Пример 57-4. Adding an entry
|
Пред. | Начало | След. |
Structures_BibTex | Уровень выше | Warnings |
HIVE: All information for read only. Please respect copyright! |