ó
¡V]c           @   sƒ   d  Z  d Z d d l Z d d l m Z m Z m Z d d l m Z d e f d „  ƒ  YZ	 d e	 f d	 „  ƒ  YZ
 i  Z d
 „  Z d S(   s0   
This package contains Docutils Reader modules.
t   reStructuredTextiÿÿÿÿN(   t   utilst   parserst	   Component(   t	   universalt   Readerc           B   sV   e  Z d  Z d Z d Z d „  Z d	 d	 d „ Z d „  Z d „  Z	 d „  Z
 d „  Z RS(
   s9  
    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.
    t   readert   readersc         C   s#   t  j |  ƒ t j t j t j g S(   N(   R   t   get_transformsR   t   Decorationst   ExposeInternalst   StripComments(   t   self(    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR       s    c         C   sA   | |  _  | d k r+ | r+ |  j | ƒ n  d |  _ d |  _ d S(   s·   
        Initialize the Reader instance.

        Several instance attributes are defined with dummy initial values.
        Subclasses may use these attributes as they wish.
        N(   t   parsert   Nonet
   set_parsert   sourcet   input(   R   R   t   parser_name(    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyt   __init__&   s    			c         C   s   t  j | ƒ } | ƒ  |  _ d S(   s   Set `self.parser` by name.N(   R   t   get_parser_classR   (   R   R   t   parser_class(    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR   <   s    c         C   sJ   | |  _  |  j s | |  _ n  | |  _ |  j  j ƒ  |  _ |  j ƒ  |  j S(   N(   R   R   t   settingst   readR   t   parset   document(   R   R   R   R   (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR   A   s    			
c         C   s=   |  j  ƒ  |  _ } |  j j |  j | ƒ d | _ | _ d S(   s(   Parse `self.input` into a document tree.N(   t   new_documentR   R   R   R   R   t   current_sourcet   current_line(   R   R   (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR   J   s    c         C   s   t  j |  j j |  j ƒ } | S(   s8   Create and return a new empty document tree (root node).(   R   R   R   t   source_pathR   (   R   R   (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR   P   s    N(   t   __name__t
   __module__t   __doc__t   component_typet   config_sectionR   R   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR      s   
					t   ReReaderc           B   s   e  Z d  Z d „  Z RS(   s•   
    A reader which rereads an existing document tree (e.g. a
    deserializer).

    Often used in conjunction with `writers.UnfilteredWriter`.
    c         C   s   t  j |  ƒ S(   N(   R   R   (   R   (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR   _   s    (   R   R   R    R   (    (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyR#   V   s   c         C   s€   |  j  ƒ  }  |  t k r% t |  }  n  y" t |  t ƒ  t ƒ  d d ƒ} Wn/ t k
 rx t |  t ƒ  t ƒ  d d ƒ} n X| j S(   s6   Return the Reader class from the `reader_name` module.t   leveli   i    (   t   lowert   _reader_aliasest
   __import__t   globalst   localst   ImportErrorR   (   t   reader_namet   module(    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyt   get_reader_classg   s    ""(   R    t   __docformat__t   syst   docutilsR   R   R   t   docutils.transformsR   R   R#   R&   R-   (    (    (    s8   lib/python2.7/site-packages/docutils/readers/__init__.pyt   <module>   s   E