add link and logging
This commit is contained in:
@@ -89,6 +89,7 @@ def build_profiles_from_cfg(cfg: Optional[Dict[str, Any]] = None) -> Dict[str, D
|
|||||||
"table": ["summary", "class"],
|
"table": ["summary", "class"],
|
||||||
"th": ["scope", "colspan", "rowspan"],
|
"th": ["scope", "colspan", "rowspan"],
|
||||||
"td": ["colspan", "rowspan"],
|
"td": ["colspan", "rowspan"],
|
||||||
|
"link": ["href", "rel"],
|
||||||
"time": ["datetime"],
|
"time": ["datetime"],
|
||||||
"meta": ["charset", "name", "content"],
|
"meta": ["charset", "name", "content"],
|
||||||
"html": ["lang"],
|
"html": ["lang"],
|
||||||
@@ -129,6 +130,7 @@ def build_profiles_from_cfg(cfg: Optional[Dict[str, Any]] = None) -> Dict[str, D
|
|||||||
"span": ["class", "id", "style"],
|
"span": ["class", "id", "style"],
|
||||||
"pre": ["class"],
|
"pre": ["class"],
|
||||||
"code": ["class"],
|
"code": ["class"],
|
||||||
|
"link" : ["href", "rel"],
|
||||||
"meta": ["charset", "name", "content"],
|
"meta": ["charset", "name", "content"],
|
||||||
"html": ["lang"],
|
"html": ["lang"],
|
||||||
"*": ["class", "id", "style"]
|
"*": ["class", "id", "style"]
|
||||||
|
|||||||
@@ -59,6 +59,19 @@ def sanitize(html: str, mode: str, profiles: dict) -> str:
|
|||||||
pretty_body = BeautifulSoup(cleaned_body_content, "html.parser").prettify()
|
pretty_body = BeautifulSoup(cleaned_body_content, "html.parser").prettify()
|
||||||
pretty_head = BeautifulSoup(cleaned_head_content, "html.parser").prettify()
|
pretty_head = BeautifulSoup(cleaned_head_content, "html.parser").prettify()
|
||||||
|
|
||||||
|
logger.log_debug(
|
||||||
|
# very ugly string concationation for logging
|
||||||
|
"parser args: " + str(
|
||||||
|
"Tags: " + str(config.get("tags")) + "\n" +
|
||||||
|
"Attributes: " + str(config.get("attributes")) + "\n" +
|
||||||
|
"Protocols: " + str(config.get("protocols")) + "\n" +
|
||||||
|
"Strip: " + str(config.get("strip")) + "\n"
|
||||||
|
) +
|
||||||
|
"input html: " + str(html) +
|
||||||
|
"clean head: " + str(pretty_head) +
|
||||||
|
"clean body: " + str(pretty_body)
|
||||||
|
)
|
||||||
|
|
||||||
return f"""
|
return f"""
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|||||||
Reference in New Issue
Block a user