diff options
author | gbrandl <devnull@localhost> | 2008-08-15 20:29:16 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2008-08-15 20:29:16 +0200 |
commit | a9c958a248d8fb17fab93d1ba8e49b446ff717ea (patch) | |
tree | e611deb135bfb2aaa66dd29f7924bbe11249ceb4 /pygments/formatters/html.py | |
parent | 53ca5adfcf36eae5bf54a479de76cff5a32d687a (diff) | |
download | pygments-a9c958a248d8fb17fab93d1ba8e49b446ff717ea.tar.gz |
Add "prestyles" to HTML formatter. #310.
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r-- | pygments/formatters/html.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 351d395e..5b53f1b1 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -204,6 +204,10 @@ class HtmlFormatter(Formatter): `cssstyles` Inline CSS styles for the wrapping ``<div>`` tag (default: ``''``). + `prestyles` + Inline CSS styles for the ``<pre>`` tag (default: ``''``). *New in + Pygments 0.11.* + `cssfile` If the `full` option is true and this option is given, it must be the name of an external file. If the filename does not include an absolute @@ -320,6 +324,7 @@ class HtmlFormatter(Formatter): self.classprefix = options.get('classprefix', '') self.cssclass = options.get('cssclass', 'highlight') self.cssstyles = options.get('cssstyles', '') + self.prestyles = options.get('prestyles', '') self.cssfile = options.get('cssfile', '') linenos = options.get('linenos', False) if linenos == 'inline': @@ -512,7 +517,8 @@ class HtmlFormatter(Formatter): yield 0, '</div>\n' def _wrap_pre(self, inner): - yield 0, '<pre>' + yield 0, ('<pre' + + (self.prestyles and ' style="%s"' % self.prestyles) + '>') for tup in inner: yield tup yield 0, '</pre>' |