From 8b6ef5579f2b2f80a9159258b8bc479381af8ad9 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 9 Jun 2018 16:27:46 +1000 Subject: [PATCH] remove comments when stripping gets rid of unwanted metadata from ms word pastes --- anki/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/anki/utils.py b/anki/utils.py index 2dcb8f4aa..e91678563 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -125,6 +125,7 @@ def fmtFloat(float_value, point=1): # HTML ############################################################################## +reComment = re.compile("(?s)") reStyle = re.compile("(?si).*?") reScript = re.compile("(?si).*?") reTag = re.compile("(?s)<.*?>") @@ -132,6 +133,7 @@ reEnts = re.compile("&#?\w+;") reMedia = re.compile("(?i)]+src=[\"']?([^\"'>]+)[\"']?[^>]*>") def stripHTML(s): + s = reComment.sub("", s) s = reStyle.sub("", s) s = reScript.sub("", s) s = reTag.sub("", s)