o
    !5p`Š  ã                   @   sè   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„ de	ƒZG d	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&d'„ ZdS )(z0
This package contains Docutils Writer modules.
ÚreStructuredTexté    N)Úimport_module)Ú	languagesÚ	Component)Ú	universalc                   @   sX   e Zd ZdZdZdZdd„ ZdZ	 dZ	 dZ		 dZ
	 dd„ Zd	d
„ Zdd„ Zd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                 C   s   t  | ¡tjtjtjg S ©N)r   Úget_transformsr   ÚMessagesÚFilterMessagesÚStripClassesAndElements©Úself© r   ú;/usr/lib/python3/dist-packages/docutils/writers/__init__.pyr   "   s
   ýzWriter.get_transformsNc                 C   s
   i | _ d S r
   )Úpartsr   r   r   r   Ú__init__6   s   zWriter.__init__c                 C   s:   || _ t |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   r   r   r   r   ?   s   
þzWriter.writec                 C   s   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   r   r   r   r   R   s   zWriter.translatec                 C   s,   | 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   r   r   r   Úassemble_parts`   s   zWriter.assemble_parts)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úcomponent_typeÚconfig_sectionr   r   r   r   r   r   r   r   r&   r   r   r   r   r      s"    
	r   c                   @   s   e Zd ZdZd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                 C   s
   t  | ¡S r
   )r   r   r   r   r   r   r   q   s   
zUnfilteredWriter.get_transformsN)r'   r(   r)   r*   r   r   r   r   r   r-   g   s    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                 C   st   |   ¡ } | tv rt|  } z
td|  ƒ}W |jS  ty9   z	t| ƒ}W Y |jS  ty8 } ztd|  ƒ‚d}~ww w )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Úerrr   r   r   Úget_writer_class�   s   ûþ€ÿýrP   )r*   Ú__docformat__Úos.pathÚosÚsysÚ	importlibr   r$   r   r   Údocutils.transformsr   r   r-   rK   rP   r   r   r   r   Ú<module>   sb   Tÿþýüûúùø	÷
öõôóòñðïí