From bf7bde611d4456df785768ac3eb6dfae2eb62c2f Mon Sep 17 00:00:00 2001 From: Vitaly Zdanevich Date: Mon, 27 May 2024 01:44:27 +0400 Subject: [PATCH] ...fix previous commit about BeautifulSoup warning about HTML parsing --- geeknote/editor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/geeknote/editor.py b/geeknote/editor.py index 9be7a66..8275c66 100644 --- a/geeknote/editor.py +++ b/geeknote/editor.py @@ -3,6 +3,7 @@ import os import sys import tempfile + from bs4 import BeautifulSoup, NavigableString import threading import hashlib @@ -16,6 +17,11 @@ from .log import logging from xml.sax.saxutils import escape, unescape +import warnings +from bs4.builder import XMLParsedAsHTMLWarning + +warnings.filterwarnings('ignore', category=XMLParsedAsHTMLWarning) + class EditorThread(threading.Thread): def __init__(self, editor): @@ -84,7 +90,7 @@ def ENMLtoText( imageOptions={"saveImages": False}, imageFilename="", ): - soup = BeautifulSoup(contentENML, "xml") + soup = BeautifulSoup(contentENML, "html.parser") if format == "pre": #