reparcs 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,175 @@
1
+ include Base
2
+
3
+ #XHTML presentation elements
4
+ module PresentationElements
5
+
6
+ #A Bold element '<b></b>'
7
+ class Bold < ContainerElement
8
+ #Create a new Bold element, takes an optional hash of
9
+ #attributes as parameter.
10
+ def initialize(attrs={})
11
+ aattrs = [
12
+ "class", "id", "title", "dir", "xml:lang",
13
+ "onclick", "ondblclick", "onkeydown",
14
+ "onkeypress", "onkeyup", "onmousedown",
15
+ "onmousemove", "onmouseout", "onmouseover",
16
+ "onmouseup", "style"
17
+ ]
18
+ child = [
19
+ "a", "abbr", "acronym", "b" ,"bdo", "big",
20
+ "br", "button", "cite", "code", "del", "dfn",
21
+ "em" ,"i", "img", "input", "ins", "kbd",
22
+ "label", "map", "object", "q", "samp", "script",
23
+ "select", "small", "span", "strong", "sub", "sup",
24
+ "textarea", "tt", "var"
25
+ ]
26
+ super("b", aattrs, childs, attrs)
27
+ @start_element = "<b"
28
+ @end_element = "</b>"
29
+ end
30
+ end
31
+
32
+ #A Big element '<big></big>'
33
+ class Big < ContainerElement
34
+ #Creates a new Big element, takes an optional hash
35
+ #of attributes as parameter.
36
+ def initialize(attrs={})
37
+ aattrs = [
38
+ "class", "id", "title", "dir", "xml:lang",
39
+ "onclick", "ondblclick", "onkeydown",
40
+ "onkeypress", "onkeyup", "onmousedown",
41
+ "onmousemove", "onmouseout", "onmouseover",
42
+ "onmouseup", "style"
43
+ ]
44
+ childs = [
45
+ "a", "abbr", "acronym", "b", "bdo", "big",
46
+ "br", "button", "cite", "code", "del", "dfn",
47
+ "em" ,"i", "img", "input", "ins", "kbd", "label",
48
+ "map", "object", "q", "samp", "script", "selet",
49
+ "small", "span", "strong", "sub", "sup", "textarea",
50
+ "tt", "var"
51
+ ]
52
+ super("big", aattrs, childs, attrs)
53
+ @start_element = "<big"
54
+ @end_element = "</big>"
55
+ end
56
+ end
57
+
58
+ #A horizontal rule element.
59
+ class HorizontalRule < Element
60
+ #Creates a new HorizontalRule element, takes an optional hash
61
+ #of attributes as parameter.
62
+ def initialize(attrs={})
63
+ aattrs = [
64
+ "class", "id", "title", "dir", "xml:lang",
65
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
66
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
67
+ "onmouseover", "onmouseup"
68
+ ]
69
+ super("hr", aattrs, attrs)
70
+ @start_element = "<hr"
71
+ @end_element = " />"
72
+ end
73
+ end
74
+
75
+ #A Italic element.
76
+ class Italic < ContainerElement
77
+ #Creates a new italic element, takes an optional hash
78
+ #of attributes as parameter.
79
+ def initialize(attrs={})
80
+ aattrs = [
81
+ "class", "id", "title", "dir", "xml:lang",
82
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
83
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
84
+ "onmouseover", "onmouseup"
85
+ ]
86
+ childs = [
87
+ "a", "abbr", "acronym", "address", "b", "bdo",
88
+ "big", "br", "button", "cite", "code", "del",
89
+ "dfn", "em" ,"i", "img", "input", "ins", "kbd",
90
+ "label", "map", "object", "q", "samp", "script",
91
+ "select", "small" ,"span", "strong", "sub",
92
+ "sup", "textarea", "tt", "var"
93
+ ]
94
+ super("i", aattrs, childs, attrs)
95
+ @start_element = "<i"
96
+ @end_element = "</i>"
97
+ end
98
+ end
99
+
100
+ #A small element
101
+ class Small < ContainerElement
102
+ #Creates a new small element, takes an optional hash
103
+ #of attributes as parameter.
104
+ def initialize(attrs={})
105
+ aattrs = [
106
+ "class", "id", "title", "dir", "xml:lang",
107
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
108
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
109
+ "onmouseover", "onmouseup", "style"
110
+ ]
111
+ childs = [
112
+ "a", "abbr", "acronym", "b", "bdo", "big",
113
+ "br", "button", "cite", "code", "del", "dfn",
114
+ "em", "i", "img", "input", "ins", "kbd", "label",
115
+ "map", "noscript", "object", "q", "samp", "script",
116
+ "select", "small", "span", "strong", "sub",
117
+ "sup", "textarea", "tt", "var"
118
+ ]
119
+ super("small", aattrs, childs, attrs)
120
+ @start_element = "<small"
121
+ @end_element = "</small>"
122
+ end
123
+ end
124
+
125
+ #A subscript element
126
+ class Subscript < ContainerElement
127
+ #Creates a new Subscript element, takes an optional hash
128
+ #of attributes as parameter.
129
+ def initialize(attrs={})
130
+ aattrs = [
131
+ "class", "id", "title", "dir", "xml:lang",
132
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
133
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
134
+ "onmouseover", "onmouseup", "style"
135
+ ]
136
+ childs = [
137
+ "a", "abbr", "acronym", "b", "bdo", "big",
138
+ "br", "button", "cite", "code", "del",
139
+ "dfn", "em", "i", "img", "input", "ins",
140
+ "kbd", "label", "map", "noscript", "object",
141
+ "q", "samp", "script", "select", "small",
142
+ "span", "strong", "sub", "sup", "textarea",
143
+ "tt", "var"
144
+ ]
145
+ super("sub", aattrs, childs, attrs)
146
+ @start_element = "<sub"
147
+ @end_element = "</sub>"
148
+ end
149
+ end
150
+
151
+ #A Teletype element
152
+ class Teletype < ContainerElement
153
+ #Creates a new teletype element, takes an optional hash
154
+ #of attributes as parameter.
155
+ def initialize(attrs={})
156
+ aattrs = [
157
+ "class", "id", "title", "dir", "xml:lang",
158
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
159
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
160
+ "onmouseover", "onmouseup", "style"
161
+ ]
162
+ childs = [
163
+ "a", "abbr", "acronym", "b", "bdo", "big", "br", "button",
164
+ "cite", "code", "del", "dfn", "em", "i", "img", "input",
165
+ "ins", "kbd", "label", "map", "noscript", "object", "q",
166
+ "samp", "script", "select", "small", "span", "strong",
167
+ "sub", "sup", "textarea", "tt", "var"
168
+ ]
169
+ super("tt", aattrs, childs, attrs)
170
+ @start_element = "<tt"
171
+ @end_element = "</tt>"
172
+ end
173
+ end
174
+
175
+ end
@@ -0,0 +1,41 @@
1
+ include Base
2
+
3
+ #XHTML scripting elements.
4
+ module ScriptingElements
5
+
6
+ #A no script element '<noscript></noscript>'
7
+ class NoScript < ContainerElement
8
+ #Creates a new NoScript element, takes an optional
9
+ #hash of attributes as parameter.
10
+ def initialize(attrs={})
11
+ aattrs = [
12
+ "class", "id", "title", "dir", "xml:lang",
13
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
14
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
15
+ "onmouseover", "onmouseup", "style"
16
+ ]
17
+ childs = [
18
+ "address", "blockquote", "del", "dfn", "div", "dl",
19
+ "fieldset", "form", "h1", "h2", "h3", "h4", "h5", "h6",
20
+ "hr", "ins", "noscript", "ol", "p", "pre", "script",
21
+ "table", "ul"
22
+ ]
23
+ super("noscript", aattrs, childs, attrs)
24
+ @start_element = "<noscript"
25
+ @end_element = "</noscript>"
26
+ end
27
+ end
28
+
29
+ #A script element '<script></script>'
30
+ class Script < ContainerElement
31
+ #Creates a new Script element, takes an optional
32
+ #hash of attributes as parameter.
33
+ def initialize(attrs={})
34
+ aattrs = ["id", "charset", "defer", "src", "type"]
35
+ super("script", aattrs, [], attrs)
36
+ @start_element = "<script"
37
+ @end_element = "</script>"
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,62 @@
1
+ include Base
2
+
3
+ #XHTML structure elements
4
+ module StructureElements
5
+
6
+ #A body element '<body></body>'
7
+ #Use: define a documents body, when you create a new 'Page'
8
+ # object a body element is automatically added for you,
9
+ # you can access it via page_obj.body
10
+ class Body < ContainerElement
11
+ #Create a new body element, takes a optional hash of attributes as parameter
12
+ def initialize(attrs={})
13
+ aattrs = [
14
+ "class","id","title",
15
+ "dir","xml:lang","onclick",
16
+ "ondblclick","onkeydown",
17
+ "onkeypress","onkeyup",
18
+ "onload","onmousedown",
19
+ "onmousemove","onmouseout",
20
+ "onmouseover","onmouseup",
21
+ "onunload"
22
+ ]
23
+ childs = [
24
+ "address", "blockquote", "del",
25
+ "div", "fieldset", "form", "hr",
26
+ "ins", "noscript", "p", "pre",
27
+ "script", "table", "h1", "h2", "h3",
28
+ "h4", "h5", "h6", "dl", "ol", "ul"
29
+ ]
30
+ super("body", aattrs, childs, attrs)
31
+ @start_element = "<body"
32
+ @end_element = "</body>"
33
+ end
34
+ end
35
+
36
+ #A head element '<head></head>'
37
+ #Use: Define a documents head, when you create a
38
+ # 'Page' object a head element is automatically
39
+ # added for you, you can access it via pageO_obj.head
40
+ class Head < ContainerElement
41
+ #Create a new head element, takes a optional hash of attributes as parameter
42
+ def initialize
43
+ attrs = ["id", "dir", "xml:lang", "profile"]
44
+ childs = ["base", "link", "meta", "object", "script", "style", "title"]
45
+ super("head", attrs, childs)
46
+ @start_element = "<head"
47
+ @end_element = "</head>"
48
+ end
49
+ end
50
+
51
+ #A title element '<title></title>'
52
+ #Use: Define a documents title
53
+ class Title < ContainerElement
54
+ #Create a new title element, takes a optional hash of attributes as paramater
55
+ def initialize
56
+ super("title")
57
+ @start_element = "<title"
58
+ @end_element = "</title>"
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,18 @@
1
+ include Base
2
+
3
+ #XHTML stylesheet elements.
4
+ module StylesheetElements
5
+
6
+ #A style element '<style></style>'
7
+ class Style < ContainerElement
8
+ #Creates a new Style element, takes an optional
9
+ #hash of attributes as parameter.
10
+ def initialize(attrs={})
11
+ aattrs = ["id", "title", "dir", "xml:lang", "media", "type"]
12
+ super("style", aattrs, [], attrs)
13
+ @start_element = "<style"
14
+ @end_element = "</style>"
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,217 @@
1
+ include Base
2
+
3
+ #XHTML table elements
4
+ module TableElements
5
+
6
+ #A table Caption element.
7
+ class TableCaption < ContainerElement
8
+ #Creates a new TableCaption element, takes an optional
9
+ #hash of attributes as parameter.
10
+ def initialize(attrs={})
11
+ aattrs = [
12
+ "class", "id", "title", "dir", "xml:lang",
13
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
14
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
15
+ "onmouseover", "onmouseup", "style", "charset", "hreflang"
16
+ ]
17
+ childs = [
18
+ "a", "abbr", "acronym", "b", "bdo", "big", "br", "button",
19
+ "cite", "code","del", "dfn", "em", "i", "img", "input",
20
+ "ins", "kbd", "label", "map", "object", "q", "samp", "script",
21
+ "select", "small", "span", "strong", "sub", "sup", "textarea",
22
+ "tt", "var"
23
+ ]
24
+ super("caption", aattrs, childs, attrs)
25
+ @start_element = "<caption"
26
+ @end_element = "</caption>"
27
+ end
28
+ end
29
+
30
+ #A TableColumn element '<col></col>'
31
+ class TableColumn < ContainerElement
32
+ #Creates a new Column element, takes an optional
33
+ #hash of attributes as parameter.
34
+ def initialize(attrs={})
35
+ aattrs = [
36
+ "class", "id", "title", "dir", "xml:lang",
37
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
38
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
39
+ "onmouseover", "onmouseup", "align", "char", "charoff",
40
+ "span", "valign", "width"
41
+ ]
42
+ super("col", aattrs, [], attrs)
43
+ @start_element = "<col"
44
+ @end_element = "</col>"
45
+ end
46
+ end
47
+
48
+ #A Table Column group element '<colgroup></colgroup>'
49
+ class TableColumnGroup < ContainerElement
50
+ #Creates a new Column group element, takes an optional
51
+ #hash of attributes as parameter.
52
+ def initialize(attrs={})
53
+ aattrs = [
54
+ "class", "id", "title", "dir", "xml:lang",
55
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
56
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
57
+ "onmouseover", "onmouseup", "align", "char", "charoff",
58
+ "span", "charset", "hreflang"
59
+ ]
60
+ super("colgroup", aattrs, ["col"], attrs)
61
+ @start_element = "<colgroup"
62
+ @end_element = "</colgroup>"
63
+ end
64
+ end
65
+
66
+ #A table element '<table></table>'
67
+ class Table < ContainerElement
68
+ #Creates a new Table element, takes an optional hash
69
+ #of attributes as parameter.
70
+ def initialize(attrs={})
71
+ aattrs = [
72
+ "class", "id", "title", "dir", "xml:lang",
73
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
74
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
75
+ "onmouseover", "onmouseup", "style", "border",
76
+ "cellpadding", "cellspacing", "frame", "rules",
77
+ "summary", "width"
78
+ ]
79
+ childs = [
80
+ "caption", "col", "colgroup", "tbody",
81
+ "tfoot", "thead", "tr"
82
+ ]
83
+ super("table", aattrs, childs, attrs)
84
+ @start_element = "<table"
85
+ @end_element = "</table>"
86
+ end
87
+ end
88
+
89
+ #A table body element '<tbody></tbody>'
90
+ class TableBody < ContainerElement
91
+ #Creates a new TableBody element, takes an optional
92
+ #hash of attributes as parameters.
93
+ def initialize(attrs={})
94
+ aattrs = [
95
+ "class", "id", "title", "dir", "xml:lang",
96
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
97
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
98
+ "onmouseover", "onmouseup", "style", "charset", "hreflang",
99
+ "align", "char", "charoff", "valign"
100
+ ]
101
+ super("tbody", aattrs, ["tr"], attrs)
102
+ @start_element = "<tbody"
103
+ @end_element = "</tbody>"
104
+ end
105
+ end
106
+
107
+ #A table cell element.
108
+ class TableCell < ContainerElement
109
+ #Creates a new TableCell element, takesan optional
110
+ #hash of attributes as parameter.
111
+ def initialize(attrs={})
112
+ aattrs = [
113
+ "class", "id", "title", "dir", "xml:lang",
114
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
115
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
116
+ "onmouseover", "onmouseup", "style", "charset", "hreflang",
117
+ "abbr", "align", "axis", "char", "charoff","colspan",
118
+ "headers", "rowspan", "valign"
119
+ ]
120
+ childs = [
121
+ "abbr", "acronym", "address", "b", "bdo", "big", "blockquote",
122
+ "br", "button", "cite", "code", "del", "dfn", "div",
123
+ "dl", "em", "fieldset", "form", "h1", "h2", "h3", "h4",
124
+ "h5", "h6", "hr", "i", "img", "input", "ins", "kbd",
125
+ "label", "map", "object", "ol", "p", "pre", "q", "samp",
126
+ "script", "select", "small", "span", "strong", "sub", "sup",
127
+ "table", "textarea", "tt", "ul", "var"
128
+ ]
129
+ super("td", aattrs, childs, attrs)
130
+ @start_element = "<td"
131
+ @end_element = "</td>"
132
+ end
133
+ end
134
+
135
+ #A table footer element.
136
+ class TableFooter < ContainerElement
137
+ #Creates a new table footer element, takesan optional
138
+ #hash of attributes as parameter.
139
+ def initialize(attrs={})
140
+ aattrs = [
141
+ "class", "id", "title", "dir", "xml:lang",
142
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
143
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
144
+ "onmouseover", "onmouseup", "style", "charset",
145
+ "hreflang", "align", "char", "charoff", "valign"
146
+ ]
147
+ super("tfoot", aattrs, ["tr"], attrs)
148
+ @start_element = "<tfoot"
149
+ @end_element = "</tfoot>"
150
+ end
151
+ end
152
+
153
+ #A table header cell element.
154
+ class TableHeaderCell < ContainerElement
155
+ #Creates a new TableHeaderCell element, takesan optional
156
+ #hash of attributes as parameter.
157
+ def initialize(attrs={})
158
+ aattrs = [
159
+ "class", "id", "title", "dir", "xml:lang",
160
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
161
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
162
+ "onmouseover", "onmouseup", "style", "charset",
163
+ "hreflang", "abbr", "align", "axis", "char", "charoff",
164
+ "colspan", "headers", "rowspan", "valign"
165
+ ]
166
+ childs = [
167
+ "abbr", "acronym", "address", "b", "bdo", "big", "blockquote",
168
+ "br" ,"button", "cite", "code", "del", "dfn", "div", "dl",
169
+ "em", "fieldset", "form", "h1" ,"h2", "h3", "h4", "h5", "h6",
170
+ "hr", "i", "img", "input", "ins", "kbd", "label", "map",
171
+ "object", "ol", "p", "pre", "q", "samp", "script", "select",
172
+ "small", "span", "strong", "sub", "sup", "table", "textarea",
173
+ "tt", "ul", "var"
174
+ ]
175
+ super("th", aattrs, childs, attrs)
176
+ @start_element = "<th"
177
+ @end_element = "</th>"
178
+ end
179
+ end
180
+
181
+ #A table header element.
182
+ class TableHeader < ContainerElement
183
+ #Creates a new TableHeader element, takesan optional
184
+ #hash of attributes as parameter.
185
+ def initialize(attrs={})
186
+ aattrs = [
187
+ "class", "id", "title", "dir", "xml:lang",
188
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
189
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
190
+ "onmouseover", "onmouseup", "style", "charset",
191
+ "hreflang", "align", "char", "charoff", "valign"
192
+ ]
193
+ super("thead", aattrs, ["tr"], attrs)
194
+ @start_element = "<thead"
195
+ @end_element = "</thead>"
196
+ end
197
+ end
198
+
199
+ #A table row element.
200
+ class TableRow < ContainerElement
201
+ #Creates a new TableRow element, takesan optional
202
+ #hash of attributes as parameter.
203
+ def initialize(attrs={})
204
+ aattrs = [
205
+ "class", "id", "title", "dir", "xml:lang",
206
+ "onclick", "ondblclick", "onkeydown", "onkeypress",
207
+ "onkeyup", "onmousedown", "onmousemove", "onmouseout",
208
+ "onmouseover", "onmouseup", "style", "align", "char",
209
+ "charoff", "valign"
210
+ ]
211
+ super("tr", aattrs, ["td", "th"], attrs)
212
+ @start_element = "<tr"
213
+ @end_element = "</tr>"
214
+ end
215
+ end
216
+
217
+ end