- From: poot <cvsmail@w3.org>
- Date: Thu, 5 Mar 2009 09:26:35 +0900 (JST)
- To: public-html-diffs@w3.org
Script and template for element index http://people.w3.org/mike/diffs/html5/html-author/utils/indexelements-template.1.1.html http://dev.w3.org/html5/html-author/utils/indexelements-template.html http://people.w3.org/mike/diffs/html5/html-author/utils/indexelements-template.diff.html http://dev.w3.org/cvsweb/html5/html-author/utils/indexelements-template.html?r1=NONE&r2=1.1&f=h <table> <thead> <tr> <th>Element</th> <th>Start Tag</th> <th>End Tag</th> <th>Short Description</th> <th>Notes</th> </tr> </thead> <tbody> <tr> <td><code></code></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> --- NEW FILE: indexelements.py --- 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() f = open("indexelements-template.html") template = parser.parseFragment(f) activeTable = template[0] activeTbody = activeTable[1] rowTemplate = activeTbody[0] activeTbody.remove(rowTemplate) obsoleteTable = copy.deepcopy(activeTable) obsoleteTbody = obsoleteTable[1] for element in elements: tr = copy.deepcopy(rowTemplate) tr[0][0].text = element tr[1].text = config.get(element, "start") tr[2].text = config.get(element, "end") tr[3].text = config.get(element, "meaning") if(config.has_option(element, "notes")): notes = parser.parseFragment(config.get(element, "notes"), "div") for node in notes: if (etree.iselement(node)): tr[4].append(node) else: tr[4].text = node if (config.get(element, "status") == "active"): activeTbody.append(tr) else: obsoleteTbody.append(tr) etree.ElementTree(activeTable).write(sys.stdout) sys.stdout.write("\n\n") etree.ElementTree(obsoleteTable).write(sys.stdout) --- NEW FILE: indexelements.html --- <table> <thead> <tr> <th>Element</th> <th>Start Tag</th> <th>End Tag</th> <th>Short Description</th> <th>Notes</th> </tr> </thead> <tbody> <tr> <td><code>a</code></td> <td>required</td> <td>required</td> <td>Hyperlink</td> <td/> </tr> <tr> <td><code>abbr</code></td> <td>required</td> <td>required</td> <td>Abbreviation</td> <td/> </tr> <tr> <td><code>address</code></td> <td>required</td> <td>required</td> <td>Contact information</td> <td/> </tr> <tr> <td><code>area</code></td> <td>required</td> <td>empty</td> <td>Image map region</td> <td/> </tr> <tr> <td><code>article</code></td> <td>required</td> <td>required</td> <td>Independent section</td> <td/> </tr> <tr> <td><code>aside</code></td> <td>required</td> <td>required</td> <td>Auxiliary section</td> <td/> </tr> <tr> <td><code>audio</code></td> <td>required</td> <td>required</td> <td>Audio stream</td> <td/> </tr> <tr> <td><code>b</code></td> <td>required</td> <td>required</td> <td>Bold text</td> <td/> </tr> <tr> <td><code>base</code></td> <td>required</td> <td>empty</td> <td>Document base URI</td> <td/> </tr> <tr> <td><code>bb</code></td> <td>required</td> <td>required</td> <td>Browser button</td> <td/> </tr> <tr> <td><code>bdo</code></td> <td>required</td> <td>required</td> <td>Bi-directional text override</td> <td/> </tr> <tr> <td><code>blockquote</code></td> <td>required</td> <td>required</td> <td>Long quotation</td> <td/> </tr> <tr> <td><code>body</code></td> <td>optional</td> <td>optional</td> <td>Main content</td> <td/> </tr> <tr> <td><code>br</code></td> <td>required</td> <td>empty</td> <td>Line break</td> <td/> </tr> <tr> <td><code>button</code></td> <td>required</td> <td>required</td> <td>Push button control</td> <td/> </tr> <tr> <td><code>canvas</code></td> <td>required</td> <td>required</td> <td>Bitmap canvas</td> <td/> </tr> <tr> <td><code>caption</code></td> <td>required</td> <td>required</td> <td>Table caption</td> <td/> </tr> <tr> <td><code>cite</code></td> <td>required</td> <td>required</td> <td>Citation</td> <td/> </tr> <tr> <td><code>code</code></td> <td>required</td> <td>required</td> <td>Code fragment</td> <td/> </tr> <tr> <td><code>col</code></td> <td>required</td> <td>empty</td> <td>Table column</td> <td/> </tr> <tr> <td><code>colgroup</code></td> <td>required</td> <td>optional</td> <td>Table column group</td> <td/> </tr> <tr> <td><code>command</code></td> <td>required</td> <td>empty</td> <td>Command that a user can invoke</td> <td/> </tr> <tr> <td><code>datagrid</code></td> <td>required</td> <td>required</td> <td>Interactive tree, list or tabular data</td> <td/> </tr> <tr> <td><code>datalist</code></td> <td>required</td> <td>required</td> <td>Predefined control values</td> <td/> </tr> <tr> <td><code>dd</code></td> <td>required</td> <td>optional</td> <td>Description description</td> <td/> </tr> <tr> <td><code>del</code></td> <td>required</td> <td>required</td> <td>Deletion</td> <td/> </tr> <tr> <td><code>details</code></td> <td>required</td> <td>required</td> <td>Additional information</td> <td/> </tr> <tr> <td><code>dfn</code></td> <td>required</td> <td>required</td> <td>Defining instance of a term</td> <td/> </tr> <tr> <td><code>dialog</code></td> <td>required</td> <td>required</td> <td>Conversation</td> <td/> </tr> <tr> <td><code>div</code></td> <td>required</td> <td>required</td> <td>Generic division</td> <td/> </tr> <tr> <td><code>dl</code></td> <td>required</td> <td>required</td> <td>Description list</td> <td/> </tr> <tr> <td><code>dt</code></td> <td>required</td> <td>optional</td> <td>Description term</td> <td/> </tr> <tr> <td><code>em</code></td> <td>required</td> <td>required</td> <td>Stress emphasis</td> <td/> </tr> <tr> <td><code>embed</code></td> <td>required</td> <td>empty</td> <td>Embedded application</td> <td/> </tr> <tr> <td><code>fieldset</code></td> <td>required</td> <td>required</td> <td>Form control group</td> <td/> </tr> <tr> <td><code>figure</code></td> <td>required</td> <td>required</td> <td>A figure with a caption.</td> <td/> </tr> <tr> <td><code>footer</code></td> <td>required</td> <td>required</td> <td>Section footer</td> <td/> </tr> <tr> <td><code>form</code></td> <td>required</td> <td>required</td> <td>Form</td> <td/> </tr> <tr> <td><code>h1</code></td> <td>required</td> <td>required</td> <td>Heading level 1</td> <td>The heading level is also affected by sectioning elements</td> </tr> <tr> <td><code>h2</code></td> <td>required</td> <td>required</td> <td>Heading level 2</td> <td/> </tr> <tr> <td><code>h3</code></td> <td>required</td> <td>required</td> <td>Heading level 3</td> <td/> </tr> <tr> <td><code>h4</code></td> <td>required</td> <td>required</td> <td>Heading level 4</td> <td/> </tr> <tr> <td><code>h5</code></td> <td>required</td> <td>required</td> <td>Heading level 5</td> <td/> </tr> <tr> <td><code>h6</code></td> <td>required</td> <td>required</td> <td>Heading level 6</td> <td/> </tr> <tr> <td><code>head</code></td> <td>optional</td> <td>optional</td> <td>Document head</td> <td/> </tr> <tr> <td><code>header</code></td> <td>required</td> <td>required</td> <td>Section header</td> <td/> </tr> <tr> <td><code>hr</code></td> <td>required</td> <td>empty</td> <td>Separator</td> <td/> </tr> <tr> <td><code>html</code></td> <td>optional</td> <td>optional</td> <td>Document root</td> <td/> </tr> <tr> <td><code>i</code></td> <td>required</td> <td>required</td> <td>Italic text</td> <td/> </tr> <tr> <td><code>iframe</code></td> <td>required</td> <td>required</td> <td>Inline frame</td> <td/> </tr> <tr> <td><code>img</code></td> <td>required</td> <td>empty</td> <td>Image</td> <td/> </tr> <tr> <td><code>input</code></td> <td>required</td> <td>empty</td> <td>Form control</td> <td/> </tr> <tr> <td><code>ins</code></td> <td>required</td> <td>required</td> <td>Insertion</td> <td/> </tr> <tr> <td><code>kbd</code></td> <td>required</td> <td>required</td> <td>User input</td> <td/> </tr> <tr> <td><code>label</code></td> <td>required</td> <td>required</td> <td>Form control label</td> <td/> </tr> <tr> <td><code>legend</code></td> <td>required</td> <td>required</td> <td>Explanatory title or caption</td> <td/> </tr> <tr> <td><code>li</code></td> <td>required</td> <td>optional</td> <td>List item</td> <td/> </tr> <tr> <td><code>link</code></td> <td>required</td> <td>empty</td> <td>Link to resources</td> <td/> </tr> <tr> <td><code>map</code></td> <td>required</td> <td>required</td> <td>Client-side image map</td> <td/> </tr> <tr> <td><code>mark</code></td> <td>required</td> <td>required</td> <td>Marked or highlighted text</td> <td/> </tr> <tr> <td><code>menu</code></td> <td>required</td> <td>required</td> <td>Command menu</td> <td/> </tr> <tr> <td><code>meta</code></td> <td>required</td> <td>empty</td> <td>Metadata</td> <td/> </tr> <tr> <td><code>meter</code></td> <td>required</td> <td>required</td> <td>Scalar measurement</td> <td/> </tr> <tr> <td><code>nav</code></td> <td>required</td> <td>required</td> <td>Navigation</td> <td/> </tr> <tr> <td><code>noscript</code></td> <td>required</td> <td>required</td> <td>Alternative content for no script support</td> <td/> </tr> <tr> <td><code>object</code></td> <td>required</td> <td>required</td> <td>Generic embedded resource</td> <td/> </tr> <tr> <td><code>ol</code></td> <td>required</td> <td>required</td> <td>Ordered list</td> <td/> </tr> <tr> <td><code>optgroup</code></td> <td>required</td> <td>optional</td> <td>Option group</td> <td/> </tr> <tr> <td><code>option</code></td> <td>required</td> <td>optional</td> <td>Selection choice</td> <td/> </tr> <tr> <td><code>output</code></td> <td>required</td> <td>required</td> <td>Output control</td> <td/> </tr> <tr> <td><code>p</code></td> <td>required</td> <td>optional</td> <td>Paragraph</td> <td/> </tr> <tr> <td><code>param</code></td> <td>required</td> <td>empty</td> <td>Plugin parameter</td> <td/> </tr> <tr> <td><code>pre</code></td> <td>required</td> <td>required</td> <td>Preformatted text</td> <td/> </tr> <tr> <td><code>progress</code></td> <td>required</td> <td>required</td> <td>Progress of a task</td> <td/> </tr> <tr> <td><code>q</code></td> <td>required</td> <td>required</td> <td>Inline quotation</td> <td/> </tr> <tr> <td><code>rp</code></td> <td>required</td> <td>required</td> <td>Ruby parenthesis</td> <td/> </tr> <tr> <td><code>rt</code></td> <td>required</td> <td>required</td> <td>Ruby text</td> <td/> </tr> <tr> <td><code>ruby</code></td> <td>required</td> <td>required</td> <td>Ruby annotation</td> <td/> </tr> <tr> <td><code>samp</code></td> <td>required</td> <td>required</td> <td>Sample output</td> <td/> </tr> <tr> <td><code>script</code></td> <td>required</td> <td>required</td> <td>Linked or embedded script</td> <td/> </tr> <tr> <td><code>section</code></td> <td>required</td> <td>required</td> <td>Document section</td> <td/> </tr> <tr> <td><code>select</code></td> <td>required</td> <td>required</td> <td>Selection control</td> <td/> </tr> <tr> <td><code>small</code></td> <td>required</td> <td>required</td> <td>Small print</td> <td/> </tr> <tr> <td><code>source</code></td> <td>required</td> <td>empty</td> <td>Media resource</td> <td/> </tr> <tr> <td><code>span</code></td> <td>required</td> <td>required</td> <td>Generic inline container</td> <td/> </tr> <tr> <td><code>strong</code></td> <td>required</td> <td>required</td> <td>Strong importance</td> <td/> </tr> <tr> <td><code>style</code></td> <td>required</td> <td>required</td> <td>Embedded stylesheet</td> <td/> </tr> <tr> <td><code>sub</code></td> <td>required</td> <td>required</td> <td>Subscript</td> <td/> </tr> <tr> <td><code>sup</code></td> <td>required</td> <td>required</td> <td>Superscript</td> <td/> </tr> <tr> <td><code>table</code></td> <td>required</td> <td>required</td> <td>Table</td> <td/> </tr> <tr> <td><code>tbody</code></td> <td>optional</td> <td>optional</td> <td>Table body</td> <td/> </tr> <tr> <td><code>td</code></td> <td>required</td> <td>optional</td> <td>Table cell</td> <td/> </tr> <tr> <td><code>textarea</code></td> <td>required</td> <td>required</td> <td>Multi-line text control</td> <td/> </tr> <tr> <td><code>tfoot</code></td> <td>optional</td> <td>optional</td> <td>Table footer</td> <td/> </tr> <tr> <td><code>th</code></td> <td>required</td> <td>optional</td> <td>Table header cell</td> <td/> </tr> <tr> <td><code>thead</code></td> <td>optional</td> <td>optional</td> <td>Table head</td> <td/> </tr> <tr> <td><code>time</code></td> <td>required</td> <td>required</td> <td>Date and/or time</td> <td/> </tr> <tr> <td><code>title</code></td> <td>required</td> <td>required</td> <td>Document title</td> <td/> </tr> <tr> <td><code>tr</code></td> <td>required</td> <td>optional</td> <td>Table row</td> <td/> </tr> <tr> <td><code>ul</code></td> <td>required</td> <td>required</td> <td>Unordered list</td> <td/> </tr> <tr> <td><code>var</code></td> <td>required</td> <td>required</td> <td>Variable</td> <td/> </tr> <tr> <td><code>video</code></td> <td>required</td> <td>required</td> <td>Video or movie</td> <td/> </tr> </tbody> </table> <table> <thead> <tr> <th>Element</th> <th>Start Tag</th> <th>End Tag</th> <th>Short Description</th> <th>Notes</th> </tr> </thead> <tbody> <tr> <td><code>acronym</code></td> <td>required</td> <td>required</td> <td>Acronym</td> <td>Use the <code>abbr</code> element</td> </tr> <tr> <td><code>font</code></td> <td>required</td> <td>required</td> <td>Font style</td> <td>Use a semantically appropriate element with CSS for style</td> </tr> <tr> <td><code>listing</code></td> <td>required</td> <td>required</td> <td>Preformatted text</td> <td>Use the <code>pre</code> element</td> </tr> <tr> <td><code>plaintext</code></td> <td>required</td> <td>required</td> <td>Preformatted text</td> <td>Use the <code>pre</code> element</td> </tr> <tr> <td><code>xmp</code></td> <td>required</td> <td>required</td> <td>Preformatted text</td> <td>Use the <code>pre</code> element</td> </tr> </tbody> </table>
Received on Thursday, 5 March 2009 00:27:15 UTC