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"],
|
||||
"th": ["scope", "colspan", "rowspan"],
|
||||
"td": ["colspan", "rowspan"],
|
||||
"link": ["href", "rel"],
|
||||
"time": ["datetime"],
|
||||
"meta": ["charset", "name", "content"],
|
||||
"html": ["lang"],
|
||||
@@ -129,6 +130,7 @@ def build_profiles_from_cfg(cfg: Optional[Dict[str, Any]] = None) -> Dict[str, D
|
||||
"span": ["class", "id", "style"],
|
||||
"pre": ["class"],
|
||||
"code": ["class"],
|
||||
"link" : ["href", "rel"],
|
||||
"meta": ["charset", "name", "content"],
|
||||
"html": ["lang"],
|
||||
"*": ["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_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"""
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
Reference in New Issue
Block a user