Imported modules
|
|
import STDOM
import re
from string import split, join, replace, expandtabs, strip, find
|
Functions
|
|
StructuredText
display
display2
findlevel
indention
insert
|
|
StructuredText
|
StructuredText ( paragraphs, delimiter=re.compile( para_delim ) )
StructuredText accepts paragraphs, which is a list of
lines to be parsed. StructuredText creates a structure
which mimics the structure of the paragraphs.
Structure => [paragraph,[sub-paragraphs]] Golly, the capitalization of this function always makes me think it's a class
|
|
display
|
display ( struct )
runs through the structure and prints out
the paragraphs. If the insertion works
correctly, display's results should mimic
the orignal paragraphs.
|
|
display2
|
display2 ( struct )
runs through the structure and prints out
the paragraphs. If the insertion works
correctly, display's results should mimic
the orignal paragraphs.
|
|
findlevel
|
findlevel ( levels, indent )
remove all level information of levels
with a greater level of indentation.
Then return which level should insert this
paragraph
|
|
indention
|
indention ( str, front=re.compile( "^\s+" ).match )
Find the number of leading spaces. If none, return 0.
|
|
insert
|
insert (
struct,
top,
level,
)
find what will be the parant paragraph of
a sentence and return that paragraph's
sub-paragraphs. The new paragraph will be
appended to those sub-paragraphs
|
Classes
|
|
|