ó
¡V]c           @   sé   d  Z  d Z d d l Z d d l Z d d l Z d d l m Z m Z d d l m	 Z	 d e f d „  ƒ  YZ
 d e
 f d	 „  ƒ  YZ i d
 d 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d
 d 6d d 6Z d „  Z d S(   s0   
This package contains Docutils Writer modules.
t   reStructuredTextiÿÿÿÿN(   t	   languagest	   Component(   t	   universalt   Writerc           B   s_   e  Z d  Z d Z d Z d „  Z d Z d Z d Z	 d Z
 d „  Z d „  Z d „  Z d „  Z RS(	   s  
    Abstract base class for docutils Writers.

    Each writer module or package must export a subclass also called 'Writer'.
    Each writer must support all standard node types listed in
    `docutils.nodes.node_class_names`.

    The `write()` method is the main entry point.
    t   writert   writersc         C   s#   t  j |  ƒ t j t j t j g S(   N(   R   t   get_transformsR   t   Messagest   FilterMessagest   StripClassesAndElements(   t   self(    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyR   "   s    c         C   s   i  |  _  d  S(   N(   t   parts(   R   (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyt   __init__6   s    	c         C   sS   | |  _  t j | j j | j ƒ |  _ | |  _ |  j ƒ  |  j j	 |  j
 ƒ } | S(   s/  
        Process a document into its final form.

        Translate `document` (a Docutils document tree) into the Writer's
        native format, and write it out to its `destination` (a
        `docutils.io.Output` subclass object).

        Normally not overridden or extended in subclasses.
        (   t   documentR   t   get_languaget   settingst   language_codet   reportert   languaget   destinationt	   translatet   writet   output(   R   R   R   R   (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyR   ?   s    
			
c         C   s   t  d ƒ ‚ d S(   s  
        Do final translation of `self.document` into `self.output`.  Called
        from `write`.  Override in subclasses.

        Usually done with a `docutils.nodes.NodeVisitor` subclass, in
        combination with a call to `docutils.nodes.Node.walk()` or
        `docutils.nodes.Node.walkabout()`.  The ``NodeVisitor`` subclass must
        support all standard elements (listed in
        `docutils.nodes.node_class_names`) and possibly non-standard elements
        used by the current Reader as well.
        s"   subclass must override this methodN(   t   NotImplementedError(   R   (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyR   R   s    c         C   s:   |  j  |  j d <|  j j j |  j d <t j |  j d <d S(   s<   Assemble the `self.parts` dictionary.  Extend in subclasses.t   wholet   encodingt   versionN(   R   R   R   R   t   output_encodingt   docutilst   __version__(   R   (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyt   assemble_parts`   s    N(   t   __name__t
   __module__t   __doc__t   component_typet   config_sectionR   t   NoneR   R   R   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyR      s   
					t   UnfilteredWriterc           B   s   e  Z d  Z d „  Z RS(   sÓ   
    A writer that passes the document tree on unchanged (e.g. a
    serializer.)

    Documents written by UnfilteredWriters are typically reused at a
    later date using a subclass of `readers.ReReader`.
    c         C   s   t  j |  ƒ S(   N(   R   R   (   R   (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyR   q   s    (   R    R!   R"   R   (    (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyR&   g   s   t	   html4css1t   htmlt   html4t   html5_polyglott   html5t   latex2et   latext	   pseudoxmlt   pprintt   pformatt   rlpdft   pdft   s5_htmlt   s5t   xetext   xelatext   xhtmlt   xhtml10t   docutils_xmlt   xmlc         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 Writer class from the `writer_name` module.t   leveli   i    (   t   lowert   _writer_aliasest
   __import__t   globalst   localst   ImportErrorR   (   t   writer_namet   module(    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyt   get_writer_class†   s    ""(   R"   t   __docformat__t   os.patht   ost   sysR   R   R   t   docutils.transformsR   R   R&   R=   RD   (    (    (    s8   lib/python2.7/site-packages/docutils/writers/__init__.pyt   <module>   s,   T
