From a7ca2c33a85efa236ccfcbb64a5ffac0f712b3fd Mon Sep 17 00:00:00 2001 From: davyd Date: Sat, 7 Feb 2004 08:17:45 +0000 Subject: [PATCH] Improved XMLWriter Initial Upload of HTML formatting, etc. --- XMLWriter.py | 39 +++++++++++++++---- footer.html | 6 +++ planet.css | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++ sidebar.html | 6 +++ 4 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 footer.html create mode 100644 planet.css create mode 100644 sidebar.html diff --git a/XMLWriter.py b/XMLWriter.py index 267789c..8a443ba 100644 --- a/XMLWriter.py +++ b/XMLWriter.py @@ -72,10 +72,12 @@ class Planet: class XMLWriter: def __init__(self, doctype, bloglist): + self.blogs = bloglist self.planet = Planet(bloglist) self.items = self.planet.sort() # doctype should be something like XMLWriter.XHTMLWriter - self.writer = doctype(self.items) + self.writer = doctype(self.items) + self.writer.parent = self def write(self): output = self.writer.write() @@ -84,18 +86,22 @@ class XMLWriter: class XHTMLWriter: def __init__(self, planet): self.planet = planet - self.maxitems = 100 + self.maxitems = 50 + self.parent = None def __write_item__(self, item): output = '' output += '
\n' output += '

%s: %s

\n' % (item.blogTitle, item.itemTitle) output += '

\n' - output += '(%s)\n' % time.strftime('%A %B %d, %Y %H:%M %Z', time.localtime(item.itemDate)) + if item.imageURL: + output += '%s\n' % (item.imageLink, item.imageURL, item.blogTitle) + output += '(%s)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M %Z', time.localtime(item.itemDate))) output += '

\n' output += '

\n' output += item.contents output += '\n

\n' + output += '
' return output def write(self): @@ -106,10 +112,24 @@ class XHTMLWriter: output += '\n' output += '\n' output += 'Planet UCC\n' - # XXX: we'll want a style sheet in here + output += '\n' output += '\n' output += '\n' - # XXX: we want some stuff in here, I'm sure + output += '\n' + output += '\n' + output += '
\n' for date in self.planet: output += '

%s

\n' % time.strftime('%A %B %d, %Y', time.localtime(date.planetDate)) for item in date.items: @@ -121,7 +141,12 @@ class XHTMLWriter: # again, check to see if we've written the maximum number of items if itemcount >= self.maxitems: break - # XXX: we want further stuff here - output += '' + output += '
\n' + output += '