~ubuntu-branches/debian/sid/loggerhead/sid

« back to all changes in this revision

Viewing changes to loggerhead/highlight.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2011-06-02 14:11:55 UTC
  • mto: (13.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20110602141155-1pya25vmwztblmbq
Tags: upstream-1.18.1+bzr447
ImportĀ upstreamĀ versionĀ 1.18.1+bzr447

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