summaryrefslogtreecommitdiff
path: root/pygments/formatters/html.py
diff options
context:
space:
mode:
authorblackbird <devnull@localhost>2006-11-23 22:18:20 +0100
committerblackbird <devnull@localhost>2006-11-23 22:18:20 +0100
commit5b1df1920c3c315f9e873ecf18cceb90452970c4 (patch)
tree118eb855f6c181652d67178880a5bc592e49eb5c /pygments/formatters/html.py
parent5d3c19b60ede893fc231f02063b80d41b0207ac9 (diff)
downloadpygments-5b1df1920c3c315f9e873ecf18cceb90452970c4.tar.gz
[svn] some minor updates:
* iterator functions for style/formatters/lexers * as/with keyword in python * get_style_defs now takes lists and tuples to yield multiple prefixes * updated documentation
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r--pygments/formatters/html.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 4df6c732..f342bf6a 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -165,13 +165,22 @@ class HtmlFormatter(Formatter):
current highlighting style. ``arg`` can be a string of selectors
to insert before the token type classes.
"""
- if arg:
- arg += ' '
+ if isinstance(arg, basestring):
+ args = [arg]
+ else:
+ args = list(arg)
+
+ def prefix(cls):
+ tmp = []
+ for arg in args:
+ tmp.append((arg and arg + ' ' or '') + '.' + cls)
+ return ', '.join(tmp)
+
styles = [(level, ttype, cls, style)
for cls, (style, ttype, level) in self.class2style.iteritems()
if cls and style]
styles.sort()
- lines = ['%s.%s { %s } /* %s */' % (arg, cls, style, repr(ttype)[6:])
+ lines = ['%s { %s } /* %s */' % (prefix(cls), style, repr(ttype)[6:])
for level, ttype, cls, style in styles]
if arg and not self.nobackground and \
self.style.background_color is not None: