Class instance calls [ex.=> x()] require a structured text
structure. Doc will then parse each paragraph in the structure
and will find the special structures within each paragraph.
Each special structure will be stored as an instance. Special
structures within another special structure are stored within
the top structure
EX : -underline this- => would be turned into an underline
instance. '-underline this' would be stored as an underline
instance with a strong instance stored in its string
Methods
|
|
|
|
__call__
|
__call__ ( self, doc )
|
|
color_paragraphs
|
color_paragraphs (
self,
raw_paragraphs,
type=type,
sequence_types=(type([] ), type(() ) ),
st=type( '' ),
)
|
|
color_text
|
color_text (
self,
str,
types=None,
)
Search the paragraph for each special structure
|
|
doc_bullet
|
doc_bullet (
self,
paragraph,
expr=re.compile( r'\s*[-*o]\s+' ).match,
)
|
|
doc_description
|
doc_description (
self,
paragraph,
delim=re.compile( r'\s+--\s+' ).search,
nb=re.compile( r'[^\000- ]' ).search,
)
|
|
doc_emphasize
|
doc_emphasize (
self,
s,
expr=re.compile(r'\*([%s%s%s\s]+?)\*' %( letters, digits, strongem_punc ) ).search,
)
|
|
doc_header
|
doc_header ( self, paragraph )
|
|
doc_href
|
doc_href (
self,
s,
expr,
punctuation=re.compile( r"[\,\.\?\!\;]+" ).match,
)
|
|
doc_href1
|
doc_href1 (
self,
s,
expr=re.compile( _DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES ).search,
)
|
|
doc_href2
|
doc_href2 (
self,
s,
expr=re.compile( _DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES ).search,
)
|
|
doc_inner_link
|
doc_inner_link (
self,
s,
expr1=re.compile( r"\.\.\s*" ).search,
expr2=re.compile(r"\[[%s%s]+\]" %( letters, digits ) ).search,
)
|
|
doc_literal
|
doc_literal (
self,
s,
expr=re.compile(r"(\W+|^)'([%s%s%s\s]+)'([%s]+|$)" %( letters, digits, literal_punc, phrase_delimiters ) ).search,
)
|
|
doc_named_link
|
doc_named_link (
self,
s,
expr=re.compile( r"(\.\.\s)(\[[%s0-9]+\])" % letters ).search,
)
|
|
doc_numbered
|
doc_numbered (
self,
paragraph,
expr=re.compile( r'(\s*[%s]\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters ).match,
)
|
|
doc_sgml
|
doc_sgml (
self,
s,
expr=re.compile( r"\<[%s0-9\.\=\'\"\:\/\-\#\+\s\*]+\>" % letters ).search,
)
SGML text is ignored and outputed as-is
|
|
doc_strong
|
doc_strong (
self,
s,
expr=re.compile(r'\*\*([%s%s%s\s]+?)\*\*' %( letters, digits, strongem_punc ) ).search,
)
|
|
doc_table
|
doc_table (
self,
paragraph,
expr=re.compile( r'\s*\|[-]+\|' ).match,
)
|
|
doc_underline
|
doc_underline (
self,
s,
expr=re.compile(r'_([%s%s%s\s]+)_[\s%s]' %( letters, digits, under_punc, phrase_delimiters ) ).search,
)
|
|
doc_xref
|
doc_xref (
self,
s,
expr=re.compile( '\[([%s0-9\-.:/;,\n\r\~]+)\]' % letters ).search,
)
|
|
parse
|
parse (
self,
raw_string,
text_type,
type=type,
st=type( '' ),
lt=type([] ),
)
Parse accepts a raw_string, an expr to test the raw_string,
and the raw_string's subparagraphs. Parse will continue to search through raw_string until
all instances of expr in raw_string are found.
If no instances of expr are found, raw_string is returned.
Otherwise a list of substrings and instances is returned
|
|