Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/markdown_it/common/html_re.py: 100%
16 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:15 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:15 +0000
1"""Regexps to match html elements
2"""
4import re
6attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*"
8unquoted = "[^\"'=<>`\\x00-\\x20]+"
9single_quoted = "'[^']*'"
10double_quoted = '"[^"]*"'
12attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")"
14attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)"
16open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>"
18close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>"
19comment = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->"
20processing = "<[?][\\s\\S]*?[?]>"
21declaration = "<![A-Z]+\\s+[^>]*>"
22cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
24HTML_TAG_RE = re.compile(
25 "^(?:"
26 + open_tag
27 + "|"
28 + close_tag
29 + "|"
30 + comment
31 + "|"
32 + processing
33 + "|"
34 + declaration
35 + "|"
36 + cdata
37 + ")"
38)
39HTML_OPEN_CLOSE_TAG_STR = "^(?:" + open_tag + "|" + close_tag + ")"
40HTML_OPEN_CLOSE_TAG_RE = re.compile(HTML_OPEN_CLOSE_TAG_STR)