U
    [Shh                     @   sZ   d Z dZddlmZ ddlmZ G dd dejZG dd dejZG d	d
 d
ejZ	dS )z
XeLaTeX document tree Writer.

A variant of Docutils' standard 'latex2e' writer producing LaTeX output
suited for processing with the Unicode-aware TeX engines
LuaTeX and XeTeX.
reStructuredText    )frontend)latex2ec                   @   s`   e Zd ZdZdZdZdZdZdZe	j
ejjdde d	ged
dfddgdeifdZdd ZdS )Writerz9A writer for Unicode-aware LaTeX variants (XeTeX, LuaTeX))latextexZxetexZxelatexZluatexZlualatexzxelatex.texz% Linux Libertine (free, wide coverage, not only for Linux)
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono}zxetex writer)Zwriterszlatex writersZfont_encodingzTemplate file. Default: "%s".z
--templatez<file>)defaultmetavarzUCustomization by LaTeX code in the preamble. Default: select "Linux Libertine" fonts.z--latex-preambler   )templateZlatex_preamblec                 C   s&   t j|  | jddi t| _d S )NZfontencoding )r   r   __init__Zsettings_defaultsupdateXeLaTeXTranslatorZtranslator_class)self r   R/root/rtd-docs/venv/lib/python3.8/site-packages/docutils/writers/xetex/__init__.pyr   <   s    zWriter.__init__N)__name__
__module____qualname____doc__	supportedZdefault_templateZdefault_preambleZconfig_sectionZconfig_section_dependenciesr   Zfilter_settings_specr   r   Zsettings_specr   r   r   r   r   r      s&   r   c                   @   s~   e Zd ZdZejj Zedddddddd	d
dddddddd dd e	 D ZdD ]Z
ee
 = qZdd Zdd ZdS )Babelz`Language specifics for XeTeX.

    Use `polyglossia` instead of `babel` and adapt settings.
    ZcopticgermanZogermanZdivehiZlsorbianZ	polygreekZfarsiZancientgreekkoreanZusorbianZserbiancroatianZalbanianthaiZ
vietnamese)copdezde-1901ZdvZdsbz
el-polytonfaZgrckoZhsbzsh-Cyrlzsh-Latnsqsrthvic                 C   s   i | ]\}}|  |qS r   )lower).0kvr   r   r   
<dictcomp>^   s      zBabel.<dictcomp>)
afzde-ATz
de-AT-1901zen-CAzen-GBzen-NZzen-USzfr-CAz
grc-ibycuszsr-Latnc                 C   s:   || _ || _| || _i | _d| _d| _d| _d| _d S )Nz+Language "%s" not supported by Polyglossia.r   )"r*   r*   )	language_codereporterZlanguage_namelanguageotherlanguagesZwarn_msgZquote_indexquotesZliteral_double_quote)r   r+   r,   r   r   r   r   o   s    zBabel.__init__c                 C   s<   dd| j  g}| jr2|ddt| j   d|S )Nz\usepackage{polyglossia}z\setdefaultlanguage{%s}z\setotherlanguages{%s},
)r-   r.   appendjoinsortedkeys)r   setupr   r   r   __call__{   s    zBabel.__call__N)r   r   r   r   r   r   Zlanguage_codescopyr   itemskeyr$   r   r7   r   r   r   r   r   B   s2   r   c                   @   s   e Zd ZdZdd ZdS )r   z
    Generate code for LaTeX using Unicode fonts (XeLaTex or LuaLaTeX).

    See the docstring of docutils.writers._html_base.HTMLTranslator for
    notes on and examples of safe subclassing.
    c                 C   sD   d| _ tj| |t | jdkr0| jdd  nd| j | jd< d S )NTutf8Z	_inputencz\XeTeXinputencoding %s )Zis_xetexr   LaTeXTranslatorr   r   Zlatex_encodingrequirementspop)r   Zdocumentr   r   r   r      s    
zXeLaTeXTranslator.__init__N)r   r   r   r   r   r   r   r   r   r      s   r   N)
r   __docformat__Zdocutilsr   Zdocutils.writersr   r   r   r<   r   r   r   r   r   <module>   s   %B