utils/compare-template.html 1.1 Script and template for generating comp

Script and template for generating comparison table

http://people.w3.org/mike/diffs/html5/html-author/utils/compare-template.1.1.html

http://dev.w3.org/html5/html-author/utils/compare-template.html
http://people.w3.org/mike/diffs/html5/html-author/utils/compare-template.diff.html
http://dev.w3.org/cvsweb/html5/html-author/utils/compare-template.html?r1=NONE&r2=1.1&f=h

<table class="index">
 <thead>
  <tr>
   <th>Element</th>
   <th>HTML 4.01/XHTML 1.0</th>
   <th>HTML 5</th>
   <th>Short Description</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code></code></td>
   <td></td>
   <td></td>
   <td></td>
  </tr>
 </tbody>
</table>
--- NEW FILE: compare.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("compare-template.html")
template = parser.parseFragment(f)
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
    tr[1].text = config.get(element, "html4")
    tr[2].text = config.get(element, "status")
    tr[3].text = config.get(element, "meaning")
    tbody.append(tr)

etree.ElementTree(table).write(sys.stdout)
sys.stdout.write("\n")

--- NEW FILE: compare.html ---
<table class="index">
 <thead>
  <tr>
   <th>Element</th>
   <th>HTML 4.01/XHTML 1.0</th>
   <th>HTML 5</th>
   <th>Short Description</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code>a</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Hyperlink</td>
  </tr>
  <tr>
   <td><code>abbr</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Abbreviation</td>
  </tr>
  <tr>
   <td><code>acronym</code></td>
   <td>strict</td>
   <td>obsolete</td>
   <td>Acronym</td>
  </tr>
  <tr>
   <td><code>address</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Contact information</td>
  </tr>
  <tr>
   <td><code>applet</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td>Java applet</td>
  </tr>
  <tr>
   <td><code>area</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Image map region</td>
  </tr>
  <tr>
   <td><code>article</code></td>
   <td>none</td>
   <td>active</td>
   <td>Independent section</td>
  </tr>
  <tr>
   <td><code>aside</code></td>
   <td>none</td>
   <td>active</td>
   <td>Auxiliary section</td>
  </tr>
  <tr>
   <td><code>audio</code></td>
   <td>none</td>
   <td>active</td>
   <td>Audio stream</td>
  </tr>
  <tr>
   <td><code>b</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Bold text</td>
  </tr>
  <tr>
   <td><code>base</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Document base URI</td>
  </tr>
  <tr>
   <td><code>basefont</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td>Base font style</td>
  </tr>
  <tr>
   <td><code>bb</code></td>
   <td>none</td>
   <td>active</td>
   <td>Browser button</td>
  </tr>
  <tr>
   <td><code>bdo</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Bi-directional text override</td>
  </tr>
  <tr>
   <td><code>bgsound</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>big</code></td>
   <td>strict</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>blink</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>blockquote</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Long quotation</td>
  </tr>
  <tr>
   <td><code>body</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Main content</td>
  </tr>
  <tr>
   <td><code>br</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Line break</td>
  </tr>
  <tr>
   <td><code>button</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Push button control</td>
  </tr>
  <tr>
   <td><code>canvas</code></td>
   <td>none</td>
   <td>active</td>
   <td>Bitmap canvas</td>
  </tr>
  <tr>
   <td><code>caption</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table caption</td>
  </tr>
  <tr>
   <td><code>center</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>cite</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Citation</td>
  </tr>
  <tr>
   <td><code>code</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Code fragment</td>
  </tr>
  <tr>
   <td><code>col</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table column</td>
  </tr>
  <tr>
   <td><code>colgroup</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table column group</td>
  </tr>
  <tr>
   <td><code>command</code></td>
   <td>none</td>
   <td>active</td>
   <td>Command that a user can invoke</td>
  </tr>
  <tr>
   <td><code>datagrid</code></td>
   <td>none</td>
   <td>active</td>
   <td>Interactive tree, list or tabular data</td>
  </tr>
  <tr>
   <td><code>datalist</code></td>
   <td>none</td>
   <td>active</td>
   <td>Predefined control values</td>
  </tr>
  <tr>
   <td><code>dd</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Description description</td>
  </tr>
  <tr>
   <td><code>del</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Deletion</td>
  </tr>
  <tr>
   <td><code>details</code></td>
   <td>none</td>
   <td>active</td>
   <td>Additional information</td>
  </tr>
  <tr>
   <td><code>dfn</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Defining instance of a term</td>
  </tr>
  <tr>
   <td><code>dialog</code></td>
   <td>none</td>
   <td>active</td>
   <td>Conversation</td>
  </tr>
  <tr>
   <td><code>dir</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>div</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Generic division</td>
  </tr>
  <tr>
   <td><code>dl</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Description list</td>
  </tr>
  <tr>
   <td><code>dt</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Description term</td>
  </tr>
  <tr>
   <td><code>em</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Stress emphasis</td>
  </tr>
  <tr>
   <td><code>embed</code></td>
   <td>none</td>
   <td>active</td>
   <td>Embedded application</td>
  </tr>
  <tr>
   <td><code>fieldset</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Form control group</td>
  </tr>
  <tr>
   <td><code>figure</code></td>
   <td>none</td>
   <td>active</td>
   <td>A figure with a caption.</td>
  </tr>
  <tr>
   <td><code>font</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td>Font style</td>
  </tr>
  <tr>
   <td><code>footer</code></td>
   <td>none</td>
   <td>active</td>
   <td>Section footer</td>
  </tr>
  <tr>
   <td><code>form</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Form</td>
  </tr>
  <tr>
   <td><code>frame</code></td>
   <td>frameset</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>frameset</code></td>
   <td>frameset</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>h1</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Heading level 1</td>
  </tr>
  <tr>
   <td><code>h2</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Heading level 2</td>
  </tr>
  <tr>
   <td><code>h3</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Heading level 3</td>
  </tr>
  <tr>
   <td><code>h4</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Heading level 4</td>
  </tr>
  <tr>
   <td><code>h5</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Heading level 5</td>
  </tr>
  <tr>
   <td><code>h6</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Heading level 6</td>
  </tr>
  <tr>
   <td><code>head</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Document head</td>
  </tr>
  <tr>
   <td><code>header</code></td>
   <td>none</td>
   <td>active</td>
   <td>Section header</td>
  </tr>
  <tr>
   <td><code>hr</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Separator</td>
  </tr>
  <tr>
   <td><code>html</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Document root</td>
  </tr>
  <tr>
   <td><code>i</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Italic text</td>
  </tr>
  <tr>
   <td><code>iframe</code></td>
   <td>loose</td>
   <td>active</td>
   <td>Inline frame</td>
  </tr>
  <tr>
   <td><code>img</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Image</td>
  </tr>
  <tr>
   <td><code>input</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Form control</td>
  </tr>
  <tr>
   <td><code>ins</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Insertion</td>
  </tr>
  <tr>
   <td><code>isindex</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>kbd</code></td>
   <td>strict</td>
   <td>active</td>
   <td>User input</td>
  </tr>
  <tr>
   <td><code>label</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Form control label</td>
  </tr>
  <tr>
   <td><code>legend</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Explanatory title or caption</td>
  </tr>
  <tr>
   <td><code>li</code></td>
   <td>strict</td>
   <td>active</td>
   <td>List item</td>
  </tr>
  <tr>
   <td><code>link</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Link to resources</td>
  </tr>
  <tr>
   <td><code>listing</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td>Preformatted text</td>
  </tr>
  <tr>
   <td><code>map</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Client-side image map</td>
  </tr>
  <tr>
   <td><code>mark</code></td>
   <td>none</td>
   <td>active</td>
   <td>Marked or highlighted text</td>
  </tr>
  <tr>
   <td><code>marquee</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>menu</code></td>
   <td>loose</td>
   <td>active</td>
   <td>Command menu</td>
  </tr>
  <tr>
   <td><code>meta</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Metadata</td>
  </tr>
  <tr>
   <td><code>meter</code></td>
   <td>none</td>
   <td>active</td>
   <td>Scalar measurement</td>
  </tr>
  <tr>
   <td><code>nav</code></td>
   <td>none</td>
   <td>active</td>
   <td>Navigation</td>
  </tr>
  <tr>
   <td><code>nobr</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>noembed</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>noframes</code></td>
   <td>frameset</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>noscript</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Alternative content for no script support</td>
  </tr>
  <tr>
   <td><code>object</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Generic embedded resource</td>
  </tr>
  <tr>
   <td><code>ol</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Ordered list</td>
  </tr>
  <tr>
   <td><code>optgroup</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Option group</td>
  </tr>
  <tr>
   <td><code>option</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Selection choice</td>
  </tr>
  <tr>
   <td><code>output</code></td>
   <td>none</td>
   <td>active</td>
   <td>Output control</td>
  </tr>
  <tr>
   <td><code>p</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Paragraph</td>
  </tr>
  <tr>
   <td><code>param</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Plugin parameter</td>
  </tr>
  <tr>
   <td><code>plaintext</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td>Preformatted text</td>
  </tr>
  <tr>
   <td><code>pre</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Preformatted text</td>
  </tr>
  <tr>
   <td><code>progress</code></td>
   <td>none</td>
   <td>active</td>
   <td>Progress of a task</td>
  </tr>
  <tr>
   <td><code>q</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Inline quotation</td>
  </tr>
  <tr>
   <td><code>rp</code></td>
   <td>none</td>
   <td>active</td>
   <td>Ruby parenthesis</td>
  </tr>
  <tr>
   <td><code>rt</code></td>
   <td>none</td>
   <td>active</td>
   <td>Ruby text</td>
  </tr>
  <tr>
   <td><code>ruby</code></td>
   <td>none</td>
   <td>active</td>
   <td>Ruby annotation</td>
  </tr>
  <tr>
   <td><code>s</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>samp</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Sample output</td>
  </tr>
  <tr>
   <td><code>script</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Linked or embedded script</td>
  </tr>
  <tr>
   <td><code>section</code></td>
   <td>none</td>
   <td>active</td>
   <td>Document section</td>
  </tr>
  <tr>
   <td><code>select</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Selection control</td>
  </tr>
  <tr>
   <td><code>small</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Small print</td>
  </tr>
  <tr>
   <td><code>source</code></td>
   <td>none</td>
   <td>active</td>
   <td>Media resource</td>
  </tr>
  <tr>
   <td><code>spacer</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>span</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Generic inline container</td>
  </tr>
  <tr>
   <td><code>strike</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>strong</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Strong importance</td>
  </tr>
  <tr>
   <td><code>style</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Embedded stylesheet</td>
  </tr>
  <tr>
   <td><code>sub</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Subscript</td>
  </tr>
  <tr>
   <td><code>sup</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Superscript</td>
  </tr>
  <tr>
   <td><code>table</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table</td>
  </tr>
  <tr>
   <td><code>tbody</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table body</td>
  </tr>
  <tr>
   <td><code>td</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table cell</td>
  </tr>
  <tr>
   <td><code>textarea</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Multi-line text control</td>
  </tr>
  <tr>
   <td><code>tfoot</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table footer</td>
  </tr>
  <tr>
   <td><code>th</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table header cell</td>
  </tr>
  <tr>
   <td><code>thead</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table head</td>
  </tr>
  <tr>
   <td><code>time</code></td>
   <td>none</td>
   <td>active</td>
   <td>Date and/or time</td>
  </tr>
  <tr>
   <td><code>title</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Document title</td>
  </tr>
  <tr>
   <td><code>tr</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Table row</td>
  </tr>
  <tr>
   <td><code>u</code></td>
   <td>loose</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>ul</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Unordered list</td>
  </tr>
  <tr>
   <td><code>var</code></td>
   <td>strict</td>
   <td>active</td>
   <td>Variable</td>
  </tr>
  <tr>
   <td><code>video</code></td>
   <td>none</td>
   <td>active</td>
   <td>Video or movie</td>
  </tr>
  <tr>
   <td><code>wbr</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td></td>
  </tr>
  <tr>
   <td><code>xmp</code></td>
   <td>none</td>
   <td>obsolete</td>
   <td>Preformatted text</td>
  </tr>
 </tbody>
</table>

Received on Monday, 9 March 2009 14:18:16 UTC