Commits

gbrandl  committed d57b2ed

Add "prestyles" to HTML formatter. #310.

  • Participants
  • Parent commits e628e4a
  • Branches trunk

Comments (0)

Files changed (2)

   and it's documented that tokenization with this lexer may
   raise exceptions.
 
+- New option ``prestyles`` to HTML formatter.
+
 - New option *-g* to pygmentize, to allow lexer guessing based
   on filetext (can be slowish, so file extensions are still checked
   first).

File pygments/formatters/html.py

     `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
         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':
         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>'