An instance of this class is a small state machine that keeps
track of double-quote and underbar characters. Each call to
.convert() method converts one character of
an English name into HTML.
It replaces even-numbered double-quote characters with left double quotes, and replaces odd-numbered double-quotes with right double quotes.
It replaces even-numbered underbars with a start tag that begins italic, and it replaces odd-numbered underbars with the corresponding end tag.
cssClass argument to
None, these tags
will be the deprecated HTML “
cssClass argument is a string, the
.convert() method will use a “
span” element with a “
class” attribute whose value is the given
Here is the formal interface:
# - - - - - c l a s s H t m l e r class Htmler(object): '''State machine for HTML markup. Exports: Htmler(): [ return a new Htmler instance with quote and italic states off ] .quotes: [ if self is between quotes -> True else -> False ] .italics: [ if self is between underbars -> True else -> False ] .convert(c, cssClass): [ if c is a double-quote -> if self.quotes -> self.quotes := False return a right double-quote else -> self.quotes := True return a left double-quote else if c is an underbar -> if self.italics -> if cssClass is None -> self.italics := False return "</i>" else -> self.italics := False return "</span> else -> if cssClass is None -> self.italics := True return "<i>" else -> self.italics := False return "<span class='(cssClass)'>" else -> return c ] '''