html5/html-author/utils categories-template.html,1.3,1.4 categories.py,1.2,1.3

Update of /sources/public/html5/html-author/utils
In directory hutz:/tmp/cvs-serv16716

Modified Files:
	categories-template.html categories.py 
Log Message:
Updates to the category template and script

Index: categories-template.html
===================================================================
RCS file: /sources/public/html5/html-author/utils/categories-template.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- categories-template.html	11 Mar 2009 15:22:43 -0000	1.3
+++ categories-template.html	13 Mar 2009 15:45:01 -0000	1.4
@@ -1,4 +1,4 @@
-<table>
+<table xmlns:py="http://genshi.edgewall.org/">
 	<col/>
 	<colgroup span="8"></colgroup>
 	<colgroup span="4"></colgroup>
@@ -24,22 +24,22 @@
 		</tr>
 	</thead>
 	<tbody>
-		<tr>
-			<td><code></code></td>
+		<tr py:for="category in categories">
+			<td><code>${category.tagname}</code></td>
 
-			<td></td>
-			<td></td>
-			<td></td>
-			<td></td>
-			<td></td>
-			<td></td>
-			<td></td>
-			<td></td>
+			<td>${category.metadata}</td>
+			<td>${category.flow}</td>
+			<td>${category.sectionroot}</td>
+			<td>${category.sectioncontent}</td>
+			<td>${category.heading}</td>
+			<td>${category.phrasing}</td>
+			<td>${category.embedded}</td>
+			<td>${category.interactive}</td>
 
-			<td></td>
-			<td></td>
-			<td></td>
-			<td></td>
+			<td>${category.listed}</td>
+			<td>${category.labelable}</td>
+			<td>${category.submittable}</td>
+			<td>${category.resetable}</td>
 		</tr>
 		</tbody>
 </table>

Index: categories.py
===================================================================
RCS file: /sources/public/html5/html-author/utils/categories.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- categories.py	11 Mar 2009 15:22:44 -0000	1.2
+++ categories.py	13 Mar 2009 15:45:01 -0000	1.3
@@ -21,25 +21,36 @@
 source = parser.parseFragment(sourceFile)
 template = parser.parseFragment(templateFile)
 
+def getCategoryLists(source):
+    categories = {}
+
+    for node in source:
+        if (node.tag != etree.Comment):
+            tagnames = node.xpath("h2/dfn/code")
+            catlist = node.xpath(".//table//tr[1]//li")
+            for tag in tagnames:
+                categories[tag.text] = catlist
+    return categories
+
+def getCategory(li):
+    if li.text == "None.":
+        return None
+    elif li.text == "":
+        return [li.xpath("span[last()]")[0].text, "Yes"]
+    else:
+        return [li.xpath("span[last()]")[0].text, li.text]
+
 table = template[0]
 tbody = table.find("tbody")
 
 rowTemplate = tbody[0]
 tbody.remove(rowTemplate)
 
-categories = {}
-
-for node in source:
-    if (node.tag != etree.Comment):
-        h2 = node.find("code")
-        print h2
-
-#for element in elements:
-#    tr = copy.deepcopy(rowTemplate)
-#    tr[0][0].text = element
-
+for element in elements:
+    tr = copy.deepcopy(rowTemplate)
+    tr[0][0].text = element
 
-#    tbody.append(tr)
+    tbody.append(tr)
 
 #etree.ElementTree(table).write(sys.stdout)
 sys.stdout.write("\n")

Received on Friday, 13 March 2009 15:45:19 UTC