1.1 --- a/XSLTools/XMLCalendar.py Wed Feb 28 22:29:43 2007 +0000
1.2 +++ b/XSLTools/XMLCalendar.py Wed Feb 28 22:30:00 2007 +0000
1.3 @@ -1,7 +1,7 @@
1.4 #!/usr/bin/env python
1.5
1.6 """
1.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2005, 2007 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 Additional copyrights for the monthcalendar function:
1.11
1.12 @@ -62,6 +62,13 @@
1.13 # XML production functions.
1.14
1.15 def write_month_to_document(doc, root, year, month):
1.16 +
1.17 + """
1.18 + Write into the document 'doc' appending to the child elements of the 'root'
1.19 + element, inserting a month calendar based on the specified 'year' and
1.20 + 'month'.
1.21 + """
1.22 +
1.23 weeks = monthcalendar(year, month)
1.24 month_element = root.appendChild(doc.createElement("month"))
1.25
1.26 @@ -86,6 +93,8 @@
1.27 day_element.setAttribute("date", "%04d%02d%02d" % (year, month, number))
1.28 day_element.setAttribute("number", str(number))
1.29
1.30 + return month_element
1.31 +
1.32 def get_calendar_for_month(year, month):
1.33 doc = libxml2dom.createDocument(None, "calendar", None)
1.34 write_month_to_document(doc, doc.childNodes[-1], year, month)