[Lxml-checkins] r42889 - in lxml/trunk/doc: . html

scoder at codespeak.net scoder at codespeak.net
Wed May 9 01:02:05 CEST 2007


Author: scoder
Date: Wed May  9 01:02:04 2007
New Revision: 42889

Modified:
   lxml/trunk/doc/html/style.css
   lxml/trunk/doc/mkhtml.py
Log:
formatting, timestamp in HTML files

Modified: lxml/trunk/doc/html/style.css
==============================================================================
--- lxml/trunk/doc/html/style.css	(original)
+++ lxml/trunk/doc/html/style.css	Wed May  9 01:02:04 2007
@@ -162,6 +162,11 @@
     text-decoration: underline;
 }
 
+p.timestamp {
+    text-align: right;
+    font-size: 70%;
+}
+
 p {
     /*margin: 0.5em 0em 1em 0em;*/
     text-align: justify;
@@ -169,6 +174,12 @@
     margin: 0.5em 0em 0em 0em;
 }
 
+th.docinfo-name {
+    padding-left: 3ex;
+    text-align: right;
+    font-weight: bold;
+}
+
 hr {
     clear: both;
     height: 1px;

Modified: lxml/trunk/doc/mkhtml.py
==============================================================================
--- lxml/trunk/doc/mkhtml.py	(original)
+++ lxml/trunk/doc/mkhtml.py	Wed May  9 01:02:04 2007
@@ -1,5 +1,5 @@
 from lxml.etree import parse, Element, SubElement, XPath
-import os, shutil, re, sys, copy
+import os, shutil, re, sys, copy, time
 
 SITE_STRUCTURE = [
     ('lxml', ('main.txt', 'intro.txt', 'FAQ.txt', 'compatibility.txt',
@@ -21,6 +21,8 @@
                             {"h" : "http://www.w3.org/1999/xhtml"})
 find_menu = XPath("//h:ul[@id=$name]",
                   {"h" : "http://www.w3.org/1999/xhtml"})
+find_page_end = XPath("/h:html/h:body/h:div[last()]",
+                      {"h" : "http://www.w3.org/1999/xhtml"})
 
 replace_invalid = re.compile(r'[-_/.\s\\]').sub
 
@@ -103,9 +105,15 @@
 
             build_menu(tree, basename, section, menu)
 
-    # integrate menu
+    # integrate menu and date
+    date = Element("{http://www.w3.org/1999/xhtml}p", {"class":"timestamp"})
+    date.text = "Page generated on " + time.strftime("%Y-%m-%d")
     for tree, basename, outpath in trees.itervalues():
         new_tree = merge_menu(tree, menu, basename)
+        div = find_page_end(new_tree)
+        if div:
+            div[-1].append(copy.deepcopy(date))
+                
         new_tree.write(outpath)
 
     # also convert INSTALL.txt and CHANGES.txt


More information about the lxml-checkins mailing list