관리-도구
편집 파일: roles.cpython-311.pyc
� �d_�#�=� � � d Z dZddlmZ ddlmZ ddlmZ ddl m Z mZ dZ i Z i Z d� Zd � Zd � Zd� Zd� Z G d � d� � Z G d� d� � Z d3d�Zdej ie_ edej � � edej � � edej � � edej � � edej � � edej � � edej � � edej � � d3d�Z! ede!� � d3d�Z" ede"� � d3d�Z#d ej$ ie#_ ed!e#� � d3d"�Z%d#ej$ ie%_ ed$e%� � d3d%�Z& ed&e&� � d3d'�Z' ed(e'� � ed)e'� � ed*e'� � ed+e'� � ed,e'� � ed-e'� � ed.e'� � ed/e'� � ed0e'� � d1� Z(d2� Z)dS )4a� This module defines standard interpreted text role functions, a registry for interpreted text roles, and an API for adding to and retrieving from the registry. See also `Creating reStructuredText Interpreted Text Roles`__. __ https://docutils.sourceforge.io/docs/ref/rst/roles.html The interface for interpreted role functions is as follows:: def role_fn(name, rawtext, text, lineno, inliner, options=None, content=None): code... # Set function attributes for customization: role_fn.options = ... role_fn.content = ... Parameters: - ``name`` is the local name of the interpreted text role, the role name actually used in the document. - ``rawtext`` is a string containing the entire interpreted text construct. Return it as a ``problematic`` node linked to a system message if there is a problem. - ``text`` is the interpreted text content, with backslash escapes converted to nulls (`` ``). - ``lineno`` is the line number where the text block containing the interpreted text begins. - ``inliner`` is the Inliner object that called the role function. It defines the following useful attributes: ``reporter``, ``problematic``, ``memo``, ``parent``, ``document``. - ``options``: A dictionary of directive options for customization, to be interpreted by the role function. Used for additional attributes for the generated elements and other functionality. - ``content``: A list of strings, the directive content for customization ("role" directive). To be interpreted by the role function. Function attributes for customization, interpreted by the "role" directive: - ``options``: A dictionary, mapping known option names to conversion functions such as `int` or `float`. ``None`` or an empty dict implies no options to parse. Several directive option conversion functions are defined in the `directives` module. All role functions implicitly support the "class" option, unless disabled with an explicit ``{'class': None}``. - ``content``: A boolean; true if content is allowed. Client code must handle the case where content is required but not supplied (an empty content list will be supplied). Note that unlike directives, the "arguments" function attribute is not supported for role customization. Directive arguments are handled by the "role" directive itself. Interpreted role functions return a tuple of two values: - A list of nodes which will be inserted into the document tree at the point where the interpreted role was encountered (can be an empty list). - A list of system messages, which will be inserted into the document tree immediately after the end of the current inline block (can also be empty). �reStructuredText� )�nodes)� directives)�en)�Lexer� LexerErrorztitle-referencec �� � | � � � }g }g }|t v rt | |fS | rpd} |j | }nf# t $ r&}|� d|�d|�d�� � Y d}~n;d}~wt $ r$ |� d| �d|j �d�� � Y nw xY wt }|sV t j | }|� d| z � � n*# t $ r |� d | z � � |}Y nw xY w|r?|� d � |� � |�� � } |� | � � |t v r!t | } t || � � | |fS d|fS )a1 Locate and return a role function from its language-dependent name, along with a list of system messages. If the role is not found in the current language, check English. Return a 2-tuple: role function (``None`` if the named role cannot be found) and a list of system messages. Nz3Problem retrieving role entry from language module z: �.zNo role entry for "z " in module "z".z%Using English fallback for role "%s".z#Trying "%s" as canonical role name.� ��line) �lower�_roles�roles�AttributeError�append�KeyError�__name__�DEFAULT_INTERPRETED_ROLE�_fallback_language_module�info�join�_role_registry�register_local_role)� role_name�language_module�lineno�reporter�normname�messages�msg_text� canonicalname�error�message�role_fns �z/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/docutils/parsers/rst/roles.py�roler'