B 0` @s`dZdZddlZddlmZmZmZddlmZGdddeZ Gdd d e Z iZ d d Z dS) z0 This package contains Docutils Reader modules. ZreStructuredTextN)utilsparsers Component) universalc@sJeZdZdZdZdZddZdddZd d Zd d Z d dZ ddZ 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. readerZreaderscCst|tjtjtjgS)N)rget_transformsrZ DecorationsZExposeInternalsZ StripComments)selfr t/private/var/folders/sf/wxz_36012wxg_prv29r6623x5vlqx8/T/pip-target-tft40_m7/lib/python/docutils/readers/__init__.pyr szReader.get_transformsNcCs,||_|dkr|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_parsersourceinput)r r parser_namer r r __init__&s   zReader.__init__cCst|}||_dS)zSet `self.parser` by name.N)rZget_parser_classr )r rZ parser_classr r r r <s zReader.set_parsercCs2||_|js||_||_|j|_||jS)N)rr settingsreadrparsedocument)r rr rr r r rAs z Reader.readcCs.||_}|j|j|d|_|_dS)z(Parse `self.input` into a document tree.N) new_documentrr rrZcurrent_source current_line)r rr r r rJsz Reader.parsecCst|jj|j}|S)z8Create and return a new empty document tree (root node).)rrr source_pathr)r rr r r rPszReader.new_document)NN) __name__ __module__ __qualname____doc__Zcomponent_typeZconfig_sectionrrr rrrr r r r rs   rc@seZdZdZddZdS)ReReaderz A reader which rereads an existing document tree (e.g. a deserializer). Often used in conjunction with `writers.UnfilteredWriter`. cCs t|S)N)rr)r r r r r_szReReader.get_transformsN)rrrrrr r r r rVsrc Cs`|}|tkrt|}yt|ttdd}Wn(tk rXt|ttdd}YnX|jS)z6Return the Reader class from the `reader_name` module.)levelr)lower_reader_aliases __import__globalslocals ImportErrorr)Z reader_namemoduler r r get_reader_classgsr') rZ __docformat__sysZdocutilsrrrZdocutils.transformsrrrr!r'r r r r s E