HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sphinx/builders/__pycache__/epub3.cpython-310.pyc
o

�$�a�*�@sDdZddlZddlmZddlmZmZmZmZm	Z	m
Z
ddlmZddl
mZddlmZddlmZmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZe�e �Z!Gdd�de�Z"ddd�Z#ddd�Z$ddd�Z%dZ&dZ'Gdd�dej(�Z)deddfdd�Z*ded eddfd!d"�Z+dedee,effd#d$�Z-dS)%z�
    sphinx.builders.epub3
    ~~~~~~~~~~~~~~~~~~~~~

    Build epub3 files.
    Originally derived from epub.py.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�path)�Any�Dict�List�
NamedTuple�Set�Tuple)�package_dir)�Sphinx)�
_epub_base)�ENUM�Config)�__)�logging�xmlname_checker)�copy_asset_file)�format_date)�
make_filenamec@s*eZdZUeed<eed<eeed<dS)�NavPoint�text�refuri�childrenN)�__name__�
__module__�__qualname__�str�__annotations__rr�rr�7/usr/lib/python3/dist-packages/sphinx/builders/epub3.pyrs
r�ltr�rtl)�
horizontal�verticalr"r!zvertical-rlz
horizontal-tb)r"r!z<!DOCTYPE html>zU<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">cs�eZdZdZdZed�ZdZe�	e
dd�ZeZ
eZdZdd
d�Zdef�fdd
�Zdeedd	f�fdd�Zdeeeefdeefdd�Zdeedefdd�Zddd�Z�ZS)�Epub3Builderz�
    Builder that outputs epub3 files.

    It creates the metainfo files content.opf, nav.xhtml, toc.ncx, mimetype,
    and META-INF/container.xml. Afterwards, all necessary files are zipped to
    an epub file.
    �epubzThe ePub file is in %(outdir)s.F�	templates�epub3T�returnNcCs<|��|��|��|��|��|��|��dS)z/Create the metainfo files and finally the epub.N)�get_toc�build_mimetype�build_container�
build_content�build_navigation_doc�	build_toc�
build_epub��selfrrr�
handle_finishLszEpub3Builder.handle_finishcs�|jj}t���}t�|jj�|d<t�|jj�|d<t�	|�|d<t
�	|�|d<t�td��|d<t�|jj�|d<|jj
|d<|S)	zaCreate a dictionary with all metadata for the content.opf
        file properly escaped.
        �description�contributor�page_progression_direction�ibook_scroll_axisz%Y-%m-%dT%H:%M:%SZ�date�version�epub_version)�config�epub_writing_mode�super�content_metadata�html�escape�epub_description�epub_contributor�PAGE_PROGRESSION_DIRECTIONS�get�IBOOK_SCROLL_AXISrr7r8)r0�writing_mode�metadata��	__class__rrr<Vs
zEpub3Builder.content_metadata�docnamescsJt��|�|jj}t�|�|jd<|j|jd<|j|jd<d|jd<dS)N�theme_writing_mode�html_tag�use_meta_charsetT�skip_ua_compatible)	r;�prepare_writingr9r:�THEME_WRITING_MODESrB�
globalcontextrJrK)r0rHrDrFrrrMfszEpub3Builder.prepare_writing�navnodescCs>g}|�tddg��d}|D]�}|dsq|d�d�d}||jvr%q|d|jjkr.qt|d|dg�}|d|krP|��|dj�|�|�|�q|d|dkrj|d7}|dj�|�|�|�q|d|kr�|dt|�kr�|��|dt|�ksx|d}|dj�|�|�|�qt	d	��|djS)
acCreate the toc navigation structure.

        This method is almost same as build_navpoints method in epub.py.
        This is because the logical navigation structure of epub3 is not
        different from one of epub2.

        The difference from build_navpoints method is templates which are used
        when generating navigation documents.
        �rrr�#�level����z+Should never reach here. It might be a bug.)
�appendr�split�
ignored_filesr9�
epub_tocdepth�popr�len�RuntimeError)r0rP�navstackrS�node�file�navpointrrr�
build_navlistos:

�
zEpub3Builder.build_navlist�navlistcCs6i}t�|jj�|d<t�|jd�|d<||d<|S)z_Create a dictionary with all metadata for the nav.xhtml file
        properly escaped.
        �lang�toc�
toc_localerb)r=r>r9�
epub_language�guide_titles)r0rbrErrr�navigation_doc_metadata�s
z$Epub3Builder.navigation_doc_metadatacCs�t�td��|jjdkr%|jj|jj|ddd�}|�|g�}|�	|�n|j
}|�|�}tt
�|jd�|j|�|��d|jvrI|j�d�dSdS)z"Write the metainfo file nav.xhtml.zwriting nav.xhtml file...�defaultF)�prune_toctrees�
includehiddenznav.xhtml_tz	nav.xhtmlN)�logger�inforr9�
epub_tocscope�env�get_and_resolve_doctree�root_doc�get_refnodes�
toc_add_files�refnodesrarr�join�template_dir�outdirrh�filesrV)r0�doctreertrbrrrr,�s �
�
�z!Epub3Builder.build_navigation_doc)r'N)rrr�__doc__�namer�epilog�supported_remote_imagesrrur	rv�DOCTYPE�doctype�HTML_TAGrJrKr1rr<rrrMrrrrarhr,�
__classcell__rrrFrr#:s

"	*
r#�appr'cCs�|jjdkrdS|jjst�td��t��|jj	�s"t�td��|jj
s-t�td��|jjs8t�td��|jjsCt�td��|jj
sNt�td��|jjsYt�td��|jjsdt�td	��|jjsot�td
��|jjs|t�td��dSdS)Nr$zHconf value "epub_language" (or "language") should not be empty for EPUB3z2conf value "epub_uid" should be XML NAME for EPUB3zGconf value "epub_title" (or "html_title") should not be empty for EPUB3z6conf value "epub_author" should not be empty for EPUB3z;conf value "epub_contributor" should not be empty for EPUB3z;conf value "epub_description" should not be empty for EPUB3z9conf value "epub_publisher" should not be empty for EPUB3zIconf value "epub_copyright" (or "copyright")should not be empty for EPUB3z:conf value "epub_identifier" should not be empty for EPUB3z2conf value "version" should not be empty for EPUB3)�builderr{r9rfrl�warningrr�match�epub_uid�
epub_title�epub_authorr@r?�epub_publisher�epub_copyright�epub_identifierr7�r�rrr�validate_config_values�s.�r�r9c	Cspg}|jD]-}t|t�r|�|if�qz
|\}}|�||f�Wqty2t�td�|�Yqw||_dS)z?This converts string styled epub_css_files to tuple styled one.zinvalid css_file: %r, ignoredN)�epub_css_files�
isinstancerrV�	Exceptionrlr�r)r�r9r��entry�filename�attrsrrr�convert_epub_css_files�s

�
r�cCs�|�t�|�ddd�d�|�ddd�|�ddd�|�did�|�d	d
d�d�|�ddd�d�|�d
dd�d�|�ddd�d�|�ddd�d�|�ddd�|�ddd�|�ddd�|�ddd�|�ddd�|�dgd�|�dgd�|�ddd�d�|�dgd�|�d d!d�|�d"d#d�|�d$d%d�|�d&d'd�|�d(d)d�|�d*d+d�|�d,d-d�d�|�d.dd�|�d/dd�|�d0d1dtd1d2��|jd3td4d5�|�d6t�d7d#d#d8�S)9N�
epub_basenamecSs
t|j�S�N)r�projectr/rrr�<lambda>��
zsetup.<locals>.<lambda>r8g@r$�
epub_theme�epub_theme_optionsr�cS�|jSr�)r�r/rrrr���r�cSr�r���authorr/rrrr��r�rfcSs
|jpdS)N�en)�languager/rrrr��r�r�cSr�r�r�r/rrrr��r�r�cSr�r�)�	copyrightr/rrrr��r�r��unknown�epub_schemer�ro�
epub_coverr�
epub_guide�epub_pre_files�epub_post_filesr�cSr�r�)�html_css_files)r9rrrr�r��epub_exclude_filesrY��epub_tocdupTrnri�epub_fix_imagesF�epub_max_image_widthr�epub_show_urls�inline�epub_use_indexcSr�r�)�html_use_indexr/rrrr�
r�r?r@r:r!r"z
config-initedi )�priorityzbuilder-inited�builtin)r7�parallel_read_safe�parallel_write_safe)�add_builderr#�add_config_valuer�connectr�r�r�rrr�setup�sJ

��r�).rzr=�osr�typingrrrrrr�sphinxr	�sphinx.applicationr
�sphinx.buildersr�
sphinx.configrr
�
sphinx.localer�sphinx.utilrr�sphinx.util.fileutilr�sphinx.util.i18nr�sphinx.util.osutilr�	getLoggerrrlrrArCrNr~r��EpubBuilderr#r�r�rr�rrrr�<module>s> 
	����'