textile

This is Textile A Humane Web Text Generator

TODO: * Make it work with Python 2.1. * Make it work with Python 1.5.2? Or that's too optimistic?

--- To get an overview of all PyTextile's features, simply type 'tell me about textile.' in a single line.


Attributes

a ENCODING

'latin-1'

a HEAD_OFFSET

0

a res

{'battr': "(?P<parameters>                            # \n                     (?: (?:(?:<>|[<>=])                 # Either '<>', '<', '>' or '='\n                    (?![^\\s]*(?:<>|[<>=])))         # Look-ahead to ensure it happens once\n                                           # alignment\n                     |   (                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                                         # class and/or id\n                     |   (?:[\\(\\)]+)                     # Any number of '(' and/or ')'\n                                         # padding tags\n                     |   (?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                                            # [lang]\n                     |   (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                           # {style}\n                     )+                                     #\n                 )?                                         #\n              ",
 'iattr': "(?P<parameters>                            #\n                     (?:                                    #\n                     (?: [<>]+                              # horizontal alignment tags\n                         (?![^\\s]*(?:[<>])))                #     (must happen once)\n                     |                                      # \n                     (?: [\\-\\^~]+                           # vertical alignment tags\n                         (?![^\\s]*(?:[\\-\\^~])))             #     (must happen once)\n                     | (                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                                           # class and/or id\n                     | (?:[\\(\\)]+)                     # Any number of '(' and/or ')'\n                                           # padding tags\n                     | (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                             # {style}\n                     )+                                     #\n                 )?                                         #\n              ",
 'lattr': "(?P<parameters>                            # Links attributes\n                     (?: (?:(?:<>|[<>=])                 # Either '<>', '<', '>' or '='\n                    (?![^\\s]*(?:<>|[<>=])))         # Look-ahead to ensure it happens once\n                                           # alignment\n                     |   (                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                                         # class and/or id\n                     |   (?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                                            # [lang]\n                     |   (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                           # {style}\n                     )+                                     #\n                 )?                                         #\n              ",
 'liattr': "(?P<liparameters>                         # \n                      (?: (?:(?:<>|[<>=])                 # Either '<>', '<', '>' or '='\n                    (?![^\\s]*(?:<>|[<>=])))         # Look-ahead to ensure it happens once\n                                          # alignment\n                      |   (                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                                        # class and/or id\n                      |   (?:[\\(\\)]+)                     # Any number of '(' and/or ')'\n                                        # padding tags\n                      |   (?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                                           # [lang]\n                      |   (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                          # {style}\n                      )+                                    #\n                  )?                                        #\n              ",
 'olattr': "(?P<olparameters>                         # \n                      (?: (?:(?:<>|[<>=])                 # Either '<>', '<', '>' or '='\n                    (?![^\\s]*(?:<>|[<>=])))         # Look-ahead to ensure it happens once\n                                          # alignment\n                      | ((?:\\(\\#[\\w]+\\))                    # (#id)\n                          |                                 #\n                          (?:\\((?:[\\w]+(?:\\s[\\w]+)*)        #\n                            (?:\\#[\\w]+)?\\))                 # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                      )                                     #\n                      |   (?:[\\(\\)]+)                     # Any number of '(' and/or ')'\n                                        # padding tags\n                      |   (?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                                           # [lang]\n                      |   (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                          # {style}\n                      )+                                    #\n                  )?                                        #\n              ",
 'punct': '[\\!"#\\$%&\'()\\*\\+,\\-\\./:;<=>\\?@\\[\\\\\\]\\^_`{\\|}\\~]',
 'qattr': '(?P<parameters>                            #\n                     (?: (                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                                         # class and/or id\n                     |   (?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                                            # [lang]\n                     |   (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                           # {style}\n                     )+                                     #\n                 )?                                         #\n              ',
 'resize': '(?:                                       #\n                      (?:([\\d]+%?)x([\\d]+%?))               # 20x10\n                      |                                     #\n                      (?:                                   # or\n                          (?:([\\d]+)%?w\\s([\\d]+)%?h)        #     10h 20w\n                          |                                 #     or\n                          (?:([\\d]+)%?h\\s([\\d]+)%?w)        #     20w 10h \n                      )                                     #\n                  )?                                        #\n               ',
 'tattr': "(?P<parameters>                            #\n                     (?:                                    #\n                     (?: [\\^~]                              # vertical alignment\n                         (?![^\\s]*(?:[\\^~])))               #     (must happen once)\n                     |   (?:(?:<>|[<>=])                 # Either '<>', '<', '>' or '='\n                    (?![^\\s]*(?:<>|[<>=])))         # Look-ahead to ensure it happens once\n                                           # alignment\n                     |   (?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                                            # [lang]\n                     |   (?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                                           # {style}\n                     |   (                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                                         # class and/or id\n                     |   (?:[\\(\\)]+)                     # Any number of '(' and/or ')'\n                                         # padding\n                     |   _                                  # is this a header row/cell?\n                     |   \\\\\\d+                              # colspan\n                     |   /\\d+                               # rowspan\n                     )+                                     #\n                 )?                                         #\n              ",
 'url': '(?=[a-zA-Z0-9./#])                         # Must start correctly\n                 (?:                                        # Match the leading part (proto://hostname, or just hostname)\n                     (?:ftp|https?|telnet|nntp)             #     protocol\n                     ://                                    #     ://\n                     (?:                                    #     Optional \'username:password@\'\n                         \\w+                                #         username\n                         (?::\\w+)?                          #         optional :password\n                         @                                  #         @\n                     )?                                     # \n                     [-\\w]+(?:\\.\\w[-\\w]*)+                  #     hostname (sub.example.com)\n                 |                                          #\n                     (?:mailto:)?                           #     Optional mailto:\n                     [-\\+\\w]+                               #     username\n                     \\@                                     #     at\n                     [-\\w]+(?:\\.\\w[-\\w]*)+                  #     hostname\n                 |                                          #\n                     (?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\\.)+ #     domain without protocol\n                     (?:com\\b                               #     TLD\n                     |  edu\\b                               #\n                     |  biz\\b                               #\n                     |  gov\\b                               #\n                     |  in(?:t|fo)\\b                        #     .int or .info\n                     |  mil\\b                               #\n                     |  net\\b                               #\n                     |  org\\b                               #\n                     |  museum\\b                            #\n                     |  aero\\b                              #\n                     |  coop\\b                              #\n                     |  name\\b                              #\n                     |  pro\\b                               #\n                     |  [a-z][a-z]\\b                        #     two-letter country codes\n                     )                                      #\n                 )?                                         #\n                 (?::\\d+)?                                  # Optional port number\n                 (?:                                        # Rest of the URL, optional\n                     /?                                     #     Start with \'/\'\n                     [^.!,?;:"\'<>()\\[\\]{}\\s\\x7F-\\xFF]*      #     Can\'t start with these\n                     (?:                                    #\n                         [.!,?;:]+                          #     One or more of these\n                         [^.!,?;:"\'<>()\\[\\]{}\\s\\x7F-\\xFF]+  #     Can\'t finish with these\n                         #\'"                                #     # or \' or "\n                     )*                                     #\n                 )?                                         #\n              '}

a DEBUGLEVEL

0

a htmlizer

None

a itex2mml

None

a AMAZON

'www.amazon.com'

a VALIDATE

0

a __authors__

['Roberto A. F. De Almeida (roberto@dealmeida.net)',
 'Mark Pilgrim (f8dy@diveintomark.org)']

a parameters

{'align': "(?:(?:<>|[<>=])                 # Either '<>', '<', '>' or '='\n                    (?![^\\s]*(?:<>|[<>=])))         # Look-ahead to ensure it happens once\n                 ",
 'classid': '(                               #\n                        (?:\\(\\#[\\w]+\\))             # (#id)\n                        |                           #\n                        (?:\\((?:[\\w]+(?:\\s[\\w]+)*)  #\n                            (?:\\#[\\w]+)?\\))         # (class1 class2 ... classn#id) or (class1 class2 ... classn)\n                    )                               #\n                    (?![^\\s]*(?:\\([\\w#]+\\)))        # must happen once\n                 ',
 'lang': '(?:\\[[\\w-]+\\])                  # [lang]\n                    (?![^\\s]*(?:\\[.*?\\]))           # must happen once\n                 ',
 'padding': "(?:[\\(\\)]+)                     # Any number of '(' and/or ')'\n                 ",
 'style': '(?:{[^\\}]+})                    # {style}\n                    (?![^\\s]*(?:{.*?}))             # must happen once\n                 '}

a SANITIZE

0

a amazon_associate_id

None

a __history__

'\n1.0 - 2003/03/19 - MAP - initial release\n1.01 - 2003/03/19 - MAP - don\'t strip whitespace within <pre> tags;\n  map high-bit ASCII to HTML numeric entities\n1.02 - 2003/03/19 - MAP - changed hyperlink qtag expression to only\n  match valid URL characters (per RFC 2396); fixed preg_replace to\n  not match across line breaks (solves lots of problems with\n  mistakenly matching overlapping inline markup); fixed whitespace\n  stripping to only strip whitespace from beginning and end of lines,\n  not immediately before and after HTML tags.\n1.03 - 2003/03/20 - MAP - changed hyperlink qtag again to more\n  closely match original Textile (fixes problems with links\n  immediately followed by punctuation -- somewhere Dean is\n  grinning right now); handle curly apostrophe with "ve"\n  contraction; clean up empty titles at end.\n1.04 - 2003/03/23 - MAP - lstrip input to deal with extra spaces at\n  beginning of first line; tweaked list loop to handle consecutive lists\n1.1 - 2003/06/06 - MAP - created initial test suite for links and images,\n  and fixed a bunch of related bugs to pass them\n1.11 - 2003/07/20 - CL - don\'t demoronise unicode strings; handle\n  "they\'re" properly\n1.12 - 2003/07/23 - GW - print debug messages to stderr; handle bq(cite).\n1.13 - 2003/07/23 - MAP - wrap bq. text in <p>...</p>\n2 - 2004/03/26 - RAFA - rewritten from (almost) scratch to include\n  all features from Textile 2 and a little bit more.\n2.0.1 - 2004/04/02 - RAFA - Fixed validating function that uses uTidyLib.\n2.0.2 - 2004/04/02 - RAFA - Fixed problem with caps letters in URLs.\n2.0.3 - 2004/04/19 - RAFA - Multiple classes are allowed, thanks to Dave\n  Anderson. The "lang" attribute is now removed from <code>, to be valid\n  XHTML. Fixed <span class="caps">UCAS</span> problem.\n2.0.4 - 2004/05/20 - RAFA, CLB - Added inline formatting to table cells.\n  Curt Bergmann fixed a bug with the colspan formatting. Added Amazon\n  Associated id.\n2.0.5 - 2004/06/01 - CL - Applied patch from Chris Lawrence to (1) fix\n  that Amazon associates ID was being added to all search URIs, (2)\n  customize the Amazon site used with the AMAZON variable, and (3) added\n  an "isbn" URI type that links directly to an Amazon product by ISBN or\n  Amazon ASIN.\n2.0.6 - 2004/06/02 - RAFA - Fixed CAPS problem, again. I hope this is\n  the last time.\n2.0.7 - 2004/06/04 - RAFA, MW - Fixed bullet macro, thanks to Adam\n  Messinger. Added patch from Michal Wallace changing {}.pop() for\n  compatibility with Python 2.2.x.\n2.0.8 - 2004/06/25 - RAFA - Strip tags when adding the content from a\n  footnote to the reference link. Escaped \'<\' and \'>\' in the self-\n  generated documentation.\n2.0.9 - 2004/10/04 - RAFA - In images, if ALT is not defined, add an\n  empty attribute. Added "LaTeX" style open/close quotes. Fixed a bug \n  where the acronym definition was being formatted with inline rules. \n  Handle "broken" lines correctly, removing the <br /> from inside\n  split HTML tags.\n2.0.10 - 2004/10/06 - RAFA, LO - Escape all non-escaped ampersands.\n  Applied "trivial patch" from Ludvig Omholt to remove newline right\n  after the <pre> tag.\n'

a OUTPUT

'ascii'

Functions

f preg_replace(pattern, replacement, text) ...

Alternative re.sub that handles empty groups.

This acts like re.sub, except it replaces empty groups with '' instead of raising an exception.

f html_replace(pattern, replacement, text) ...

Replacement outside HTML tags.

Does a preg_replace only outside HTML tags.

f textile(text, **args) ...

This is Textile.

Generates XHTML from a simple markup developed by Dean Allen.

This function should be called like this:

textile(text, head_offset=0, validate=0, sanitize=0,
encoding='latin-1', output='ASCII')

Classes

C Textiler(...) ...

Textile formatter.

This is the base class for the PyTextile text processor.

This class contains 32 members.

See the source for more information.