Skip to content

Commit 0adac3d

Browse files
committed
TEST: no markdown
1 parent c28c39e commit 0adac3d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/sotoki/utils/html.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
import re
66
import urllib.parse
7+
import warnings
78

89
import bs4
9-
import mistune
10-
from mistune.plugins import plugin_strikethrough, plugin_table, plugin_footnotes
10+
# import mistune
11+
# from mistune.plugins import plugin_strikethrough, plugin_table, plugin_footnotes
1112
from tld import get_fld
1213
from slugify import slugify
1314

@@ -60,6 +61,9 @@ def is_in_code(elem):
6061

6162
REDACTED_STRING = "[redacted]"
6263

64+
# prevent beautifulsoup warning on comments containing only URLs
65+
warnings.filterwarnings('ignore', category=bs4.MarkupResemblesLocatorWarning)
66+
6367

6468
class Rewriter(GlobalMixin):
6569
redacted_text = "[redacted]"
@@ -94,10 +98,10 @@ def __init__(self):
9498
)
9599

96100
self.redacted_string = bs4.NavigableString(self.redacted_text)
97-
self.markdown = mistune.create_markdown(
98-
escape=False,
99-
plugins=[plugin_strikethrough, plugin_table, plugin_footnotes],
100-
)
101+
# self.markdown = mistune.create_markdown(
102+
# escape=False,
103+
# plugins=[plugin_strikethrough, plugin_table, plugin_footnotes],
104+
# )
101105
if self.conf.censor_words_list:
102106
with open(self.conf.build_dir.joinpath("words.list"), "r") as fh:
103107
# this will actually replace occurences of ~strings matching
@@ -146,7 +150,8 @@ def rewrite(self, content: str, to_root: str = "", unwrap: bool = False):
146150
return ""
147151

148152
try:
149-
soup = bs4.BeautifulSoup(self.markdown(content), "lxml")
153+
# soup = bs4.BeautifulSoup(self.markdown(content), "lxml")
154+
soup = bs4.BeautifulSoup(content, "lxml")
150155
except Exception as exc:
151156
logger.error(f"Unable to init soup or markdown for {content}: {exc}")
152157
return content

0 commit comments

Comments
 (0)