o
    Ÿªj°  ã                   @  sX   d dl mZ d dlmZ d dlZddlmZ e e¡Z	dddd	d
dœddd„Z
e
ƒ ZdS )é    )Úannotations)ÚCallableNé   )Ú
StateBlock)ú~ú`ÚfenceF)r   é   )ÚmarkersÚ
token_typeÚexact_matchÚdisallow_marker_in_infoÚmin_markersr
   útuple[str, ...]r   Ústrr   Úboolr   r   ÚintÚreturnú,Callable[[StateBlock, int, int, bool], bool]c                   s0   |rdd„ ‰ ndd„ ‰ d‡ ‡‡‡‡fdd„}|S )a  Create a fence parsing rule with configurable options.

    :param markers: Tuple of single characters that can be used as fence markers.
    :param token_type: The token type name to emit (e.g. "fence", "colon_fence").
    :param exact_match: If True, the closing fence must have exactly the same
        number of marker characters as the opening fence (not "at least as many").
        This enables nesting of fences with different marker counts.
    :param disallow_marker_in_info: Tuple of marker characters that are not allowed
        to appear in the info string. The check only applies when the actual opening
        marker is in this tuple (e.g. a tilde fence is unaffected by ``"`"`` being
        listed). Per CommonMark, backtick fences cannot have backticks in the info
        string. Use ``()`` to disable this restriction.
    :param min_markers: Minimum number of marker characters to form a fence.
    :return: A block rule function with signature
        ``(state, startLine, endLine, silent) -> bool``.
    c                 S  s   || kS ©N© ©Úopening_lenÚclosing_lenr   r   úc/var/www/html/fyndo/pharma/fyndo/venv/lib/python3.10/site-packages/markdown_it/rules_block/fence.pyÚ<lambda>(   ó    z!make_fence_rule.<locals>.<lambda>c                 S  s   || kS r   r   r   r   r   r   r   +   r   Ústater   Ú	startLiner   ÚendLineÚsilentr   r   c                   sà  t  d| |||¡ d}| j| | j|  }| j| }|  |¡r!dS |ˆ |kr)dS | j| }|ˆvr4dS |}|  ||¡}|| }	|	ˆk rFdS | j||… }
| j||… }|ˆv r^||v r^dS |rbdS |}	 |d7 }||krnnT| j| | j|   }}| j| }||k rŒ| j| | j	k rŒn6z| j| |kr–W qdW n	 t
y    Y n"w |  |¡r§qd|  ||¡}ˆ |	|| ƒsµqd|  |¡}||k r¿qdd}	 | j| }	||rÌdnd | _|  ˆdd¡}||_|  |d ||	d¡|_|
|_|| jg|_dS )Nzentering fence: %s, %s, %s, %sFTr   r   Úcode)ÚLOGGERÚdebugÚbMarksÚtShiftÚeMarksÚis_code_blockÚsrcÚskipCharsStrÚsCountÚ	blkIndentÚ
IndexErrorÚ
skipSpacesÚlineÚpushÚinfoÚgetLinesÚcontentÚmarkupÚmap)r   r   r   r    ÚhaveEndMarkerÚposÚmaximumÚmarkerÚmemÚlengthr3   ÚparamsÚnextLineÚtoken©Úclosing_matcherr   r
   r   r   r   r   Ú_fence_rule-   st   
ÿ



ÿÿ


z$make_fence_rule.<locals>._fence_ruleN)
r   r   r   r   r   r   r    r   r   r   r   )r
   r   r   r   r   r@   r   r>   r   Úmake_fence_rule   s
   
arA   )r
   r   r   r   r   r   r   r   r   r   r   r   )Ú
__future__r   Úcollections.abcr   ÚloggingÚstate_blockr   Ú	getLoggerÚ__name__r"   rA   r   r   r   r   r   Ú<module>   s   
ú 
