From 6e383b8980b542600fd1a77d3b84a1fa1180b78c Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 28 Apr 2021 09:24:24 +0200 Subject: [PATCH] Don't set a label if there is none --- src/convert/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/convert/__init__.py b/src/convert/__init__.py index baf8051..eb0f21f 100755 --- a/src/convert/__init__.py +++ b/src/convert/__init__.py @@ -138,8 +138,9 @@ class GemParser: # This is a pre start tag if starts_with_pre and self.mstate != StateEnum.PRETEXT: self.mstate = StateEnum.PRETEXT - rstring += self.get_start_tag().format(' aria-label="{}"'.format( - line[4:].rstrip('\n'))) + label: str = line[4:].rstrip('\n').strip() + rstring += self.get_start_tag().format( + ' aria-label="{}"'.format(label) if label else '') return rstring # This is in pre formatted text elif self.mstate == StateEnum.PRETEXT and not starts_with_pre: