Commits

Anonymous committed 30e75b7

[svn] Fix in the new HTML formatter.

Comments (0)

Files changed (1)

pygments/formatters/html.py

             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
             # 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'