ó
Oc           @   sh   d  Z  d d l m Z m Z d d d e d d  Z d d d d e d d  Z d d d d d  Z d S(	   s1  
This module contains practical examples of Docutils client code.

Importing this module from client code is not recommended; its contents are
subject to change in future Docutils releases.  Instead, it is recommended
that you copy and paste the parts you need into your own code, modifying as
necessary.
i˙˙˙˙(   t   coret   iot   unicodei   c         C   sI   i | d 6| d 6| d 6} t  j d |  d | d | d d d	 |  } | S(
   s  
    Given an input string, returns a dictionary of HTML document parts.

    Dictionary keys are the names of parts, and values are Unicode strings;
    encoding is up to the client.

    Parameters:

    - `input_string`: A multi-line text string; required.
    - `source_path`: Path to the source file or object.  Optional, but useful
      for diagnostic output (system messages).
    - `destination_path`: Path to the file or object which will receive the
      output; optional.  Used for determining relative paths (stylesheets,
      source links, etc.).
    - `input_encoding`: The encoding of `input_string`.  If it is an encoded
      8-bit string, provide the correct encoding.  If it is a Unicode string,
      use "unicode", the default.
    - `doctitle`: Disable the promotion of a lone top-level section title to
      document title (and subsequent section title to document subtitle
      promotion); enabled by default.
    - `initial_header_level`: The initial level for header elements (e.g. 1
      for "<h1>").
    t   input_encodingt   doctitle_xformt   initial_header_levelt   sourcet   source_patht   destination_patht   writer_namet   htmlt   settings_overrides(   R    t   publish_parts(   t   input_stringR   R   R   t   doctitleR   t	   overridest   parts(    (    s5   /usr/lib/python2.7/dist-packages/docutils/examples.pyt
   html_parts   s    

	c   	      C   sY   t  d |  d | d | d | d | d |  } | d } | d k rU | j |  } n  | S(	   sE  
    Given an input string, returns an HTML fragment as a string.

    The return value is the contents of the <body> element.

    Parameters (see `html_parts()` for the remainder):

    - `output_encoding`: The desired encoding of the output.  If a Unicode
      string is desired, use the default value of "unicode" .
    R   R   R   R   R   R   t	   html_bodyR   (   R   t   encode(	   R   R   R   R   t   output_encodingR   R   R   t   fragment(    (    s5   /usr/lib/python2.7/dist-packages/docutils/examples.pyR   4   s    	
c      #   C   sł   | r | j    } n i  } | | d <t j d t j d |  d | d t j d d d | d d d	 d
 d d d d d d d d d d d d d | d d d d  \ } } | j j | f S(   sx   
    Return the document tree and publisher, for exploring Docutils internals.

    Parameters: see `html_parts()`.
    R   t   source_classR   R   t   destination_classt   destinationR   t   readert   reader_namet
   standalonet   parsert   parser_namet   restructuredtextt   writerR	   t   nullt   settingst   settings_specR   t   config_sectiont   enable_exit_statusN(	   t   copyR    t   publish_programmaticallyR   t   StringInputt
   NullOutputt   NoneR   t   document(   R   R   R   R   R   R   t   outputt   pub(    (    s5   /usr/lib/python2.7/dist-packages/docutils/examples.pyt	   internalsK   s    
	N(	   t   __doc__t   docutilsR    R   R)   t   TrueR   R   R-   (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/examples.pyt   <module>   s   !