mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Merge pull request #143 from goapunk/bs4-warning-filename
Suppress the BeautifulSoup filename warning
This commit is contained in:
commit
85588e9206
1 changed files with 7 additions and 2 deletions
|
@ -6,6 +6,7 @@ import os
|
|||
import urllib.request, urllib.error, urllib.parse
|
||||
import ctypes
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import warnings
|
||||
|
||||
from anki.lang import _
|
||||
from aqt.qt import *
|
||||
|
@ -641,6 +642,8 @@ class Editor(object):
|
|||
html = form.textEdit.toPlainText()
|
||||
# filter html through beautifulsoup so we can strip out things like a
|
||||
# leading </div>
|
||||
with warnings.catch_warnings() as w:
|
||||
warnings.simplefilter('ignore', UserWarning)
|
||||
html = str(BeautifulSoup(html, "html.parser"))
|
||||
self.note.fields[self.currentField] = html
|
||||
self.loadNote()
|
||||
|
@ -871,6 +874,8 @@ to a cloze type first, via Edit>Change Note Type."""))
|
|||
######################################################################
|
||||
|
||||
def _filterHTML(self, html, localize=False):
|
||||
with warnings.catch_warnings() as w:
|
||||
warnings.simplefilter('ignore', UserWarning)
|
||||
doc = BeautifulSoup(html, "html.parser")
|
||||
# remove implicit regular font style from outermost element
|
||||
if doc.span:
|
||||
|
|
Loading…
Reference in a new issue