Changeset 17708


Ignore:
Timestamp:
Apr 29, 2020, 7:50:14 PM (5 years ago)
Author:
Ryan J Ollos
Message:

TracCiteCode 0.3.6: Require Trac 1.2

Remove compatibility code.

Location:
citecodemacro/1.0
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • citecodemacro/1.0/setup.py

    r16550 r17708  
    1111setup(
    1212    name='TracCiteCode',
    13     version='0.3.5',
     13    version='0.3.6',
    1414    packages=find_packages(exclude=['*.tests*']),
    1515    license="BSD 3-Clause",
     
    1717    entry_points={
    1818        'trac.plugins': [
    19             'traccitecode = traccitecode',
     19            'traccitecode = traccitecode.citecode',
    2020        ],
    2121    },
  • citecodemacro/1.0/traccitecode/__init__.py

    r15608 r17708  
    1 # -*- coding: utf-8 -*-
    2 #
    3 # Copyright (C) 2016 tkob <ether4@gmail.com>
    4 # All rights reserved.
    5 #
    6 # This software is licensed as described in the file COPYING, which
    7 # you should have received as part of this distribution.
    8 
    9 from traccitecode import citecode
     1import pkg_resources
     2pkg_resources.require('Trac >= 1.2')
  • citecodemacro/1.0/traccitecode/citecode.py

    r16550 r17708  
    7373                content=content,
    7474                filename="",
    75                 annotations=['citecode_lineno'],
     75                annotations=['lineno'],
    7676            )
    7777            return xhtml
     
    133133        ))
    134134
    135 
    136 # Just copied from trunk of Trac core and renamed annotation_type
    137 # since 'lineno' hint is not available in Trac 1.0
    138 
    139 # Copyright (C) 2004-2014 Edgewall Software
    140 # Copyright (C) 2004 Daniel Lundin <daniel@edgewall.com>
    141 # Copyright (C) 2005-2006 Christopher Lenz <cmlenz@gmx.de>
    142 # Copyright (C) 2006-2007 Christian Boos <cboos@edgewall.org>
    143 # All rights reserved.
    144 #
    145 # This software is licensed as described in the file COPYING, which
    146 # you should have received as part of this distribution. The terms
    147 # are also available at http://trac.edgewall.org/wiki/TracLicense.
    148 #
    149 # This software consists of voluntary contributions made by many
    150 # individuals. For the exact contribution history, see the revision
    151 # history and logs, available at http://trac.edgewall.org/log/.
    152 #
    153 # Author: Daniel Lundin <daniel@edgewall.com>
    154 #         Christopher Lenz <cmlenz@gmx.de>
    155 #         Christian Boos <cboos@edgewall.org>
    156 
    157 from trac.mimeview.api import IHTMLPreviewAnnotator
    158 from trac.util import Ranges
    159 from trac.util.html import html as tag
    160 from trac.util.translation import _
    161 
    162 
    163 class LineNumberAnnotator(Component):
    164     """Text annotator that adds a column with line numbers."""
    165     implements(IHTMLPreviewAnnotator)
    166 
    167     # IHTMLPreviewAnnotator methods
    168 
    169     def get_annotation_type(self):
    170         return 'citecode_lineno', _('Line'), _('Line numbers')
    171 
    172     def get_annotation_data(self, context):
    173         try:
    174             marks = Ranges(context.get_hint('marks'))
    175         except ValueError:
    176             marks = None
    177         return {
    178             'id': context.get_hint('id', '') + 'L%s',
    179             'marks': marks,
    180             'offset': context.get_hint('lineno', 1) - 1
    181         }
    182 
    183     def annotate_row(self, context, row, lineno, line, data):
    184         lineno += data['offset']
    185         id = data['id'] % lineno
    186         if data['marks'] and lineno in data['marks']:
    187             row(class_='hilite')
    188         row.append(tag.th(id=id)(tag.a(lineno, href='#' + id)))
  • citecodemacro/1.0/traccitecode/htdocs/citecode.css

    r15613 r17708  
    11table.code th.citecode_lineno { width: 4em }
    2 
  • citecodemacro/1.0/traccitecode/htdocs/citecode.js

    r16375 r17708  
    1 $(function() {
     1jQuery(function($) {
    22    $(document).find('table.code tr th a').each(function(){
    33        $(this).attr('title', 'Double click to create a ticket');
Note: See TracChangeset for help on using the changeset viewer.