#8113 closed defect (fixed)
syntax highlighting dependency cleanup
Reported by: | anonymous | Owned by: | Remy Blank |
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | rendering | Version: | 0.11.2 |
Severity: | normal | Keywords: | |
Cc: | ryano@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Enscript will highlight php as of 1.6.4, pygments is default for syntax highlighting.
- Drop the php mimeviewer completely. There is no reason why php-cli should be required for trac-svn browsing of php code (either use enscript or pygment)
- add pygment dep suggestion/requirement
Attachments (0)
Change History (12)
follow-up: 2 comment:1 by , 16 years ago
Milestone: | → 0.12 |
---|
comment:2 by , 15 years ago
Replying to cboos:
We could certainly deprecate the Enscript and PHP highlighters, yes.
How would we do that? I suppose we would document it, but also add a warning in the log? Move the highlighters to tracopt
?
comment:3 by , 15 years ago
Deprecate with a (single) warning in 0.11.6 and move the highlighters to tracopt in trunk?
comment:5 by , 15 years ago
Is this what you had in mind for 0.11.6?
-
trac/mimeview/enscript.py
diff --git a/trac/mimeview/enscript.py b/trac/mimeview/enscript.py
a b 119 119 120 120 def __init__(self): 121 121 self._types = None 122 self._deprecation_shown = False 122 123 123 124 # IHTMLPreviewRenderer methods 124 125 … … 132 133 return self._types.get(mimetype, (None, 0))[1] 133 134 134 135 def render(self, context, mimetype, content, filename=None, rev=None): 136 if not self._deprecation_shown: 137 self.log.warning('The Enscript highlighter is deprecated and ' 138 'will be disabled by default in 0.12') 139 self._deprecation_show = True 140 135 141 cmdline = self.path 136 142 mimetype = mimetype.split(';', 1)[0] # strip off charset 137 143 mode = self._types[mimetype][0] -
trac/mimeview/php.py
diff --git a/trac/mimeview/php.py b/trac/mimeview/php.py
a b 71 71 72 72 returns_source = True 73 73 74 _deprecation_shown = False 75 74 76 # IHTMLPreviewRenderer methods 75 77 76 78 def get_quality_ratio(self, mimetype): … … 79 81 return 0 80 82 81 83 def render(self, context, mimetype, content, filename=None, rev=None): 84 if not self._deprecation_shown: 85 self.log.warning('The PHP highlighter is deprecated and will be ' 86 'disabled by default in 0.12') 87 self._deprecation_show = True 88 82 89 # -n to ignore php.ini so we're using default colors 83 90 cmdline = '%s -sn' % self.path 84 91 self.env.log.debug("PHP command line: %s" % cmdline)
comment:6 by , 15 years ago
Type: | task → defect |
---|
Yes, except that if you replace:
if not self._deprecation_shown:
by:
if not hasattr(self, '_deprecation_shown'):
you get a smaller diff ;-)
comment:7 by , 15 years ago
Right. But I tend to avoid hasattr()
/ getattr()
magic whenever possible. I find them to be less readable.
About moving the components to tracopt
, that means we also move the unit and functional tests, so we will have to auto-enable components in tracopt.*
in the test suite.
comment:8 by , 15 years ago
Cc: | added |
---|
comment:10 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Moved the Enscript and PHP renderers into tracopt
in [8802], together with the test suite for the PHP renderer.
follow-up: 12 comment:11 by , 10 years ago
It has been proposed to remove the Enscript, SilverCity and PHP renderers in comment:30:ticket:11605 for milestone:1.1.3. Please let me know if you have any thoughts.
comment:12 by , 10 years ago
Replying to rjollos:
It has been proposed to remove the Enscript, SilverCity and PHP renderers in comment:30:ticket:11605 for milestone:1.1.3. Please let me know if you have any thoughts.
Dedicated ticket is now #11795.
We could certainly deprecate the Enscript and PHP highlighters, yes.