comparison hgext/highlight.py @ 5654:831e34e17f4f

highlight: mandatory arguments where possible
author Christian Ebert <blacktrash@gmx.net>
date Wed, 12 Dec 2007 14:36:34 +0100
parents 88ca3e0fb6e5
children fe38b0a3a928
comparison
equal deleted inserted replaced
5653:1b35bc1c1968 5654:831e34e17f4f
64 64
65 yield 0, "</pre>" 65 yield 0, "</pre>"
66 yield 0, "</div>" 66 yield 0, "</div>"
67 67
68 68
69 def pygments_format(filename, rawtext, forcetext=False, stripecount=1, 69 def pygments_format(filename, rawtext, forcetext, stripecount, style):
70 style='colorful'):
71 if not forcetext: 70 if not forcetext:
72 try: 71 try:
73 lexer = guess_lexer_for_filename(filename, rawtext) 72 lexer = guess_lexer_for_filename(filename, rawtext)
74 except ClassNotFound: 73 except ClassNotFound:
75 lexer = TextLexer() 74 lexer = TextLexer()
108 for line in text.splitlines(True): 107 for line in text.splitlines(True):
109 yield {"line": line} 108 yield {"line": line}
110 109
111 style = self.config("web", "pygments_style", "colorful") 110 style = self.config("web", "pygments_style", "colorful")
112 111
113 text_formatted = lines(pygments_format(f, text, 112 text_formatted = lines(pygments_format(f, text, forcetext,
114 forcetext=forcetext, 113 self.stripecount, style))
115 stripecount=self.stripecount,
116 style=style))
117 114
118 # override per-line template 115 # override per-line template
119 tmpl.cache['fileline'] = '#line#' 116 tmpl.cache['fileline'] = '#line#'
120 117
121 # append a <link ...> to the syntax highlighting css 118 # append a <link ...> to the syntax highlighting css