$ code2html -h
Code2Html, version 0.9.1, Jan 2002, peter@palfrader.org
Usage: code2html [options] [input_file [output_file]]
Convert a program source to syntax highlighted HTML,
or any other format for wich rules are defined.
-l, --language-mode set language mode
--fallback LANG fallback language mode
-v, --verbose prints progress information to STDER
-n, --linenumbers print out the source code with line numbers
-P, --prefix optional prefix to use for linenumber anchors
-N, --linknumbers linenumbers will link to themselves
-t, --replace-tabs[=TABSTOP-WIDTH]
replace with spaces
-L, --language-file=LANGUAGE-FILE
specify an alternate file for definitions
-m, --modes print all available modes
-h, --help print this message
-V, --version print version
-c, --content-type prints a Content-Type header
-o, --output-format selects the output-format
-H, --no-header don't use the template
--template=FILE override template
-T, --title set title
-w, --linewidth max characters per line
-b, --linebreakprefix prefix of the new lines
see the man-page code2html for further help
$ code2html -m
Defined modes: ada, ada95, awk, c, c++, cc, cpp, cxx, gpasm, groff, html, java, javascript, js, lisp, m4, make, makefile, pas, pascal, patch, perl, plain, pov, povray, python, ruby, sh, shellscript, sql.
Defined outputformats: html, html-dark, html-fntlck, html-light, html-nobg, html-nocolor, html-simple.
ejemplos:
code2html pex.py -H
import xlrd
import xlwt
from xlutils.copy import copy
class xls(xlwt.Workbook):
def __init__(self, encoding='ascii', style_compression=0):
xlwt.Workbook.__init__(self,encoding, style_compression)
def add_sheet2(self,worksheet):
if isinstance(worksheet,xlwt.Worksheet):
self._Workbook__worksheet_idx_from_name[worksheet.name.lower()] = len(self._Workbook__worksheets)
self._Workbook__worksheets.append(worksheet)
else:
raise Exception("invalid worksheet")
file_name = 'tb_wbdh13.xls'
rb = xlrd.open_workbook(file_name,formatting_info=True)
print rb
print rb.name_and_scope_map
print rb.name_map
print rb.name_obj_list
print "____________________________________"
for name in rb.name_obj_list:
print name
print name.name
print name.raw_formula
print name.result.text
print name.scope
sheet = rb.sheet_by_index(0)
print sheet.colinfo_map
print sheet.rowinfo_map
print sheet.col_label_ranges
print sheet.row_label_ranges
print sheet.cell(1,3).xf_index
print sheet.colinfo_map[0].xf_index
print dir(sheet)
#print xlrd.dump(file_name)
wb = copy(rb)
ws = wb.get_sheet(0)
doc = xls()
doc.add_sheet("CLK_PROCESS_0")
doc.add_sheet("CLK_PROCESS_1")
doc.add_sheet("CLK_PROCESS_bak")
doc.add_sheet2(ws)
doc.save('out.xls')
code2html -n pex.py -H
1 import xlrd
2 import xlwt
3 from xlutils.copy import copy
4
5 class xls(xlwt.Workbook):
6 def __init__(self, encoding='ascii', style_compression=0):
7 xlwt.Workbook.__init__(self,encoding, style_compression)
8
9 def add_sheet2(self,worksheet):
10 if isinstance(worksheet,xlwt.Worksheet):
11 self._Workbook__worksheet_idx_from_name[worksheet.name.lower()] = len(self._Workbook__worksheets)
12 self._Workbook__worksheets.append(worksheet)
13 else:
14 raise Exception("invalid worksheet")
15
16 file_name = 'tb_wbdh13.xls'
17 rb = xlrd.open_workbook(file_name,formatting_info=True)
18
19 print rb
20 print rb.name_and_scope_map
21 print rb.name_map
22 print rb.name_obj_list
23 print "____________________________________"
24 for name in rb.name_obj_list:
25 print name
26 print name.name
27 print name.raw_formula
28 print name.result.text
29 print name.scope
30
31 sheet = rb.sheet_by_index(0)
32 print sheet.colinfo_map
33 print sheet.rowinfo_map
34 print sheet.col_label_ranges
35 print sheet.row_label_ranges
36 print sheet.cell(1,3).xf_index
37 print sheet.colinfo_map[0].xf_index
38 print dir(sheet)
39 #print xlrd.dump(file_name)
40 wb = copy(rb)
41 ws = wb.get_sheet(0)
42 doc = xls()
43 doc.add_sheet("CLK_PROCESS_0")
44 doc.add_sheet("CLK_PROCESS_1")
45 doc.add_sheet("CLK_PROCESS_bak")
46
47 doc.add_sheet2(ws)
48 doc.save('out.xls')
code2html -o html-nocolors -H prex.py
import xlrd
import xlwt
from xlutils.copy import copy
class xls(xlwt.Workbook):
def __init__(self, encoding='ascii', style_compression=0):
xlwt.Workbook.__init__(self,encoding, style_compression)
def add_sheet2(self,worksheet):
if isinstance(worksheet,xlwt.Worksheet):
self._Workbook__worksheet_idx_from_name[worksheet.name.lower()] = len(self._Workbook__worksheets)
self._Workbook__worksheets.append(worksheet)
else:
raise Exception("invalid worksheet")
file_name = 'tb_wbdh13.xls'
rb = xlrd.open_workbook(file_name,formatting_info=True)
print rb
print rb.name_and_scope_map
print rb.name_map
print rb.name_obj_list
print "____________________________________"
for name in rb.name_obj_list:
print name
print name.name
print name.raw_formula
print name.result.text
print name.scope
sheet = rb.sheet_by_index(0)
print sheet.colinfo_map
print sheet.rowinfo_map
print sheet.col_label_ranges
print sheet.row_label_ranges
print sheet.cell(1,3).xf_index
print sheet.colinfo_map[0].xf_index
print dir(sheet)
#print xlrd.dump(file_name)
wb = copy(rb)
ws = wb.get_sheet(0)
doc = xls()
doc.add_sheet("CLK_PROCESS_0")
doc.add_sheet("CLK_PROCESS_1")
doc.add_sheet("CLK_PROCESS_bak")
doc.add_sheet2(ws)
doc.save('out.xls')