diff options
author | mly <mly@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2003-06-12 08:49:32 +0000 |
---|---|---|
committer | mly <mly@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2003-06-12 08:49:32 +0000 |
commit | a01c079efafc22be5cecab4e15a01e643b03780b (patch) | |
tree | 7b93025af0e21459f3565ff06c32cfcf0fb06b36 /sandbox/mly/restblog/restblog.py | |
parent | 0711e77012533cc858e067bc3e4493a50e735912 (diff) | |
download | docutils-a01c079efafc22be5cecab4e15a01e643b03780b.tar.gz |
Initial checkin of reStructuredBlog.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@1431 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'sandbox/mly/restblog/restblog.py')
-rwxr-xr-x | sandbox/mly/restblog/restblog.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sandbox/mly/restblog/restblog.py b/sandbox/mly/restblog/restblog.py new file mode 100755 index 000000000..3c7862de5 --- /dev/null +++ b/sandbox/mly/restblog/restblog.py @@ -0,0 +1,32 @@ +#!/usr/bin/python -tt + +# restblog.py +# +# Base functions for reStructuredBlog +# +# (C) Magnus Lyckå, Thinkware AB, 2003 +import mx.DateTime, locale, os +locale.setlocale(locale.LC_ALL, 'C') # I want English month names etc +from docutils.core import publish_string, default_description + +source_pattern = 'blog*.txt' +timestamp_format = '%Y-%m-%d %H:%M' + +class Metadata: + def __init__(self, fn): + self.fn = fn + + def timestamp(self): + return mx.DateTime.localtime(os.stat(self.fn)[-2]) + + def subject(self): + return file(self.fn).readline().strip() + + def targetname(self): + return self.fn[:-3]+'html' + +def makepage(fn, text): + #text = ('<html><head><title>%s</title><head>\n' + # '<body>%s</body></html>') + #file(fn+'.html', 'w').write(text % (title, body)) + file(fn+'.html', 'w').write(publish_string(text, writer_name='html')) |