Merge branch 'main' into ignore-does-not-exist
This commit is contained in:
commit
b3603bc3f5
351 changed files with 44133 additions and 8331 deletions
|
@ -106,7 +106,7 @@ def find_authors_by_name(name_string, description=False):
|
|||
|
||||
if titles:
|
||||
# some of the "titles" in ISNI are a little ...iffy
|
||||
# '@' is used by ISNI/OCLC to index the starting point ignoring stop words
|
||||
# @ is used by ISNI/OCLC to index the starting point ignoring stop words
|
||||
# (e.g. "The @Government of no one")
|
||||
title_elements = [
|
||||
e
|
||||
|
|
|
@ -4,7 +4,7 @@ DOMAIN = r"[\w_\-\.]+\.[a-z\-]{2,}"
|
|||
LOCALNAME = r"@?[a-zA-Z_\-\.0-9]+"
|
||||
STRICT_LOCALNAME = r"@[a-zA-Z_\-\.0-9]+"
|
||||
USERNAME = rf"{LOCALNAME}(@{DOMAIN})?"
|
||||
STRICT_USERNAME = rf"\B{STRICT_LOCALNAME}(@{DOMAIN})?\b"
|
||||
STRICT_USERNAME = rf"(\B{STRICT_LOCALNAME}(@{DOMAIN})?\b)"
|
||||
FULL_USERNAME = rf"{LOCALNAME}@{DOMAIN}\b"
|
||||
SLUG = r"/s/(?P<slug>[-_a-z0-9]*)"
|
||||
# should match (BookWyrm/1.0.0; or (BookWyrm/99.1.2;
|
||||
|
|
26
bookwyrm/utils/sanitizer.py
Normal file
26
bookwyrm/utils/sanitizer.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""Clean user-provided text"""
|
||||
import bleach
|
||||
|
||||
|
||||
def clean(input_text):
|
||||
"""Run through "bleach" """
|
||||
return bleach.clean(
|
||||
input_text,
|
||||
tags=[
|
||||
"p",
|
||||
"blockquote",
|
||||
"br",
|
||||
"b",
|
||||
"i",
|
||||
"strong",
|
||||
"em",
|
||||
"pre",
|
||||
"a",
|
||||
"span",
|
||||
"ul",
|
||||
"ol",
|
||||
"li",
|
||||
],
|
||||
attributes=["href", "rel", "src", "alt"],
|
||||
strip=True,
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue