U
    nuf
                     @   s4   d Z ddlmZmZ ddlmZ G dd deZdS )zWModule that allows latex output notebooks to be conditioned before
they are converted.
    )ListUnicode   )Preprocessorc                   @   sr   e Zd ZdZeddddjddZeddddjddZee dddd	jddZ	ed
ddjddZ
dd ZdS )LatexPreprocessora  Preprocessor for latex destined documents.

    Populates the ``latex`` key in the resources dict,
    adding definitions for pygments highlight styles.

    Sets the authors, date and title of the latex document,
    overriding the values given in the metadata.
    NzDate of the LaTeX documentT)help
allow_none)configzTitle of the LaTeX documentz*Author names to list in the LaTeX document)default_valuer   r   defaultz!Name of the pygments style to use)r   c                 C   s   ddl m} |di  |d d|| jd  |d d| j | jdk	rfdd	 | jD |jd
< | jdk	r|| j|jd< | jdk	r| j|jd< ||fS )aB  Preprocessing to apply on each notebook.

        Parameters
        ----------
        nb : NotebookNode
            Notebook being converted
        resources : dictionary
            Additional resources used in the conversion process.  Allows
            preprocessors to pass variables into the Jinja engine.
        r   )LatexFormatterZlatexZpygments_definitions)styleZpygments_style_nameNc                 S   s   g | ]}d |iqS )name ).0authorr   r   A/tmp/pip-unpacked-wheel-nxpdnluh/nbconvert/preprocessors/latex.py
<listcomp>J   s     z0LatexPreprocessor.preprocess.<locals>.<listcomp>Zauthorsdatetitle)	Zpygments.formattersr   
setdefaultr   Zget_style_defsauthor_namesmetadatar   r   )selfnb	resourcesr   r   r   r   
preprocess5   s     


zLatexPreprocessor.preprocess)__name__
__module____qualname____doc__r   tagr   r   r   r   r   r   r   r   r   r   r      s&   	r   N)r    Z	traitletsr   r   baser   r   r   r   r   r   <module>   s   