comparison env/lib/python3.9/site-packages/lxml/html/defs.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # FIXME: this should all be confirmed against what a DTD says
2 # (probably in a test; this may not match the DTD exactly, but we
3 # should document just how it differs).
4
5 """
6 Data taken from https://www.w3.org/TR/html401/index/elements.html
7 and https://www.w3.org/community/webed/wiki/HTML/New_HTML5_Elements
8 for html5_tags.
9 """
10
11 empty_tags = frozenset([
12 'area', 'base', 'basefont', 'br', 'col', 'frame', 'hr',
13 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track'])
14
15 deprecated_tags = frozenset([
16 'applet', 'basefont', 'center', 'dir', 'font', 'isindex',
17 'menu', 's', 'strike', 'u'])
18
19 # archive actually takes a space-separated list of URIs
20 link_attrs = frozenset([
21 'action', 'archive', 'background', 'cite', 'classid',
22 'codebase', 'data', 'href', 'longdesc', 'profile', 'src',
23 'usemap',
24 # Not standard:
25 'dynsrc', 'lowsrc',
26 # HTML5 formaction
27 'formaction'
28 ])
29
30 # Not in the HTML 4 spec:
31 # onerror, onresize
32 event_attrs = frozenset([
33 'onblur', 'onchange', 'onclick', 'ondblclick', 'onerror',
34 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload',
35 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover',
36 'onmouseup', 'onreset', 'onresize', 'onselect', 'onsubmit',
37 'onunload',
38 ])
39
40 safe_attrs = frozenset([
41 'abbr', 'accept', 'accept-charset', 'accesskey', 'action', 'align',
42 'alt', 'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff',
43 'charset', 'checked', 'cite', 'class', 'clear', 'cols', 'colspan',
44 'color', 'compact', 'coords', 'datetime', 'dir', 'disabled', 'enctype',
45 'for', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id',
46 'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'media', 'method',
47 'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt', 'readonly',
48 'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope', 'selected', 'shape',
49 'size', 'span', 'src', 'start', 'summary', 'tabindex', 'target', 'title',
50 'type', 'usemap', 'valign', 'value', 'vspace', 'width'])
51
52 # From http://htmlhelp.com/reference/html40/olist.html
53 top_level_tags = frozenset([
54 'html', 'head', 'body', 'frameset',
55 ])
56
57 head_tags = frozenset([
58 'base', 'isindex', 'link', 'meta', 'script', 'style', 'title',
59 ])
60
61 general_block_tags = frozenset([
62 'address',
63 'blockquote',
64 'center',
65 'del',
66 'div',
67 'h1',
68 'h2',
69 'h3',
70 'h4',
71 'h5',
72 'h6',
73 'hr',
74 'ins',
75 'isindex',
76 'noscript',
77 'p',
78 'pre',
79 ])
80
81 list_tags = frozenset([
82 'dir', 'dl', 'dt', 'dd', 'li', 'menu', 'ol', 'ul',
83 ])
84
85 table_tags = frozenset([
86 'table', 'caption', 'colgroup', 'col',
87 'thead', 'tfoot', 'tbody', 'tr', 'td', 'th',
88 ])
89
90 # just this one from
91 # http://www.georgehernandez.com/h/XComputers/HTML/2BlockLevel.htm
92 block_tags = general_block_tags | list_tags | table_tags | frozenset([
93 # Partial form tags
94 'fieldset', 'form', 'legend', 'optgroup', 'option',
95 ])
96
97 form_tags = frozenset([
98 'form', 'button', 'fieldset', 'legend', 'input', 'label',
99 'select', 'optgroup', 'option', 'textarea',
100 ])
101
102 special_inline_tags = frozenset([
103 'a', 'applet', 'basefont', 'bdo', 'br', 'embed', 'font', 'iframe',
104 'img', 'map', 'area', 'object', 'param', 'q', 'script',
105 'span', 'sub', 'sup',
106 ])
107
108 phrase_tags = frozenset([
109 'abbr', 'acronym', 'cite', 'code', 'del', 'dfn', 'em',
110 'ins', 'kbd', 'samp', 'strong', 'var',
111 ])
112
113 font_style_tags = frozenset([
114 'b', 'big', 'i', 's', 'small', 'strike', 'tt', 'u',
115 ])
116
117 frame_tags = frozenset([
118 'frameset', 'frame', 'noframes',
119 ])
120
121 html5_tags = frozenset([
122 'article', 'aside', 'audio', 'canvas', 'command', 'datalist',
123 'details', 'embed', 'figcaption', 'figure', 'footer', 'header',
124 'hgroup', 'keygen', 'mark', 'math', 'meter', 'nav', 'output',
125 'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary',
126 'svg', 'time', 'track', 'video', 'wbr'
127 ])
128
129 # These tags aren't standard
130 nonstandard_tags = frozenset(['blink', 'marquee'])
131
132
133 tags = (top_level_tags | head_tags | general_block_tags | list_tags
134 | table_tags | form_tags | special_inline_tags | phrase_tags
135 | font_style_tags | nonstandard_tags | html5_tags)