| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/sphinx/__pycache__/ |
Upload File : |
a
�ab; � @ s� d Z ddlZddlmZmZmZmZmZmZ ddl Z
ddlZ
ddl
mZ ddlm
Z
ddlmZ ddlmZ ddlmZ dd lmZ dd
lmZmZ er�ddlmZ G dd
� d
e
jj�ZG dd� de
jjje�Zdeeef d�dd�Z dS )z�
sphinx.parsers
~~~~~~~~~~~~~~
A Base class for additional parsers.
:copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)�
TYPE_CHECKING�Any�Dict�List�Type�Union)�nodes)�states)�
StringList)� Transform)�SmartQuotes)�RemovedInSphinx50Warning)�
append_epilog�prepend_prolog)�Sphinxc @ s2 e Zd ZdZddd�dd�Zedd�dd ��ZdS )
�Parsera�
A base class of source parsers. The additional parsers should inherit this class instead
of ``docutils.parsers.Parser``. Compared with ``docutils.parsers.Parser``, this class
improves accessibility to Sphinx APIs.
The subclasses can access the following objects and functions:
self.app
The application object (:class:`sphinx.application.Sphinx`)
self.config
The config object (:class:`sphinx.config.Config`)
self.env
The environment object (:class:`sphinx.environment.BuildEnvironment`)
self.warn()
Emit a warning. (Same as :meth:`sphinx.application.Sphinx.warn()`)
self.info()
Emit an info message. (Same as :meth:`sphinx.application.Sphinx.info()`)
.. deprecated:: 1.6
``warn()`` and ``info()`` is deprecated. Use :mod:`sphinx.util.logging` instead.
.. deprecated:: 3.0
parser.app is deprecated.
r N��app�returnc C s || _ |j| _|j| _dS )z�set_application will be called from Sphinx to set app and other instance variables
:param sphinx.application.Sphinx app: Sphinx application object
N)�_app�config�env)�selfr � r �2/usr/lib/python3.9/site-packages/sphinx/parsers.py�set_application6 s zParser.set_application�r c C s t jdtdd� | jS )Nzparser.app is deprecated.� )�
stacklevel)�warnings�warnr
r )r r r r r ? s z
Parser.app)�__name__�
__module__�__qualname__�__doc__r �propertyr r r r r r s r c sZ e Zd ZdZeee d�� fdd�Zee e
f ejdd�dd�Z
e
dd �d
d�Z� ZS )� RSTParserzA reST parser for Sphinx.r c s t � �� }|�t� |S )z�
Sphinx's reST parser replaces a transform class for smart-quotes by its own
refs: sphinx.io.SphinxStandaloneReader
)�super�get_transforms�remover )r Z
transforms�� __class__r r r( H s
zRSTParser.get_transformsN)�inputstring�documentr c C s� | � ||� tj| j| j|jjd�| _t|t �rTt
jj||jj
dd�}t||j�}n|}| �|� | jj||| jd� | �� dS )z(Parse text and generate a document tree.)�
state_classes�
initial_state�debugT)� tab_widthZconvert_whitespace)�inlinerN)Zsetup_parser ZRSTStateMachiner. r/ ZreporterZ
debug_flagZstatemachine�
isinstance�str�docutilsZstring2linesZsettingsr1 r
Zcurrent_source�decorate�runr2 Zfinish_parse)r r, r- �linesZ
inputlinesr r r �parseR s �
�
zRSTParser.parse)�contentr c C s t || jj� t|| jj� dS )z'Preprocess reST content before parsing.N)r r Z
rst_prologr Z
rst_epilog)r r: r r r r6 h s zRSTParser.decorate)r! r"