diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index 1c25cc42..f485c3fe 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -11,6 +11,16 @@ import six import pelican.settings as pys +def integers(): + """Infinite sequence of integers.""" + i = 1 + while True: + yield str(i) + i = i + 1 + +code_block_id = integers() + + class Pygments(Directive): """ Source code syntax highlighting. """ @@ -61,6 +71,8 @@ class Pygments(Directive): if flag in self.options: self.options[flag] = True + self.options['linespans'] += next(code_block_id) + # noclasses should already default to False, but just in case... formatter = HtmlFormatter(noclasses=False, **self.options) parsed = highlight('\n'.join(self.content), lexer, formatter)