]> git.armaanb.net Git - stagit.git/blobdiff - highlight
Pass in filename not fpath.
[stagit.git] / highlight
index cfcc452fb2862375aa073c4c5f2052514957f49d..ba17566d7d88492e957142078fd95ccb381312b7 100755 (executable)
--- a/highlight
+++ b/highlight
@@ -5,7 +5,7 @@ from pygments import highlight
 from pygments.formatters import HtmlFormatter
 from pygments.lexers import guess_lexer, guess_lexer_for_filename
 
-from sys import stdin
+from sys import stdin, stderr
 
 filename = stdin.readline().strip()
 contents = stdin.read()
@@ -25,9 +25,15 @@ if lexer is None:
     lexer = TextLexer
 
 FORMAT = HtmlFormatter(
-    lineos='table',
+    style='murphy',
+    cssclass='highlight',
+    linenos='table',
     lineanchors='loc',
     anchorlinenos=True)
 
 print(highlight(contents, lexer, FORMAT))
+print('<style>')
+print(FORMAT.get_style_defs('.highlight'))
+print('</style>')
 
+print("Filename: {}; Lexer: {}.".format(filename, lexer), file=stderr)