Differences between revisions 3 and 4
Revision 3 as of 2011-08-03 11:00:48
Size: 1103
Editor: localhost
Comment: converted to 1.6 markup
Revision 4 as of 2012-08-21 10:23:46
Size: 973
Editor: 182
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
다음의 문서들을 만들어낼 수 있는데,

{{http://starship.python.net/crew/friedrich/HTMLgen/image/docclass.jpg}}

HTMLgen. [Python]에서 [HTML]을 만들어내는 모듈. 최대한 [OOP]적으로 [HTML]들을 만들어낼 수 있다.

http://starship.python.net/crew/friedrich/HTMLgen/html/main.html


가장 기본적인 SimpleDocument의 사용

import HTMLgen
d=HTMLgen.SimpleDocument()
p=HTMLgen.Paragraph("this is test")
d.append(p)
print d

좀 더 복잡한 SeriesDocument : 링크정보나 전후정보들을 사용할때

def overview(filename, aft=None, fore=None, top=None, home=None):
    doc=SeriesDocument("HTMLgen.rc") #문서에 필요한 리소스를 읽는다.
    doc.title=doctitle 
    doc.subtitle='Overview'
    doc.banner=('../image/HTMLgen_banner.jpg')
    doc.goprev, doc.gonext, doc.gotop, doc.gohome = aft,fore,top,home
    doc.append_file(os.path.join(datadir, 'overview-txt.html')) #기존에 만들어둔 페이지 삽입
    doc.write(os.path.join(htmldir,filename))


CategoryProgramLibrary

HTMLgen (last edited 2012-08-21 10:36:54 by 182)

web biohackers.net