
    N&i                         d Z dZddlZddl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    N)import_module)	languages	Component)	universalc                   P    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d	 Zd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                 r    t          j        |           t          j        t          j        t          j        gz   S N)r   get_transformsr   MessagesFilterMessagesStripClassesAndElementsselfs    f/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/docutils/writers/__init__.pyr   zWriter.get_transforms"   s1    '--$-10 0 	0    Nc                     i | _         d S r   )partsr   s    r   __init__zWriter.__init__6   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    r#   s       r   r"   zWriter.write?   se     !!.+  '!''44r   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.translateR   s     ""FGGGr   c                 ~    | j         | j        d<   | j        j        j        | j        d<   t
          j        | j        d<   dS )z<Assemble the `self.parts` dictionary.  Extend in subclasses.wholeencodingversionN)r#   r   r   r   output_encodingdocutils__version__r   s    r   assemble_partszWriter.assemble_parts`   s9    "k
7!%!7!G
: ( 4
9r   )__name__
__module____qualname____doc__component_typeconfig_sectionr   r   r#   r   r    r   r"   r!   r-    r   r   r	   r	      s          NN0 0 0 HCF4 H;K    &H H H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_transformsq   s     '---r   N)r.   r/   r0   r1   r   r4   r   r   r6   r6   g   s-         . . . . .r   r6   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          v rt          |          } 	 t          d| z             }nE# t          $ r8 	 t          |           }n$# t          $ r}t          d| z            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No writer named "%s".N)lower_writer_aliasesr   ImportErrorr	   )writer_namemoduleerrs      r   get_writer_classr[      s    ##%%Ko%%%k2E2;>?? E E E	E";//FF 	E 	E 	E5CDDD	E FE
 =s3   ? 
B
AB
A;$A66A;;B B)r1   __docformat__os.pathossys	importlibr   r+   r   r   docutils.transformsr   r	   r6   rV   r[   r4   r   r   <module>rb      s  
  #  



 # # # # # #  ) ) ) ) ) ) ) ) ) ) ) ) ) )Q5 Q5 Q5 Q5 Q5Y Q5 Q5 Q5h. . . . .v . . ."k{  	
  I y   ' Y Y  I Y  !" #$ '  *    r   