HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/markdown_it/rules_inline/html_inline.py
# Process html tags
from ..common.html_re import HTML_TAG_RE
from .state_inline import StateInline


def isLetter(ch: int):
    lc = ch | 0x20  # to lower case
    # /* a */ and /* z */
    return (lc >= 0x61) and (lc <= 0x7A)


def html_inline(state: StateInline, silent: bool):
    pos = state.pos

    if not state.md.options.get("html", None):
        return False

    # Check start
    maximum = state.posMax
    if state.srcCharCode[pos] != 0x3C or pos + 2 >= maximum:  # /* < */
        return False

    # Quick fail on second char
    ch = state.srcCharCode[pos + 1]
    if (
        ch != 0x21
        and ch != 0x3F  # /* ! */
        and ch != 0x2F  # /* ? */
        and not isLetter(ch)  # /* / */
    ):
        return False

    match = HTML_TAG_RE.search(state.src[pos:])
    if not match:
        return False

    if not silent:
        token = state.push("html_inline", "", 0)
        token.content = state.src[pos : pos + len(match.group(0))]

    state.pos += len(match.group(0))
    return True