o
    N=&by                     @   sF   d Z ddlmZmZ 			dddZ			dd	d
Z		dddZdS )a1  
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.
    )coreioNunicodeT   c                 C   s$   |||d}t j| ||d|d}|S )a  
    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>").
    )input_encodingZdoctitle_xforminitial_header_levelhtml)sourcesource_pathdestination_pathwriter_namesettings_overrides)r   Zpublish_parts)input_stringr
   r   r   doctitler   	overridesparts r   5usr/lib/python3.10/site-packages/docutils/examples.py
html_parts   s   r   c           	      C   s2   t | |||||d}|d }|dkr||}|S )aE  
    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   	html_bodyr   )r   encode)	r   r
   r   r   Zoutput_encodingr   r   r   fragmentr   r   r   r   5   s   
r   c                 C   s   |r|  }ni }||d< tjdi 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 )zx
    Return the document tree and publisher, for exploring Docutils internals.

    Parameters: see `html_parts()`.
    r   Zsource_classr	   r
   Zdestination_classZdestinationNr   readerZreader_nameZ
standaloneparserZparser_nameZrestructuredtextwriterr   nullsettingsZsettings_specr   Zconfig_sectionZenable_exit_statusr   )copyr   Zpublish_programmaticallyr   ZStringInputZ
NullOutputr   Zdocument)r   r
   r   r   r   r   outputZpubr   r   r   	internalsM   sP   

		
r   )NNr   Tr   )NNr   r   Tr   )NNr   N)__doc__docutilsr   r   r   r   r   r   r   r   r   <module>   s   	
$
