Skip to content

Commit 5a2e003

Browse files
committed
Remove dead code
1 parent c0f8302 commit 5a2e003

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

markdown_it/common/normalize_url.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,15 @@
1-
import html
21
import re
32
from typing import Callable, Optional
43
from urllib.parse import urlparse, urlunparse, quote, unquote # noqa: F401
54

65
import mdurl
76

8-
from .utils import ESCAPABLE
97
from .. import _punycode
108

119

12-
# ################# Copied from Commonmark.py #################
13-
14-
ENTITY = "&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});"
15-
reBackslashOrAmp = re.compile(r"[\\&]")
16-
reEntityOrEscapedChar = re.compile(
17-
"\\\\" + "[" + ESCAPABLE + "]|" + ENTITY, re.IGNORECASE
18-
)
19-
20-
21-
def unescape_char(s: str) -> str:
22-
if s[0] == "\\":
23-
return s[1]
24-
else:
25-
return html.unescape(s)
26-
27-
28-
def unescape_string(s: str) -> str:
29-
"""Replace entities and backslash escapes with literal characters."""
30-
if re.search(reBackslashOrAmp, s):
31-
return re.sub(reEntityOrEscapedChar, lambda m: unescape_char(m.group()), s)
32-
else:
33-
return s
34-
35-
36-
def normalize_uri(uri: str) -> str:
37-
return quote(uri, safe="/@:+?=&()%#*,")
38-
39-
40-
##################
41-
42-
4310
RECODE_HOSTNAME_FOR = ("http:", "https:", "mailto:")
4411

4512

46-
def unescape_normalize_uri(x: str) -> str:
47-
return normalize_uri(unescape_string(x))
48-
49-
5013
def normalizeLink(url: str) -> str:
5114
"""Normalize destination URLs in links
5215
@@ -73,10 +36,6 @@ def normalizeLink(url: str) -> str:
7336
return mdurl.encode(mdurl.format(parsed))
7437

7538

76-
def unescape_unquote(x: str) -> str:
77-
return unquote(unescape_string(x))
78-
79-
8039
def normalizeLinkText(url: str) -> str:
8140
"""Normalize autolink content
8241

markdown_it/common/utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
from .entities import entities
88

9-
# from .normalize_url import unescape_string
10-
119

1210
def charCodeAt(src: str, pos: int) -> Any:
1311
"""
@@ -158,15 +156,6 @@ def replacer_func(match):
158156
return UNESCAPE_ALL_RE.sub(replacer_func, string)
159157

160158

161-
ESCAPABLE = r"""\\!"#$%&'()*+,./:;<=>?@\[\]^`{}|_~-"""
162-
ESCAPE_CHAR = re.compile(r"\\([" + ESCAPABLE + r"])")
163-
164-
165-
def stripEscape(string: str) -> str:
166-
"""Strip escape \\ characters"""
167-
return ESCAPE_CHAR.sub(r"\1", string)
168-
169-
170159
# //////////////////////////////////////////////////////////////////////////////
171160

172161
# TODO This section changed quite a lot, should re-check

0 commit comments

Comments
 (0)