diff options
author | Georg Brandl <georg@python.org> | 2011-01-03 17:59:18 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-01-03 17:59:18 +0100 |
commit | 8c8b634ffa76c4a50149b05b76d9ea95aa016516 (patch) | |
tree | 84507b48afc9e850fe8451545df7006d91feedf3 | |
parent | f9daf06a0dcbe7b32ff02592abcc06350dc502aa (diff) | |
download | pygments-8c8b634ffa76c4a50149b05b76d9ea95aa016516.tar.gz |
Do not generate classprefix without an actual class name (#479).
-rw-r--r-- | pygments/formatters/html.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 0b0e5cbe..d1172c7f 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -379,14 +379,16 @@ class HtmlFormatter(Formatter): def _get_css_class(self, ttype): """Return the css class of this token type prefixed with the classprefix option.""" - return self.classprefix + _get_ttype_class(ttype) + ttypeclass = _get_ttype_class(ttype) + if ttypeclass: + return self.classprefix + ttypeclass + return '' def _create_stylesheet(self): t2c = self.ttype2class = {Token: ''} c2s = self.class2style = {} - cp = self.classprefix for ttype, ndef in self.style: - name = cp + _get_ttype_class(ttype) + name = self._get_css_class(ttype) style = '' if ndef['color']: style += 'color: #%s; ' % ndef['color'] |