From e1fa76a498c7ba6bbe89f8b95f492c459413ad91 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 16 Mar 2019 14:09:34 +0100 Subject: Fix codeline span id i is 1 for codelines and 0 for other lines; handle this correctly when outputting from CustomHtmlFormatter.wrap(). --- pastepy/pastepy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pastepy/pastepy.py b/pastepy/pastepy.py index f6b68ef..e57d406 100644 --- a/pastepy/pastepy.py +++ b/pastepy/pastepy.py @@ -26,8 +26,11 @@ class CustomHtmlFormatter(HtmlFormatter): yield 0, '
'
         line = 1
         for i, t in source:
-            yield i, '{}'.format(i, t)
-            line += 1
+            if i == 1:
+                yield i, '{}'.format(line, t)
+                line += 1
+            else:
+                yield i, t
         yield 0, '
' def init_lexers(): -- cgit v1.2.3