Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 6 years ago

#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.

  1. 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)
  1. add pygment dep suggestion/requirement

Attachments (0)

Change History (12)

comment:1 by Christian Boos, 11 years ago

Milestone: 0.12

We could certainly deprecate the Enscript and PHP highlighters, yes.

in reply to:  1 comment:2 by Remy Blank, 11 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 Christian Boos, 11 years ago

Deprecate with a (single) warning in 0.11.6 and move the highlighters to tracopt in trunk?

comment:4 by Remy Blank, 11 years ago

Owner: set to Remy Blank

Ok. Maybe a bit brutal, but hey, life's unfair ;-)

comment:5 by Remy Blank, 11 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  
    119119
    120120    def __init__(self):
    121121        self._types = None
     122        self._deprecation_shown = False
    122123
    123124    # IHTMLPreviewRenderer methods
    124125
     
    132133        return self._types.get(mimetype, (None, 0))[1]
    133134
    134135    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
    135141        cmdline = self.path
    136142        mimetype = mimetype.split(';', 1)[0] # strip off charset
    137143        mode = self._types[mimetype][0]
  • trac/mimeview/php.py

    diff --git a/trac/mimeview/php.py b/trac/mimeview/php.py
    a b  
    7171
    7272    returns_source = True
    7373
     74    _deprecation_shown = False
     75
    7476    # IHTMLPreviewRenderer methods
    7577
    7678    def get_quality_ratio(self, mimetype):
     
    7981        return 0
    8082
    8183    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
    8289        # -n to ignore php.ini so we're using default colors
    8390        cmdline = '%s -sn' % self.path
    8491        self.env.log.debug("PHP command line: %s" % cmdline)

comment:6 by Christian Boos, 11 years ago

Type: taskdefect

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 Remy Blank, 11 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 Ryan Ollos <ryano@…>, 11 years ago

Cc: ryano@… added

comment:9 by Remy Blank, 11 years ago

Warning added in [8799].

comment:10 by Remy Blank, 11 years ago

Resolution: fixed
Status: newclosed

Moved the Enscript and PHP renderers into tracopt in [8802], together with the test suite for the PHP renderer.

comment:11 by Ryan J Ollos, 6 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.

in reply to:  11 comment:12 by Ryan J Ollos, 6 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.