summaryrefslogtreecommitdiff
path: root/pygments/formatters/html.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2008-08-15 20:29:16 +0200
committergbrandl <devnull@localhost>2008-08-15 20:29:16 +0200
commita9c958a248d8fb17fab93d1ba8e49b446ff717ea (patch)
treee611deb135bfb2aaa66dd29f7924bbe11249ceb4 /pygments/formatters/html.py
parent53ca5adfcf36eae5bf54a479de76cff5a32d687a (diff)
downloadpygments-a9c958a248d8fb17fab93d1ba8e49b446ff717ea.tar.gz
Add "prestyles" to HTML formatter. #310.
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r--pygments/formatters/html.py8
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>'