summaryrefslogtreecommitdiff
path: root/src/pip/_vendor/pygments/formatters/html.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pip/_vendor/pygments/formatters/html.py')
-rw-r--r--src/pip/_vendor/pygments/formatters/html.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pip/_vendor/pygments/formatters/html.py b/src/pip/_vendor/pygments/formatters/html.py
index d5cda4c4b..f22b200c0 100644
--- a/src/pip/_vendor/pygments/formatters/html.py
+++ b/src/pip/_vendor/pygments/formatters/html.py
@@ -878,10 +878,12 @@ class HtmlFormatter(Formatter):
# for all but the last line
for part in parts[:-1]:
if line:
- if lspan != cspan:
+ # Also check for part being non-empty, so we avoid creating
+ # empty <span> tags
+ if lspan != cspan and part:
line.extend(((lspan and '</span>'), cspan, part,
(cspan and '</span>'), lsep))
- else: # both are the same
+ else: # both are the same, or the current part was empty
line.extend((part, (lspan and '</span>'), lsep))
yield 1, ''.join(line)
line = []