~bzr/loggerhead/daily-ppa

« back to all changes in this revision

Viewing changes to loggerhead/highlight.py

  • Committer: Max Bowsher
  • Date: 2011-03-15 00:35:34 UTC
  • mfrom: (182.150.14 trunk)
  • Revision ID: maxb@f2s.com-20110315003534-n4shb8sx63e14r3p
Merge trunk, resolving conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
#
18
18
 
 
19
import bzrlib.osutils
19
20
import cgi
20
21
 
21
22
from pygments import highlight as _highlight_func
36
37
    """
37
38
 
38
39
    if len(text) > MAX_HIGHLIGHT_SIZE:
39
 
        return map(cgi.escape, text.split('\n'))
 
40
        return map(cgi.escape,  bzrlib.osutils.split_lines(text))
40
41
 
41
42
    formatter = HtmlFormatter(style=style, nowrap=True, classprefix='pyg-')
42
43
 
48
49
        except (ClassNotFound, ValueError):
49
50
            lexer = TextLexer(encoding=encoding)
50
51
 
51
 
    hl_lines = _highlight_func(text, lexer, formatter).split('\n')
 
52
    hl_lines = _highlight_func(text, lexer, formatter)
 
53
    hl_lines = bzrlib.osutils.split_lines(hl_lines)
52
54
 
53
55
    return hl_lines