git.ucc.asn.au
/
planet-ucc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed CSS glitch
[planet-ucc.git]
/
XMLWriter.py
diff --git
a/XMLWriter.py
b/XMLWriter.py
index
8003189
..
38904dc
100644
(file)
--- a/
XMLWriter.py
+++ b/
XMLWriter.py
@@
-91,17
+91,17
@@
class XHTMLWriter:
def __write_item__(self, item):
output = ''
def __write_item__(self, item):
output = ''
- output += '<div
id
="item">\n'
+ output += '<div
class
="item">\n'
output += '<h2>%s: %s</h2>\n' % (item.blogTitle, item.itemTitle)
output += '<p class="time">\n'
if item.imageURL:
output += '<a class="image" href="%s"><img class="image" src="%s" alt="%s" /></a>\n' % (item.imageLink, item.imageURL, item.blogTitle)
output += '<h2>%s: %s</h2>\n' % (item.blogTitle, item.itemTitle)
output += '<p class="time">\n'
if item.imageURL:
output += '<a class="image" href="%s"><img class="image" src="%s" alt="%s" /></a>\n' % (item.imageLink, item.imageURL, item.blogTitle)
- output += '(<a href="%s">%s</a>)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M
%Z
', time.localtime(item.itemDate)))
+ output += '(<a href="%s">%s</a>)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M
AWST
', time.localtime(item.itemDate)))
output += '</p>\n'
output += '<p class="body">\n'
output += item.contents
output += '\n</p>\n'
output += '</p>\n'
output += '<p class="body">\n'
output += item.contents
output += '\n</p>\n'
- output += '</div>'
+ output += '</div>
\n
'
return output
def write(self):
return output
def write(self):
@@
-116,25
+116,31
@@
class XHTMLWriter:
output += '<link rel="icon" type="image/png" href="icon.png" />\n'
output += '</head>\n'
output += '<body>\n'
output += '<link rel="icon" type="image/png" href="icon.png" />\n'
output += '</head>\n'
output += '<body>\n'
- output += '<div
id
="header">\n'
+ output += '<div
class
="header">\n'
try:
output += open('header.html').read()
except:
pass
output += '</div>\n'
try:
output += open('header.html').read()
except:
pass
output += '</div>\n'
- output += '<div
id
="sidebar">\n'
+ output += '<div
class
="sidebar">\n'
try:
output += open('sidebar.html').read()
except:
pass
try:
output += open('sidebar.html').read()
except:
pass
+ output += '<h2>Last Updated</h2>\n'
+ output += '<p>\n'
+ output += '%s\n' % time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime())
+ output += '</p>\n'
if self.parent:
output += '<h2>Feeds</h2>\n'
output += '<p>\n'
if self.parent:
output += '<h2>Feeds</h2>\n'
output += '<p>\n'
- for blog in self.parent.blogs:
- output += '<a href="%s">%s</a><br />\n' % (blog.blogURL, blog.blogTitle)
+ blogscopy = self.parent.blogs + []
+ blogscopy.sort(self.__blog_sort__)
+ for blog in blogscopy:
+ output += '<a href="%s">%s</a> (<a href="%s">feed</a>)<br />\n' % (blog.blogURL, blog.blogTitle, blog.feedURL)
output += '</p>\n'
output += '</div>\n'
output += '</p>\n'
output += '</div>\n'
- output += '<div
id
="items">\n'
+ output += '<div
class
="items">\n'
for date in self.planet:
output += '<h1>%s</h1>\n' % time.strftime('%A %B %d, %Y', time.localtime(date.planetDate))
for item in date.items:
for date in self.planet:
output += '<h1>%s</h1>\n' % time.strftime('%A %B %d, %Y', time.localtime(date.planetDate))
for item in date.items:
@@
-147,11
+153,18
@@
class XHTMLWriter:
if itemcount >= self.maxitems:
break
output += '</div>\n'
if itemcount >= self.maxitems:
break
output += '</div>\n'
- output += '<div
id
="footer">\n'
+ output += '<div
class
="footer">\n'
try:
output += open('footer.html').read()
except:
pass
try:
output += open('footer.html').read()
except:
pass
+ output += '</div>\n'
output += '</body>\n'
output += '</html>'
return output
output += '</body>\n'
output += '</html>'
return output
+
+ def __blog_sort__(self, blog1, blog2):
+ name1, name2 = blog1.blogTitle.split(' ')[-1], blog2.blogTitle.split(' ')[-1]
+ if name1 < name2: return -1
+ if name1 == name2: return 0
+ if name1 > name2: return 1
UCC
git Repository :: git.ucc.asn.au