diff options
author | gbrandl <devnull@localhost> | 2007-07-22 20:46:30 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2007-07-22 20:46:30 +0200 |
commit | 63e396142e12ab8fa5f87ae6cd9497aeff0852a7 (patch) | |
tree | 9a976fb5908e9162329b3c6070bfefe1a82ba724 | |
parent | 9a6d5c7859f76f54de13351cba15d0a9006def9a (diff) | |
download | pygments-63e396142e12ab8fa5f87ae6cd9497aeff0852a7.tar.gz |
[svn] Give the linenos table a CSS class to be able to format it differently
from other tables.
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | pygments/formatters/html.py | 7 |
2 files changed, 8 insertions, 1 deletions
@@ -12,6 +12,8 @@ Version 0.9 - Added the ``lineanchors`` option to the HTML formatter, thanks to Ian Charnas for the idea. +- Give the line numbers table a CSS class in the HTML formatter. + - Added 256-color terminal formatter. - Added ActionScript lexer. diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 31135428..484a00ad 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -199,6 +199,10 @@ class HtmlFormatter(Formatter): If you set this option, the default selector for `get_style_defs()` will be this class. + *New in Pygments 0.9:* If you select the ``'table'`` line numbers, the + wrapping table will have a CSS class of this string plus ``'table'``, + the default is accordingly ``'highlighttable'``. + `cssstyles` Inline CSS styles for the wrapping ``<div>`` tag (default: ``''``). @@ -461,7 +465,8 @@ class HtmlFormatter(Formatter): ls = '\n'.join([(i%st == 0 and ('%*d' % (mw, i)) or '') for i in range(fl, fl + lncount)]) - yield 0, ('<table><tr><td class="linenos"><pre>' + + yield 0, ('<table class="%stable">' % self.cssclass + + '<tr><td class="linenos"><pre>' + ls + '</pre></td><td class="code">') yield 0, dummyoutfile.getvalue() yield 0, '</td></tr></table>' |