equal
deleted
inserted
replaced
97 continue |
97 continue |
98 register_pygments_transforms(ENGINE, verb=False) |
98 register_pygments_transforms(ENGINE, verb=False) |
99 |
99 |
100 def patch_convert(cls): |
100 def patch_convert(cls): |
101 def _convert(self, trdata, origconvert=cls._convert): |
101 def _convert(self, trdata, origconvert=cls._convert): |
102 try: |
102 add_css = getattr(trdata.appobject._cw, 'add_css', None) |
103 trdata.appobject._cw.add_css('pygments.css') |
103 if add_css is not None: |
104 except AttributeError: # session has no add_css, only http request |
104 # session has no add_css, only http request |
105 pass |
105 add_css('pygments.css') |
106 return origconvert(self, trdata) |
106 return origconvert(self, trdata) |
107 cls._convert = _convert |
107 cls._convert = _convert |
108 patch_convert(pygmentstransforms.PygmentsHTMLTransform) |
108 patch_convert(pygmentstransforms.PygmentsHTMLTransform) |
109 |
109 |
110 HAS_PYGMENTS_TRANSFORMS = True |
110 HAS_PYGMENTS_TRANSFORMS = True |