| 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/docutils/parsers/rst/__pycache__/ |
Upload File : |
a
OԼa�= � @ s� d Z dZddlZddlZddlmZmZ ddlmZm Z m
Z
ddlmZ G dd� dej
j�ZG d d
� d
e�ZG dd� de�Zd
d� ZdS )a
This is ``docutils.parsers.rst`` package. It exports a single class, `Parser`,
the reStructuredText parser.
Usage
=====
1. Create a parser::
parser = docutils.parsers.rst.Parser()
Several optional arguments may be passed to modify the parser's behavior.
Please see `Customizing the Parser`_ below for details.
2. Gather input (a multi-line string), by reading a file or the standard
input::
input = sys.stdin.read()
3. Create a new empty `docutils.nodes.document` tree::
document = docutils.utils.new_document(source, settings)
See `docutils.utils.new_document()` for parameter details.
4. Run the parser, populating the document tree::
parser.parse(input, document)
Parser Overview
===============
The reStructuredText parser is implemented as a state machine, examining its
input one line at a time. To understand how the parser works, please first
become familiar with the `docutils.statemachine` module, then see the
`states` module.
Customizing the Parser
----------------------
Anything that isn't already customizable is that way simply because that type
of customizability hasn't been implemented yet. Patches welcome!
When instantiating an object of the `Parser` class, two parameters may be
passed: ``rfc2822`` and ``inliner``. Pass ``rfc2822=True`` to enable an
initial RFC-2822 style header block, parsed as a "field_list" element (with
"class" attribute set to "rfc2822"). Currently this is the only body-level
element which is customizable without subclassing. (Tip: subclass `Parser`
and change its "state_classes" and "initial_state" attributes to refer to new
classes. Contact the author if you need more details.)
The ``inliner`` parameter takes an instance of `states.Inliner` or a subclass.
It handles inline markup recognition. A common extension is the addition of
further implicit hyperlinks, like "RFC 2822". This can be done by subclassing
`states.Inliner`, adding a new method for the implicit markup, and adding a
``(pattern, method)`` pair to the "implicit_dispatch" attribute of the
subclass. See `states.Inliner.implicit_inline()` for details. Explicit
inline markup can be customized in a `states.Inliner` subclass via the
``patterns.initial`` and ``dispatch`` attributes (and new methods as
appropriate).
ZreStructuredText� N)�roles�states)�frontend�nodes� Component)� universalc @ s> e Zd ZdZdZejjjddddgde j
d�fd d
gdde jd
�fddgddd�fddgde j
d�fddgdde jd
�fddgddde jd�fddgde j
d�fdd gd!d"d#�fd$d%gg d&�d'd(d)�fd*d+gd,d-e j
d.�fd/d0gd1d2e jd3�fd4d5gd!d6d#�fd7d8gdd,d6d9�ff
f Zd:Zd;ZdBd<d=�Zd>d?� Zd@dA� ZdS )C�ParserzThe reStructuredText parser.)ZrestructuredtextZrst�restZrestxZrtxtZrstxzreStructuredText Parser OptionsNzARecognize and link to standalone PEP references (like "PEP 258").z--pep-references�
store_true)�action� validatorzHBase URL for PEP references (default "http://www.python.org/dev/peps/").z--pep-base-urlz<URL>zhttp://www.python.org/dev/peps/)�metavar�defaultr z7Template for PEP file part of URL. (default "pep-%04d")z--pep-file-url-templatezpep-%04d)r
r zARecognize and link to standalone RFC references (like "RFC 822").z--rfc-referenceszDBase URL for RFC references (default "http://tools.ietf.org/html/").z--rfc-base-urlzhttp://tools.ietf.org/html/z3Set number of spaces for tab expansion (default 8).z--tab-widthz<width>�int� )r
�typer r z)Remove spaces before footnote references.z--trim-footnote-reference-spacez(Leave spaces before footnote references.z --leave-footnote-reference-space�store_falseZtrim_footnote_reference_space)r �destzqToken name set for parsing code with Pygments: one of "long", "short", or "none" (no parsing). Default is "long".z--syntax-highlight)�longZshortZnoner z<format>)�choicesr r
zhChange straight quotation marks to typographic form: one of "yes", "no", "alt[ernative]" (default "no").z--smart-quotesFz<yes/no/alt>)r r
r z4Characters to use as "smart quotes" for <language>. z--smartquotes-localesz'<language:quotes[,language:quotes,...]>�append)r
r r z�Inline markup recognized at word boundaries only (adjacent to punctuation or whitespace). Force character-level inline markup recognition with "\ " (backslash + space). Default.z--word-level-inline-markupZcharacter_level_inline_markupz�Inline markup recognized anywhere, regardless of surrounding characters. Backslash-escapes must be used to avoid unwanted markup recognition. Useful for East Asian languages. Experimental.z--character-level-inline-markup)r r r zrestructuredtext parser)�parsersc C s$ |rd| _ nd| _ tj| _|| _d S )NZRFC2822BodyZBody)�
initial_stater �
state_classes�inliner)�selfZrfc2822r � r �A/usr/lib/python3.9/site-packages/docutils/parsers/rst/__init__.py�__init__� s
zParser.__init__c C s t �| �tjg S �N)r �get_transformsr ZSmartQuotes�r r r r r � s �zParser.get_transformsc C s� | � ||� | jj�dd� | jj�dd� tj| j| j|jj d�| _
tj
j||jj
dd�}t|�D ]@\}}t|�| jjjkrd| jj�d|d �}| j�|� q�qd| j
j||| jd
� dtjv r�tjd= | �� dS )
z=Parse `inputstring` and populate `document`, a document tree.� tab_widthr Zsyntax_highlightr )r r �debugT)r"