5 # Base functions for reStructuredBlog
7 # (C) Magnus Lyckå, Thinkware AB, 2003
8 import mx
.DateTime
, locale
, os
9 locale
.setlocale(locale
.LC_ALL
, 'C') # I want English month names etc
10 from docutils
.core
import publish_string
, default_description
12 source_pattern
= 'blog*.txt'
13 timestamp_format
= '%Y-%m-%d %H:%M'
16 def __init__(self
, fn
):
20 return mx
.DateTime
.localtime(os
.stat(self
.fn
)[-2])
23 return file(self
.fn
).readline().strip()
26 return self
.fn
[:-3]+'html'
28 def makepage(fn
, text
):
29 #text = ('<html><head><title>%s</title><head>\n'
30 # '<body>%s</body></html>')
31 #file(fn+'.html', 'w').write(text % (title, body))
32 file(fn
+'.html', 'w').write(publish_string(text
, writer_name
='html'))