관리-도구
편집 파일: __init__.cpython-311.pyc
� �N�%��#� � � d Z dZddlZddlZddlmZmZ ddlmZm Z ddl mZ G d� dej j � � Z G d � d e� � Z G d� d� � Zd � 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). �reStructuredText� N)�roles�states)�frontend�nodes)� universalc � � � e Zd ZdZdZ ej j j ddddgde j d�fd d gdde j d �fddgddd�fddgde j d�fddgdde j d �fddgddde j d�fddgde j d�fdd gd!d"d#�fd$d%gg d&�d'd(d)�fd*d+gd,d-e j d.�fd/d0gd1d2e j d3�fd4d5gd!d6d#�fd7d8gdd,d6d9�ff fz Zd:Zd;Zd?d<�Z� fd=�Zd>� Z� xZS )@�ParserzThe reStructuredText parser.)�rst�restructuredtext�rest�restx�rtxt�rstxzreStructuredText Parser OptionsNzARecognize and link to standalone PEP references (like "PEP 258").z--pep-references� store_true)�action� validatorzABase URL for PEP references (default "https://peps.python.org/").z--pep-base-urlz<URL>zhttps://peps.python.org/)�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-referenceszEBase URL for RFC references (default "https://tools.ietf.org/html/").z--rfc-base-urlzhttps://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_false�trim_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)�long�short�noner 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-markup�character_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 �X � |rd| _ nd| _ t j | _ || _ d S )N�RFC2822Body�Body)� initial_stater � state_classes�inliner)�self�rfc2822r( s �}/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/docutils/parsers/rst/__init__.py�__init__zParser.__init__� s3 � �� (�!.�D���!'�D��#�1�������� c �` �� t � � � � � t j gz S �N)�super�get_transformsr �SmartQuotes)r) � __class__s �r+ r1 zParser.get_transforms� s$ �� ��w�w�%�%�'�'�9�+@�*A�A�Ar- c � � | � ||� � | j j � dd� � | j j � dd� � t j | j | j |j j �� � | _ t j � ||j j d�� � }t |� � D ]h\ }}t |� � | j j j k rA| j j � d|d z z � � }| j � |� � n#�i| j � ||| j � � � dt* j v r t* j d= | � � � dS ) z=Parse `inputstring` and populate `document`, a document tree.� tab_widthr �syntax_highlightr )r'