- From: Lachlan Hunt via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 09 Mar 2009 16:11:14 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html-author/utils In directory hutz:/tmp/cvs-serv29116/utils Added Files: categories-template.html categories.py Log Message: Initial commit of categories script and template --- NEW FILE: categories-template.html --- <table> <thead> <tr> <th>Element</th> <th>Metadata Content</th> <th>Flow content</th> <th>Sectioning root</th> <th>Sectioning content</th> <th>Heading content</th> <th>Phrasing content</th> <th>Embedded content</th> <th>Interactive content</th> <th>Transparent Content Models</th> </tr> </thead> <tbody> <tr> <td><code></code></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> --- NEW FILE: categories.py --- # THIS SCRIPT IS INCOMPLETE import sys import ConfigParser import copy import html5lib from html5lib import treebuilders from lxml import etree parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder("lxml")) config = ConfigParser.RawConfigParser() config.read("elementdesc.txt") elements = config.sections() elements.sort() parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder("dom")) sourceFile = open("elements.html") templateFile = open("category-template.html") sourceDocument = parser.parse(sourceFile) template = parser.parseFragment(templateFile) table = template[0] tbody = table[1] rowTemplate = tbody[0] tbody.remove(rowTemplate) for element in elements: tr = copy.deepcopy(rowTemplate) tr[0][0].text = element tbody.append(tr) etree.ElementTree(table).write(sys.stdout) sys.stdout.write("\n")
Received on Monday, 9 March 2009 16:20:33 UTC