EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
官方主页 http://www.gnu.org/software/src-highlite/ This program, given a source file, produces a document with syntax highlighting. These are the output formats already supported:
6 U$ f1 j9 N X2 R" uHTML(这个vim用:TOhtml也可以)
, G, z; b* v( cXHTML% R9 Q; q# \8 J2 f( L' h5 Z: g! T
LATEX
5 f# _7 e* R1 x+ K1 q* `- J5 m3 H4 z- VTEXINFO
8 l( x+ I' ^0 ^, `( C! c; QANSI color escape sequences (可以在水木上彩色显示代码,vim有TOansi插件也可以, DocBook These are the input languages (or input formats) already supported (in alphabetical order):
8 S" t$ j+ ], rC/C++) }3 r9 o5 [' A I% p4 V5 \
C#
7 |# p3 j# u( V, C7 L2 T9 G3 @% q; ^Bib
. r5 {/ L l- |Bison9 ^% B5 z1 O" h# d+ e
Caml
: }! T% o. y& ~2 Q6 q6 j& \) xChangelog
, [7 n+ E/ m" O4 @) s- hCss (new)
3 K' m n7 m9 a eDiff
& c/ q. i O2 d6 f# w7 aFlex
* T0 C% `6 z( Z5 b4 T. z* ]Fortran
; }$ L; }$ Z/ S% u5 LHtml
- l( g6 `! b( {* [- p3 g( ^9 s, C& vJava
+ [0 _$ b# _+ O9 {+ U1 k* Y6 \Javascript
+ K! k& w9 ^* l0 m {" W& qLatex
; E# ~% z/ f- }9 J! P E7 _! m5 OLogtalk1 j: L1 A, h+ p' G& l1 @8 T4 L
Log files
+ b) i, i1 f& D. D# f; L% hLua
( |& D: x5 {2 k# u1 k4 J1 u+ GMakefile (new)
; @+ l. E% g! f7 ^+ x AM4 (new)& e3 ?1 ]# t: U* K
ML1 V/ s3 W# H5 {' v3 m5 H' K
Pascal$ V+ Q9 l; F# T
Perl
" l: M9 D" R; o: s$ ^PHP
3 V, O. E/ b5 |1 {& RPostscript
; J' {; w5 d! B) Z/ k1 q e5 rProlog
8 T0 r! s6 p& G* e; {Python- W; A5 S1 B9 Z2 u/ E
Ruby! d5 p5 S! n5 K3 o; W. k, }- M
Shell0 S! @' U3 E+ k
Sql9 g( @( t2 ]. j& v1 H: |8 |
Tcl1 Y# R- o# N, @# w+ m+ s! f+ H
XML 自己编译的话要用到boost::regex库,win32的有直接下载的 http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=33223 win32的安装之后开始菜单里只有文档,用的的时候把GnuWin32\bin\source-highlight.exe复制到GnuWin32\share\source-highlight里用吧,使用方法是 source-highlight.exe -s cpp -f esc --input comments.cpp --output xxx.txt --style-file esc.style Here’s how to run source-highlight (for this example we will use C/C++ input
# R; c' W0 r- Afiles, but this- l3 ]+ s0 D8 u% N' d+ v/ N
is valid also for other source-highlight input languages):3 w- b+ F9 N( ]
source-highlight --src-lang cpp --out-format html \
, G/ T# k7 C5 r5 M. @--input <C++ file> \- k r% N5 ]' J. ~3 C& \$ G7 d1 }
--output <html file> \
, h/ P, v7 k7 m7 ], B/ T--style-file <style file> \: r- r' ~2 x& c) V$ p
options
. T& E4 ?+ U) ?/ jFor input files, apart from the -i (--input) option and the standard input redirection, you
. ?! }5 D) v" ucan simply specify some files at the command line and also use regular expressions (for instance
. y5 ^6 A/ a% Z‘*.java’). In this case the name for the output files will be formed using the name of the source* F! s- r R2 e! P
file with a .<ext> appended, where <ext> is the extension chosen according to the output format
8 D7 y5 M; \2 j4 V4 k6 ispecified (in this example it would be .html). The style file (Section 5.1 [Output format style],
8 @9 R) L% G- Npage 8) contains information on how to format specific language parts (e.g., keywords in blue& C8 G1 u. R& k) Y" O" e, |; e: E
and boldface, etc.). If STDOUT string is passed as -o (--output) option, then the output is forced
r/ `: E9 I; {" p% P4 n Qto the standard output anyway.
5 A2 R% U _- ]) L/ ]6 wIf -s (--src-lang) is not specified, the source language is inferred by the extension of the
0 f! D7 l$ t( D8 v; g" Linput file (this, of course, does not work with standard input redirection).
: I* j4 g% `* ]% d( w: l0 \If -f (--out-format) is not specified, the output will be produced in HTML.8 J/ Z+ g8 O2 z( ^6 F+ O* Y3 ~, p
If --style-file is not specified, the ‘default.style’, which is included in6 k( R3 ?4 R& W [8 T# J: P
the distribution,will be used。 自带文档说的更详细
5 e2 m* W3 r. {) j2 {6 q/ K.style和.outlang都可以改得,比如附带的esc.style(输出成ansi彩色用的色彩配置文件)是 keyword blue b ;
8 I, A1 o' F/ f8 ?+ u% ptype darkgreen ;
/ ~* V4 R/ F! c! l! U+ a; N& O& b' @& @string red ;$ m$ n2 C' W) S8 q! s+ d2 m1 E
comment brown i ;
+ M B0 Z) [# ]6 Y' knumber purple ;
) h5 r) d4 i) T# u9 c" X: bpreproc darkblue b ;) q8 z6 i$ ^& U) H3 d
symbol darkred ;: @( C8 t0 y7 ]- f2 k* p
function black b;5 u* }7 V# ^3 ^; i0 ]
cbracket red; // line numbers
* @- r- m4 N: w- l$ O) W9 a" ~, P: zlinenum yellow; 输出出来在term下不是很好看,我把它改成 keyword green b ; n, W( z6 D) |- i# \# D
type green ;
6 b; h# c. v, m# m, h7 M% |, Kstring yellow ;
9 {# [0 F2 P; vcomment cyan i ;% y) d9 [) [. v" C
number yellow ;
9 o4 j2 e5 p) t0 }. J, D8 q: u4 npreproc blue b ;% T2 @8 s6 C5 L" j9 j6 I* F/ X& h7 O0 R
symbol purple ;
+ T4 J" y3 ~) F" Z2 O; cfunction red b;
3 Y" z2 T0 |. P9 Ocbracket purple; // line numbers
|' g1 M8 n& G/ ^; \linenum yellow; 改了之后term上水木的截图
Z$ h6 P/ |/ `+ ]: S5 k转成html的用法是 source-highlight.exe -s cpp -f html --input comments.cpp --output xxx.html 就不贴图了,觉得默认style不好看就自己改一改
! P: _* ^( H R! Q2 t8 Z |