~jelmer/loggerhead/breezy-compat

« back to all changes in this revision

Viewing changes to loggerhead/highlight.py

  • Committer: Colin Watson
  • Date: 2019-09-19 08:10:36 UTC
  • mfrom: (491.2.62 breezy)
  • Revision ID: cjwatson@canonical.com-20190919081036-q1symc2h2iedtlh3
[r=cjwatson] Switch loggerhead over to using the Breezy rather than Bazaar APIs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335  USA
17
17
#
18
18
 
19
 
import bzrlib.osutils
 
19
import breezy.osutils
20
20
import cgi
21
21
 
22
22
from pygments import highlight as _highlight_func
37
37
    """
38
38
 
39
39
    if len(text) > MAX_HIGHLIGHT_SIZE:
40
 
        return map(cgi.escape,  bzrlib.osutils.split_lines(text))
 
40
        return map(cgi.escape,  breezy.osutils.split_lines(text))
41
41
 
42
42
    formatter = HtmlFormatter(style=style, nowrap=True, classprefix='pyg-')
43
43
 
50
50
            lexer = TextLexer(encoding=encoding)
51
51
 
52
52
    hl_lines = _highlight_func(text, lexer, formatter)
53
 
    hl_lines = bzrlib.osutils.split_lines(hl_lines)
 
53
    hl_lines = breezy.osutils.split_lines(hl_lines)
54
54
 
55
55
    return hl_lines