ó
v¢oQc           @   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	 e j
 d k  rx d d l m Z n  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 6Z d „  Z d S(   s0   
This package contains Docutils Writer modules.
t   reStructuredTextiÿÿÿÿN(   t	   languagest	   Component(   t	   universali   i   (   t
   __import__t   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(    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyR   $   s    c         C   s   i  |  _  d  S(   N(   t   parts(   R   (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyt   __init__8   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   (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyR   A   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   (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyR   T   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   (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyt   assemble_partsb   s    N(   t   __name__t
   __module__t   __doc__t   component_typet   config_sectionR   t   NoneR   R   R   R   R   R   R   R    (    (    (    s=   /usr/lib/python2.7/dist-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   (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyR   s   s    (   R!   R"   R#   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyR'   i   s   t	   html4css1t   htmlt   latex2et   latext	   pseudoxmlt   pprintt   pformatt   rlpdft   pdft   docutils_xmlt   xmlt   s5_htmlt   s5c         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_aliasesR   t   globalst   localst   ImportErrorR   (   t   writer_namet   module(    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyt   get_writer_classƒ   s    ""(   i   i   (   R#   t   __docformat__t   os.patht   ost   sysR   R   R   t   docutils.transformsR   t   version_infot   docutils._compatR   R   R'   R7   R=   (    (    (    s=   /usr/lib/python2.7/dist-packages/docutils/writers/__init__.pyt   <module>   s&   T
