text2book is a simple utility which converts a plain text file into Yagsbook XML format. The file should obey some simple rules, since it uses short keywords to define things such as topics and categories for when the article is generated.
It was written primarily for when writing articles on a PDA, where input of large numbers of XML tags can be more trouble that it's worth.
The utility is a C program. Currently it is only available in CVS, but can be built with a single invocation of make.
To invoke the command, use the following.
For example, to convert the files file1.ty and file2.ty and output the results into directory 'yags', use the following command:
The format of files to be converted is quite strict, but is kept easy to type if using a small keyboard (or a stylus). There are three distinct areas - the filename, header and body of the file.
The filename should be the URI of the Yagsbook article. This means that it may only contain lower case alphanumeric characters plus the '-' character. The file extension is normally '.ty' though this is not enforced.
The filename is used directly when filling in fields within the generated XML, so it is important to get it right.
The header consists of meta data for the document, including topic sets and subject lines. The title is always the first line of the file, and subsequent lines are special commands. The first blank line ends the command section, and everything following that blank line is assumed to be body text.
For example, consider the following file header which describes the Stone of Annuminas.
Line 1 defines the title of this article. The title is put into the header and is also used for the title of the first section of the body text. This is always the first line of the
Line 2 uses the #sub tag to define the subject of the article. All '#' commands must be at the start of the line, and are three character commands. The first word following the '#sub' is the URI of the subject article. All subsequent words are the long text of the subject. If no subject command is given, then it is assumed that the article is its own subject.
The category of the article is defined on line 3.
The following '#top' lines give the topic sets for the article. Each topic consists of the URI listed first, followed by the full text description of that topic.
The header is ended by a single blank line.
The body of each file should consists of a number of paragraphs of text, each unbroken by new lines. Each paragraph is ended by a newline and any number of empty lines.