diff options
author | eivanov89 <[email protected]> | 2025-08-29 10:12:02 +0300 |
---|---|---|
committer | eivanov89 <[email protected]> | 2025-08-29 10:27:27 +0300 |
commit | 140ced4d34c422c9f3cbe096f8dd35243b67d6e4 (patch) | |
tree | b7373341f64151c0ab9839ee692dc919366590d5 /contrib/python/markdown-it-py/markdown_it/common/html_re.py | |
parent | 136471c8b2f3ab8cd7993200c0de0456b7018118 (diff) |
Add python/textual to YDB
commit_hash:eda16a869229724fec5479fa27fa5cdbccbe0395
Diffstat (limited to 'contrib/python/markdown-it-py/markdown_it/common/html_re.py')
-rw-r--r-- | contrib/python/markdown-it-py/markdown_it/common/html_re.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/contrib/python/markdown-it-py/markdown_it/common/html_re.py b/contrib/python/markdown-it-py/markdown_it/common/html_re.py new file mode 100644 index 00000000000..ab822c5fc48 --- /dev/null +++ b/contrib/python/markdown-it-py/markdown_it/common/html_re.py @@ -0,0 +1,39 @@ +"""Regexps to match html elements""" + +import re + +attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*" + +unquoted = "[^\"'=<>`\\x00-\\x20]+" +single_quoted = "'[^']*'" +double_quoted = '"[^"]*"' + +attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")" + +attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)" + +open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>" + +close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>" +comment = "<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->" +processing = "<[?][\\s\\S]*?[?]>" +declaration = "<![A-Za-z][^>]*>" +cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>" + +HTML_TAG_RE = re.compile( + "^(?:" + + open_tag + + "|" + + close_tag + + "|" + + comment + + "|" + + processing + + "|" + + declaration + + "|" + + cdata + + ")" +) +HTML_OPEN_CLOSE_TAG_STR = "^(?:" + open_tag + "|" + close_tag + ")" +HTML_OPEN_CLOSE_TAG_RE = re.compile(HTML_OPEN_CLOSE_TAG_STR) |