Represents a block of text with a particular style.
These are the standard types of text blocks:
Document type. A structural type which can contain other structural types.
Paragragh type. A structural type which can not contain other structural types.
Unordered list. A structural type in which each of the words are of type doc.
Definition list. A structural type in which each of the words are of type definitionItem.
An item in a definition list. A structural type that always contains exactly two words: a text item and a doc item.
A block of text that can contain only non-structural types.
Underlined text.
Boldfaced text.
Italic text.
Reference to a text location. In this case, the first word is a reference, the remainder is the anchor text.
The first word of the text is the name of an image file. The remainder of the text is ignored.
Executes its contents as a shell command. In the event of an error, raises a parsing error. Output from the command is treated as NML source which is parsed in context.
Force a newline at this point in the enclosing text. All of the words are ignored.
The enclosed text is a cross reference (XXX this is very weak at this time - only can be used to reference other parts of the same document).
The enclosed text is a comment, and should not be visible when the document is rendered.
There are a variety of special types of text blocks:
backquoted type - everything in it is literal except the backslash.
preformatted/literal type. Everything in it is literal and the raw format (extraneous whitespace) of the original should be preserved. This type only has one word.
Preformatted. Raw format of the original should be preserved.
def __init__(self, src, typeName, tightLeft = 0):
Constructs a text block.
either a tuple (filename, line number) or a LineReader. Any other type is ignored.
Type name of the block.
If specified, indicates whether the block binds tightly (without whitespace) to the information to the left of it.
def __str__(self):
Returns the block in a minimal string format - basically this is raw content
with spaces between words.
Adds a child text block to the receiver.
adds the given sequence of words to the receiver.
Consumes a string in a manner appropriate to the text block.
Prints self in a form useful to der programmer. Returns the last line
as a string.
addChild(self, child)
def addChild(self, child):
addWords(self, words)
def addWords(self, words):
consume(self, str)
def consume(self, str):
debug(self, soFar)
def debug(self, soFar = ''):