2 # -*- coding: ISO-8859-1 -*-
4 import sys
, os
.path
, codecs
, encodings
5 from zope
.pagetemplate
.pagetemplate
import PageTemplate
8 def __init__(self
, name
):
10 self
.png
= "examples/%s.png" % self
.name
11 self
.eps
= "examples/%s.eps" % self
.name
12 self
.code
= open("../examples/%s.py.html" % name
, "r").read()
13 self
.code
= self
.code
.replace("ä", "ä")
14 self
.code
= self
.code
.replace("Ä", "Ä")
15 self
.code
= self
.code
.replace("ö", "ö")
16 self
.code
= self
.code
.replace("Ö", "Ö")
17 self
.code
= self
.code
.replace("ü", "ü")
18 self
.code
= self
.code
.replace("Ü", "Ü")
19 self
.code
= self
.code
.replace("ß", "ß")
20 self
.code
= self
.code
.replace("é", "é")
21 def __getattr__(self
, attr
):
22 return self
.__dict
__[attr
]
24 def PageTemplateFromFile(filename
):
26 pt
.write(open(filename
, "r").read())
29 def write_file(filename
, string
):
30 # path = os.path.join(os.path.expanduser(outpath), filename)
31 # print "Writing %s ..." % path
32 open(filename
, "w").write(string
)
34 maintemplate
= PageTemplateFromFile("maintemplate.pt")
36 pagename
= sys
.argv
[1]
37 if pagename
.endswith(".pt"): pagename
= pagename
[:-3]
39 examples
= [example("hello"),
48 example("sierpinski"),
49 example("graphs/minimal"),
50 example("graphs/lissajous"),
51 example("graphs/piaxis"),
52 example("graphs/manyaxes"),
53 example("graphs/inset"),
54 example("graphs/link"),
55 example("graphs/change"),
56 example("graphs/bar"),
57 example("graphs/arrows"),
58 example("graphs/mandel"),
59 example("graphs/integral"),
60 example("graphs/partialfill"),
61 example("graphs/washboard"),
62 example("axis/simple"),
63 example("axis/painter"),
64 example("axis/rating"),
65 example("axis/manualticks"),
66 example("axis/parter"),
67 example("axis/texter"),
70 write_file("%s.html" % pagename
,
71 PageTemplateFromFile("%s.pt" % pagename
)(maintemplate
=maintemplate
,
72 pagename
="%s.html" % pagename
,