removed obsolete issues (many of them fixed with AE)
[docutils.git] / sandbox / mly / restblog / restblog.py
blob3c7862de50b5f259678e8d8f8ca4aa84bc86235e
1 #!/usr/bin/python -tt
3 # restblog.py
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'
15 class Metadata:
16 def __init__(self, fn):
17 self.fn = fn
19 def timestamp(self):
20 return mx.DateTime.localtime(os.stat(self.fn)[-2])
22 def subject(self):
23 return file(self.fn).readline().strip()
25 def targetname(self):
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'))