Користим "GNU source-highlight" http://www.gnu.org/software/src-highlite/ .
Са командне линије радим ово:
$ source-highlight --no-doc --css=code.css test.c
где је садржај code.css овакав:
body { background-color: white; }
/* the color for context lines (when specified with line ranges) */
.context { color: gray; }
.keyword { color: blue; font-weight: bold; }
.type { color: darkgreen; }
.usertype, .classname { color: teal; }
.string { color: red; font-family: monospace; }
.regexp { color: orange; }
.specialchar { color: pink; font-family: monospace; }
.comment { color: brown; font-style: italic; }
.number { color: purple; }
.preproc { color: darkblue; font-weight: bold; }
.symbol { color: darkred; }
.function { color: black; font-weight: bold; }
.cbracket { color: red; }
.todo { font-weight: bold; background-color: cyan; }
/* line numbers */
.linenum { color: black; font-family: monospace; }
/* Internet related */
.url { color: blue; text-decoration: underline; font-family: monospace; }
/* other elements for ChangeLog and Log files */
.date { color: blue; font-weight: bold; }
.time, .file { color: darkblue; font-weight: bold; }
.ip, .name { color: darkgreen; }
/* for Prolog, Perl */
.variable { color: darkgreen; }
.italics { color: darkgreen; font-style: italic; }
.bold { color: darkgreen; font-weight: bold; }
/* for LaTeX */
.underline { color: darkgreen; text-decoration: underline; }
.fixed { color: green; font-family: monospace; }
.argument, .optionalargument { color: darkgreen; }
.math { color: orange; }
.bibtex { color: blue; }
/* for diffs */
.oldfile { color: orange; }
.newfile { color: darkgreen; }
.difflines { color: blue; }
/* for css */
.selector { color: purple; }
.property { color: blue; }
.value { color: darkgreen; font-style: italic; }
Затим сам исти садржај додао у шаблон блога, али без "body" линије. Уместо ње сам додао:
pre { background-color: #EEEEFF; }
И то је све. Још увек има простора за убрзавање овог процеса, али елементи су ту.
Нема коментара:
Постави коментар