- From: poot <cvsmail@w3.org>
- Date: Tue, 10 Mar 2009 01:21:53 +0900 (JST)
- To: public-html-diffs@w3.org
Initial commit of categories script and template
http://people.w3.org/mike/diffs/html5/html-author/utils/categories-template.1.1.html
http://dev.w3.org/html5/html-author/utils/categories-template.html
http://people.w3.org/mike/diffs/html5/html-author/utils/categories-template.diff.html
http://dev.w3.org/cvsweb/html5/html-author/utils/categories-template.html?r1=NONE&r2=1.1&f=h
<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:22:32 UTC