From de625127894bb58727f95917ed51222816523809 Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 25 Jul 2024 16:50:07 +0100 Subject: [PATCH] strip data always in handle_data --- html2text/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html2text/__init__.py b/html2text/__init__.py index 1a3c8e6..cf759d9 100644 --- a/html2text/__init__.py +++ b/html2text/__init__.py @@ -855,13 +855,13 @@ def o( self.outcount += 1 def handle_data(self, data: str, entity_char: bool = False) -> None: + data = data.strip() if not data: # Data may be empty for some HTML entities. For example, # LEFT-TO-RIGHT MARK. return if self.stressed: - data = data.strip() self.stressed = False self.preceding_stressed = True elif self.preceding_stressed: