
    -PhQ                         d Z dZddlmZ ddlZddlmZmZ ddlmZ  G d de          Z	 G d	 d
e	          Z
i ddddddddddddddddddddddddddddddd d!d"d!d#d$d%Zd& ZdS )'z0
This package contains Docutils Writer modules.
reStructuredText    )import_moduleN)	languages	Component)	universalc                   Z     e Zd ZdZdZdZ fdZdZ	 dZ	 dZ		 dZ
	 d Zd Zd Zd	 Z xZS )
Writera  
    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.
    writerwritersc                     t                                                      t          j        t          j        t          j        gz   S N)superget_transformsr   MessagesFilterMessagesStripClassesAndElements)self	__class__s    Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/docutils/writers/__init__.pyr   zWriter.get_transforms!   s9    ww%%''9+=+4+C+4+L+N N 	N    Nc                     i | _         d S r   )partsr   s    r   __init__zWriter.__init__8   s    
	 	r   c                     || _         t          j        |j        j        |j                  | _        || _        |                                  | j        	                    | j
                  S )a/  
        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.
        )documentr   get_languagesettingslanguage_codereporterlanguagedestination	translatewriteoutput)r   r   r"   s      r   r$   zWriter.writeA   sa     !!.+  '%%dk222r   c                      t          d          )a  
        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.
        z"subclass must override this method)NotImplementedErrorr   s    r   r#   zWriter.translateS   s     ""FGGGr   c                     | j         | j        d<   | j        j        j        | j        d<   | j        j        j        | j        d<   t          j        | j        d<   dS )zAssemble the `self.parts` dictionary.  Extend in subclasses.

        See <https://docutils.sourceforge.io/docs/api/publisher.html>.
        wholeencodingerrorsversionN)r%   r   r   r   output_encodingoutput_encoding_error_handlerdocutils__version__r   s    r   assemble_partszWriter.assemble_partsa   sR    
 #k
7!%!7!G
:M"@ 	
8 ( 4
9r   )__name__
__module____qualname____doc__component_typeconfig_sectionr   r   r%   r!   r"   r   r$   r#   r1   __classcell__)r   s   @r   r	   r	      s          NNN N N N N
 HEF
 H=K
  3 3 3$H H H	5 	5 	5 	5 	5 	5 	5r   r	   c                       e Zd ZdZd ZdS )UnfilteredWriterz
    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                 *    t          j        |           S r   )r   r   r   s    r   r   zUnfilteredWriter.get_transformsw   s     '---r   N)r2   r3   r4   r5   r    r   r   r:   r:   m   s-         . . . . .r   r:   html	html4css1html4xhtml10html5html5_polyglotxhtmls5s5_htmllatexlatex2exelatexxetexluatexlualatexodfodf_odtodtooffice
openofficelibreofficepprint	pseudoxmlpformatrlpdfdocutils_xml)pdfxmlc                 &   |                                  }t                              ||          }	 t          d|z             }nH# t          $ r; 	 t          |          }n'# t          $ r}t	          d|  d|           d}~ww xY wY nw xY w|j        S )z6Return the Writer class from the `writer_name` module.zdocutils.writers.zWriter "z" not found. N)lower_writer_aliasesgetr   ImportErrorr	   )writer_namenamemoduleerrs       r   get_writer_classrb      s    DtT**DJ24788 J J J	J"4((FF 	J 	J 	JHHH3HHIII	J FJ
 =s5   A 
B	AB	
B)A>>BB	B	)r5   __docformat__	importlibr   r/   r   r   docutils.transformsr   r	   r:   r[   rb   r<   r   r   <module>rf      s  
  # # # # # # #  ) ) ) ) ) ) ) ) ) ) ) ) ) )X5 X5 X5 X5 X5Y X5 X5 X5v. . . . .v . . ."k{  	
  I y   ' Y Y  I Y  !" #$ '  ,    r   