- From: Lachlan Hunt via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 05 Mar 2009 02:59:35 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html-author/utils In directory hutz:/tmp/cvs-serv31077/utils Modified Files: elements.py Log Message: Updated element summary script to include descriptions, added descriptions to element summaries in the draft Index: elements.py =================================================================== RCS file: /sources/public/html5/html-author/utils/elements.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- elements.py 1 Feb 2009 21:57:09 -0000 1.1 +++ elements.py 5 Mar 2009 02:59:33 -0000 1.2 @@ -6,6 +6,7 @@ # python elements.py > output.html import sys +import ConfigParser import html5lib from html5lib import treebuilders, treewalkers, serializer @@ -16,12 +17,16 @@ templateDocument = parser.parse(templateFile) template = templateDocument.getElementsByTagName("div")[0] +config = ConfigParser.RawConfigParser() +config.read("elementdesc.txt") + def findElementSummaries(headings): summaries = [] for h in headings: next = getNextSiblingElement(h) if next.hasAttribute("class") and next.getAttribute("class") == "element": - summaries.append({'h': h, 's': next}) + tagname = h.getElementsByTagName("code")[0].childNodes[0].data + summaries.append({'h': h, 'tagname': tagname, 's': next}) return summaries def getNextSiblingElement(element): @@ -59,6 +64,9 @@ h2 = markup.getElementsByTagName("h2")[0] h2.appendChild(createFragmentFromChildren(summary['h'])) + desc = markup.getElementsByTagName("p")[0] + desc.appendChild(summary['desc']) + contentTableRows = markup.getElementsByTagName("table")[0].getElementsByTagName("tr") contentTableRows[0].getElementsByTagName("td")[0].appendChild(markUpList(summary['categories'])) contentTableRows[1].getElementsByTagName("td")[0].appendChild(markUpList(summary['containedby'])) @@ -89,6 +97,7 @@ summary['contentmodel'] = getDescriptions(dt[2]) summary['attributes'] = getDescriptions(dt[3]) summary['dom'] = getDescriptions(dt[4]) + summary['desc'] = parser.parseFragment(config.get(summary['tagname'], 'desc')) markup = markUpSummary(summary) serialise(markup)
Received on Thursday, 5 March 2009 02:59:47 UTC