summaryrefslogtreecommitdiff
path: root/pygments/formatters/html.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2007-02-01 17:00:01 +0100
committergbrandl <devnull@localhost>2007-02-01 17:00:01 +0100
commit8983594621e29f99631414e430c3d4d1fa344d5a (patch)
treea8e733c970a87e477f05c3d5e45871499e489548 /pygments/formatters/html.py
parent536e7dc0adab42a76dcb48ed07e3c317e4a95e10 (diff)
downloadpygments-8983594621e29f99631414e430c3d4d1fa344d5a.tar.gz
[svn] Fix in the new HTML formatter.
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r--pygments/formatters/html.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 368d65a2..d87349f7 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -389,7 +389,8 @@ class HtmlFormatter(Formatter):
for part in parts[:-1]:
if line:
if lspan != cspan:
- line += '</span>' + cspan + part + (cspan and '</span>') + '\n'
+ line += (lspan and '</span>') + cspan + part + \
+ (cspan and '</span>') + '\n'
else: # both are the same
line += part + (lspan and '</span>') + '\n'
yield 1, line
@@ -399,12 +400,13 @@ class HtmlFormatter(Formatter):
# for the last line
if line:
if lspan != cspan:
- line += '</span>' + cspan + parts[-1]
+ line += (lspan and '</span>') + cspan + parts[-1]
lspan = cspan
else:
line += parts[-1]
else:
line = cspan + parts[-1]
+ lspan = cspan
if line:
yield 1, line + (lspan and '</span>') + '\n'