亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1861 | 回復(fù): 0
打印 上一主題 下一主題

highlight source file into a html file [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2007-07-06 23:24 |只看該作者 |倒序?yàn)g覽

download a python third library  silvercity below:
http://sourceforge.net/project/showfiles.php?group_id=45693&package_id=39308

I have written a simple demo.
from cStringIO import StringIO
c_code='''
#include
typedef struct tagName {
    char b[12];
    char m[46];
    int  xx;
}
int main()
{
    int i;
    for (i=0; i
.code_default
{
    FONT-FAMILY: "Courier New", Courier, monospace;
    FONT-SIZE: 10pt;
}
/* CSS */
.css_class
{
    color: #900000;
}
.css_comment
{
    color: green;
    font-style: italic;
}
.css_default
{
}
.css_directive
{
    color: #009000;
    font-weight: bold;
}
.css_doublestring
{
    color: navy;
}
.css_id
{
    color: #900000;
}
.css_identifier
{
    color: black;
}
.css_important
{
    color: blue;
}
.css_operator
{
    color: #000090;
    font-weight: bold;
}
.css_pseudoclass
{
    color: #900000;
}
.css_singlestring
{
    color: navy;
}
.css_identifier2
{
    color: black;
}
.css_attribute
{
    color: #800000;
}
.css_tag
{
    color: #900000;
    font-weight: bold;
}
.css_unknown_identifier
{
    color: red;
}
.css_unknown_pseudoclass
{
    color: #ff0000;
}
.css_value
{
    color: navy;
}
/* C/C++/JavaScript */
.c_character
{
    color: olive;
}
.c_comment
{
    color: green;
    font-style: italic;
}
.c_commentdoc
{
    color: green;
    font-style: italic;
}
.c_commentdockeyword
{
    color: navy;
    font-weight: bold;
}
.c_commentdockeyworderror
{
    color: red;
    font-weight: bold;
}
.c_commentline
{
    color: green;
    font-style: italic;
}
.c_commentlinedoc
{
    color: green;
    font-style: italic;
}
.c_default
{
}
.c_identifier
{
    color: black;
}
.c_number
{
    color: #009999;
}
.c_operator
{
    color: black;
}
.c_preprocessor
{
    color: navy;
    font-weight: bold;
}
.c_regex
{
    color: olive;
}
.c_string
{
    color: olive;
}
.c_stringeol
{
    color: olive;
}
.c_uuid
{
    color: olive;
}
.c_verbatim
{
    color: olive;
}
.c_word
{
    color: navy;
    font-weight: bold;
}
.c_word2
{
    color: navy;
    font-weight: bold;
}
/* HTML (incomplete) */
.h_asp
{
    color: #ffff00;
}
.h_aspat
{
    color: #ffdf00;
}
.h_attribute
{
    color: #008080;
}
.h_attributeunknown
{
    color: #ff0000;
}
.h_cdata
{
    color: #ffdf00;
}
.h_comment
{
    color: #808000;
}
.h_default
{
}
.h_doublestring
{
    color: olive;
}
.h_entity
{
    color: #800080;
}
.h_number
{
    color: #009999;
}
.h_other
{
    color: #800080;
}
.h_script
{
    color: #000080;
}
.h_singlestring
{
    color: olive;
}
.h_tag
{
    color: #000080;
}
.h_tagend
{
    color: #000080;
}
.h_tagunknown
{
    color: #ff0000;
}
.h_xmlend
{
    color: #0000ff;
}
.h_xmlstart
{
    color: #0000ff;
}
/* Perl */
.pl_array
{
    color: black;
}
.pl_backticks
{
    color: olive;
}
.pl_character
{
    color: olive;
}
.pl_commentline
{
    color: green;
    font-style: italic;
}
.pl_datasection
{
    color: olive;
}
.pl_default
{
}
.pl_error
{
    color: red;
    font-style: bold;
}
.pl_hash
{
    color: black;
}
.pl_here_delim
{
    color: olive;
}
.pl_here_q
{
    color: olive;
}
.pl_here_qq
{
    color: olive;
}
.pl_here_qx
{
    color: olive;
}
.pl_identifier
{
    color: black;
}
.pl_longquote
{
    color: olive;
}
.pl_number
{
    color: #009999;
}
.pl_operator
{
    color: black;
}
.pl_pod
{
    color: black;
    font-style: italic;
}
.pl_preprocessor
{
    color: navy;
    font-weight: bold;
}
.pl_punctuation
{
    color: black;
}
.pl_regex
{
    color: olive;
}
.pl_regsubst
{
    color: olive;
}
.pl_scalar
{
    color: black;
}
.pl_string
{
    color: olive;
}
.pl_string_q
{
    color: olive;
}
.pl_string_qq
{
    color: olive;
}
.pl_string_qr
{
    color: olive;
}
.pl_string_qw
{
    color: olive;
}
.pl_string_qx
{
    color: olive;
}
.pl_symboltable
{
    color: black;
}
.pl_variable_indexer
{
    color: black;
}
.pl_word
{
    color: navy;
    font-weight: bold;
}
.pl_pod_verb
{
    color: navy;
    font-weight: bold;
}
/* PostScript */
.ps_default
{
}
.ps_comment
{
    color: green;
    font-style: italic;
}
ps_dsc_comment
{
    color: green;
    font-style: italic;
}
.ps_dsc_value
{
    color: #009999;
    font-weight: bold;
}
.ps_number
{
    color: #880000;
}
.ps_name
{
    color: blue;
    font-weight: bold;
}
.ps_keyword
{
    color: navy;
    font-weight: bold;
}
.ps_literal
{
    color: olive;
}
.ps_immeval
{
    color: black;
}
.ps_paren_array
{
    color: black;
}
.ps_paren_dict
{
    color: black;
}
.ps_paren_proc
{
    color: black;
}
.ps_text
{
    color: black;
}
.ps_hexstring
{
    color: black;
}
.ps_base85string
{
    color: black;
}
.ps_badstringchar
{
    color: red;
}
/* Python */
.p_character
{
    color: olive;
}
.p_classname
{
    color: blue;
    font-weight: bold;
}
.p_commentblock
{
    color: gray;
    font-style: italic;
}
.p_commentline
{
    color: green;
    font-style: italic;
}
.p_default
{
}
.p_defname
{
    color: #009999;
    font-weight: bold;
}
.p_identifier
{
    color: black;
}
.p_number
{
    color: #009999;
}
.p_operator
{
    color: black;
}
.p_string
{
    color: olive;
}
.p_stringeol
{
    color: olive;
}
.p_word2
{
    color: purple;
}
.p_decorator
{
    color: maroon;
}
.p_triple
{
    color: olive;
}
.p_tripledouble
{
    color: olive;
}
.p_word
{
    color: navy;
    font-weight: bold;
}
/* Verilog */
.v_default
{
}
.v_comment
{
    color: gray;
    font-style: italic;
}
.v_commentline
{
    color: red;
    font-style: italic;
}
.v_commentlinebang
{
    color: red;
    font-style: italic;
}
.v_number
{
    color: #009999;
    font-style: italic;
}
.v_word
{
    color: navy;
    font-weight: bold;
}
.v_string
{
    color: olive;
}
.v_word2
{
    color: green;
    font-weight: bold;
}
.v_word3
{
    color: navy;
    font-weight: bold;
}
.v_preprocessor
{
    color: #009999;
}
.v_operator
{
    color: black;
}
.v_identifier
{
    color: black;
}
.v_stringeol
{
    color: olive;
}
.v_user
{
    color: blue;
    font-weight: bold;
}
/* YAML */
.yaml_comment
{
    color: #008800;
    font-style: italic;
}
.yaml_default
{
}
.yaml_document
{
    color: #808080;
    font-style: italic;
}
.yaml_identifier
{
    color: navy;
    font-weight: bold;
}
.yaml_keyword
{
    color: #880088;
}
.yaml_number
{
    color: #880000;
}
.yaml_reference
{
    color: #008888;
}
%s
''' %(src)
from SilverCity import CPP
test_file = StringIO()
CPP.CPPHTMLGenerator().generate_html(test_file, c_code)
#printsrc( test_file.getvalue() )
from SilverCity import Python
test_file = StringIO()
Python.PythonHTMLGenerator().generate_html(test_file, p_code)
open("1.html", "w").write( get_code_html( test_file.getvalue() ) )



本文來自ChinaUnix博客,如果查看原文請點(diǎn):http://blog.chinaunix.net/u/6123/showart_335631.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP