o gJ^‚ ã@sldZdZddlZddlmZddlmZmZmZddl m Z Gdd„deƒZ Gd d „d e ƒZ iZ d d „ZdS) z0 This package contains Docutils Reader modules. ÚreStructuredTextéN)Ú import_module)ÚutilsÚparsersÚ Component)Ú universalc@sJeZdZdZdZdZdd„Zddd„Zd d „Zd d „Z d d„Z dd„Z dS)ÚReadera9 Abstract base class for docutils Readers. Each reader module or package must export a subclass also called 'Reader'. The two steps of a Reader's responsibility are to read data from the source Input object and parse the data with the Parser object. Call `read()` to process a document. ÚreaderÚreaderscCst |¡tjtjtjgS©N)rÚget_transformsrÚ DecorationsÚExposeInternalsÚ StripComments©Úself©rú;/usr/lib/python3/dist-packages/docutils/readers/__init__.pyr !s ýzReader.get_transformsNcCs0||_ |dur|r| |¡d|_ d|_dS)z· Initialize the Reader instance. Several instance attributes are defined with dummy initial values. Subclasses may use these attributes as they wish. N)ÚparserÚ set_parserÚsourceÚinput)rrÚ parser_namerrrÚ__init__'s  zReader.__init__cCst |¡}|ƒ|_dS)zSet `self.parser` by name.N)rÚget_parser_classr)rrÚ parser_classrrrr=s  zReader.set_parsercCs2||_|js ||_||_|j ¡|_| ¡|jSr )rrÚsettingsÚreadrÚparseÚdocument)rrrrrrrrBs z Reader.readcCs.| ¡|_}|j |j|¡d|_|_dS)z(Parse `self.input` into a document tree.N)Ú new_documentrrrrÚcurrent_sourceÚ current_line©rrrrrrKsz Reader.parsecCst |jj|j¡}|S)z8Create and return a new empty document tree (root node).)rr rÚ source_pathrr#rrrr QszReader.new_document)NN) Ú__name__Ú __module__Ú __qualname__Ú__doc__Úcomponent_typeÚconfig_sectionr rrrrr rrrrrs   rc@seZdZdZdd„ZdS)ÚReReaderz• A reader which rereads an existing document tree (e.g. a deserializer). Often used in conjunction with `writers.UnfilteredWriter`. cCs t |¡Sr )rr rrrrr `s zReReader.get_transformsN)r%r&r'r(r rrrrr+Ws r+cCsL| ¡}|tvr t|}z td|ƒ}W|jSty%t|ƒ}Y|jSw)z6Return the Reader class from the `reader_name` module.zdocutils.readers.)ÚlowerÚ_reader_aliasesrÚ ImportErrorr)Ú reader_nameÚmodulerrrÚget_reader_classhs þ þr1)r(Ú __docformat__ÚsysÚ importlibrÚdocutilsrrrÚdocutils.transformsrrr+r-r1rrrrÚs  E