diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2019-03-16 14:09:34 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2019-03-16 14:09:34 +0100 |
commit | e1fa76a498c7ba6bbe89f8b95f492c459413ad91 (patch) | |
tree | be921f400a724fb026977894dec643b65869cb08 | |
parent | 7a0cdd41297431fcb515efea98c6ba2bc9a993c8 (diff) |
Fix codeline span id
i is 1 for codelines and 0 for other lines; handle this correctly when
outputting from CustomHtmlFormatter.wrap().
-rw-r--r-- | pastepy/pastepy.py | 7 |
1 files 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, '<pre>' line = 1 for i, t in source: - yield i, '<span id="codeline-{}">{}</span>'.format(i, t) - line += 1 + if i == 1: + yield i, '<span id="codeline-{}">{}</span>'.format(line, t) + line += 1 + else: + yield i, t yield 0, '</pre>' def init_lexers(): |