Inputs and Outputs
Lore works by reading the HTML source of your document, and producing whatever output the user specifies on the command line. If the HTML document is well-formed XML that meets a certain minimum standard, Lore will be able to to produce some output. All Lore extensions will be written to redefine the input, and most will redefine the output in some way. The name of the default input is lore. When you write your extension, you will come up with a new name for your input, telling Lore what rules to use to process the file.

Lore can produce XHTML, LaTeX, and DocBook document formats, which can be displayed directly if you have a user agent capable of viewing them, or processed into a third form such as PostScript or PDF. Another output is called lint, after the static-checking utility for C, and is used for the same reason: to statically check input files for problems. The lint output is just a stream of error messages, not a formatted document, but is important because it gives users the ability to validate their input before trying to process it. For the first example, the only output we will be concerned with is LaTeX.

Creating New Inputs
Create a new input to tell Lore that your document is marked up differently from a vanilla Lore document. This gives you the power to define a new tag class, for example:

<p>The Frabjulon <span class="productname">Limpet 2000</span>
is the <span class="marketinglie">industry-leading</span> aquatic 
mollusc counter, bar none.</p>
The above HTML is an instance of a new input to Lore, which we will call MyHTML, to differentiate it from the lore input. We want it to have the following markup:

A productname class for the <span> tag, which produces underlined text
A marketinglie class for <span> tag, which produces larger type, bold text
Note that I chose class names that are valid Python identifiers. You will see why shortly. To get these two effects in Lore's HTML output, all we have to do is create a cascading stylesheet (CSS), and use it in the Lore XHTML Template. However, we also want these effects to work in LaTeX, and we want the output of lint to produce no warnings when it sees lines with these 2 classes. To make LaTeX and lint work, we start by creating a plugin.

 1 
from zope.interface import implements