�
K�gp� � � � d Z ddlmZ ddlmZ ddlmZmZmZm Z ddl
Z
ddlmc m
Z ddlmZ erddlmZ dXd�ZdZ dZ dZ dZ dZ dZ dZ dZ dZ dZ dZ dZ dZ edz Z dZ! e Z" e!Z# dZ$ d Z% d!Z& d"Z' d#Z( d$Z) dYd'�Z* G d(� d)e � � Z+ G d*� d+� � Z, G d,� d-e,� � Z- G d.� d/e,� � Z. G d0� d1e-� � Z/ G d2� d3e-� � Z0 G d4� d5e,� � Z1 G d6� d7e-� � Z2 G d8� d9e1� � Z3 G d:� d;e2� � Z4 G d<� d=e-� � Z5 G d>� d?e1� � Z6 G d@� dAe2� � Z7 G dB� dCe-� � Z8 G dD� dEe-� � Z9 G dF� dGe9� � Z: G dH� dIe-� � Z; G dJ� dKe;� � Z< G dL� dMe;� � Z= G dN� dOe=� � Z> G dP� dQe=� � Z? G dR� dSe?� � Z@ G dT� dUe-� � ZA G dV� dWe-� � ZBdS )ZaB
In version 3.0, a new, more flexible inline processor was added, [`markdown.inlinepatterns.InlineProcessor`][]. The
original inline patterns, which inherit from [`markdown.inlinepatterns.Pattern`][] or one of its children are still
supported, though users are encouraged to migrate.
The new `InlineProcessor` provides two major enhancements to `Patterns`:
1. Inline Processors no longer need to match the entire block, so regular expressions no longer need to start with
`r'^(.*?)'` and end with `r'(.*?)%'`. This runs faster. The returned [`Match`][re.Match] object will only contain
what is explicitly matched in the pattern, and extension pattern groups now start with `m.group(1)`.
2. The `handleMatch` method now takes an additional input called `data`, which is the entire block under analysis,
not just what is matched with the specified pattern. The method now returns the element *and* the indexes relative
to `data` that the return element is replacing (usually `m.start(0)` and `m.end(0)`). If the boundaries are
returned as `None`, it is assumed that the match did not take place, and nothing will be altered in `data`.
This allows handling of more complex constructs than regular expressions can handle, e.g., matching nested
brackets, and explicit control of the span "consumed" by the processor.
� )�annotations� )�util)�
TYPE_CHECKING�Any�
Collection�
NamedTupleN)�entities)�Markdown�mdr �kwargsr �return�util.Registry[InlineProcessor]c �P � t j � � }|� t t � � dd� � |� t t | � � dd� � |� t t | � � dd� � |� t t | � � dd� � |� t t | � � d d
� � |� t t | � � dd� � |� t t | � � d
d� � |� t! t | � � dd� � |� t# t$ | � � dd� � |� t'