mò gã¸Ec@sXdZdZdkZdkZdklZdklZdeii fd„ƒYZ dS(sÿ This is ``docutils.parsers.rst`` package. It exports a single class, `Parser`, the reStructuredText parser. Usage ===== 1. Create a parser:: parser = docutils.parsers.rst.Parser() Several optional arguments may be passed to modify the parser's behavior. Please see `Customizing the Parser`_ below for details. 2. Gather input (a multi-line string), by reading a file or the standard input:: input = sys.stdin.read() 3. Create a new empty `docutils.nodes.document` tree:: document = docutils.utils.new_document(source, settings) See `docutils.utils.new_document()` for parameter details. 4. Run the parser, populating the document tree:: parser.parse(input, document) Parser Overview =============== The reStructuredText parser is implemented as a state machine, examining its input one line at a time. To understand how the parser works, please first become familiar with the `docutils.statemachine` module, then see the `states` module. Customizing the Parser ---------------------- Anything that isn't already customizable is that way simply because that type of customizability hasn't been implemented yet. Patches welcome! When instantiating an object of the `Parser` class, two parameters may be passed: ``rfc2822`` and ``inliner``. Pass ``rfc2822=1`` to enable an initial RFC-2822 style header block, parsed as a "field_list" element (with "class" attribute set to "rfc2822"). Currently this is the only body-level element which is customizable without subclassing. (Tip: subclass `Parser` and change its "state_classes" and "initial_state" attributes to refer to new classes. Contact the author if you need more details.) The ``inliner`` parameter takes an instance of `states.Inliner` or a subclass. It handles inline markup recognition. A common extension is the addition of further implicit hyperlinks, like "RFC 2822". This can be done by subclassing `states.Inliner`, adding a new method for the implicit markup, and adding a ``(pattern, method)`` pair to the "implicit_dispatch" attribute of the subclass. See `states.Inliner.implicit_inline()` for details. Explicit inline markup can be customized in a `states.Inliner` subclass via the ``patterns.initial`` and ``dispatch`` attributes (and new methods as appropriate). treStructuredTextN(sstates(sfrontendtParsercBstZdZddddddfZdedd ghd d <d eitdefaultshttp://www.python.org/peps/sARecognize and link to standalone RFC references (like "RFC 822").s--rfc-referencessBBase URL for RFC references (default "http://www.faqs.org/rfcs/").s--rfc-base-urlshttp://www.faqs.org/rfcs/s3Set number of spaces for tab expansion (default 8).s --tab-widthsttypetintis)Remove spaces before footnote references.s--trim-footnote-reference-spaces(Leave spaces before footnote references.s --leave-footnote-reference-spacet store_falsetdestttrim_footnote_reference_spaces{Disable directives that insert the contents of external file ("include" & "raw"); replaced with a "warning" system message.s--no-file-insertionitfile_insertion_enabledseEnable directives that insert the contents of external file ("include" & "raw"). Enabled by default.s--file-insertion-enabledsGDisable the "raw" directives; replaced with a "warning" system message.s--no-rawt raw_enableds0Enable the "raw" directive. Enabled by default.s --raw-enabledsrestructuredtext parsertparserscCs6|o d|_n d|_ti|_||_dS(Nt RFC2822BodytBody(trfc2822tselft initial_statetstatest state_classestinliner(RRR((t</data/zmath/zope/lib/python/docutils/parsers/rst/__init__.pyt__init__‰s    cCs‹|i||ƒtid|id|id|ii ƒ|_ t i i |d|i iddƒ}|i i||d|iƒ|iƒdS( s=Parse `inputstring` and populate `document`, a document tree.RRtdebugt tab_widthtconvert_whitespaceiRN(Rt setup_parset inputstringtdocumentRtRSTStateMachineRRtreportert debug_flagt statemachinetdocutilst string2linestsettingsR t inputlinestrunRt finish_parse(RR#R$R,((Rtparse‘s  (t__name__t __module__t__doc__t supportedtNonetfrontendtvalidate_booleantvalidate_url_trailing_slashtvalidate_nonnegative_intt settings_spectconfig_sectiontconfig_section_dependenciesRR/(((RRQs ÿÏ. ( R2t __docformat__tdocutils.parsersR)tdocutils.statemachinetdocutils.parsers.rstRR5RR(RR)RR5R<((Rt?Fs