tiny_xml_builder 0.0.3 → 0.0.4
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.
- data/.gemtest +0 -0
- data/History.txt +5 -0
- data/Rakefile +3 -1
- data/version.txt +1 -1
- metadata +39 -7
- data/README.html +0 -682
data/.gemtest
ADDED
|
File without changes
|
data/History.txt
CHANGED
data/Rakefile
CHANGED
|
@@ -14,8 +14,10 @@ Bones {
|
|
|
14
14
|
version ver
|
|
15
15
|
authors 'Alexandru Ungur'
|
|
16
16
|
email 'alexaandru@gmail.com'
|
|
17
|
-
url 'http://rubygems.
|
|
17
|
+
url 'http://rubygems.org/gems/tiny_xml_builder'
|
|
18
18
|
readme_file 'README.asciidoc'
|
|
19
19
|
ignore_file '.gitignore'
|
|
20
20
|
depend_on 'blankslate'
|
|
21
|
+
depend_on 'bones', :development => true
|
|
22
|
+
depend_on 'bones-rcov', :development => true
|
|
21
23
|
}
|
data/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.4
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tiny_xml_builder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.0.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Alexandru Ungur
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-02-
|
|
18
|
+
date: 2011-02-11 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -41,7 +41,7 @@ dependencies:
|
|
|
41
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
42
42
|
none: false
|
|
43
43
|
requirements:
|
|
44
|
-
- - "
|
|
44
|
+
- - "="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
hash: 27
|
|
47
47
|
segments:
|
|
@@ -51,6 +51,38 @@ dependencies:
|
|
|
51
51
|
version: 3.6.2
|
|
52
52
|
type: :development
|
|
53
53
|
version_requirements: *id002
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: bones-rcov
|
|
56
|
+
prerelease: false
|
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
59
|
+
requirements:
|
|
60
|
+
- - "="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
hash: 21
|
|
63
|
+
segments:
|
|
64
|
+
- 1
|
|
65
|
+
- 0
|
|
66
|
+
- 1
|
|
67
|
+
version: 1.0.1
|
|
68
|
+
type: :development
|
|
69
|
+
version_requirements: *id003
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: bones
|
|
72
|
+
prerelease: false
|
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
74
|
+
none: false
|
|
75
|
+
requirements:
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
hash: 27
|
|
79
|
+
segments:
|
|
80
|
+
- 3
|
|
81
|
+
- 6
|
|
82
|
+
- 2
|
|
83
|
+
version: 3.6.2
|
|
84
|
+
type: :development
|
|
85
|
+
version_requirements: *id004
|
|
54
86
|
description: |-
|
|
55
87
|
A very simple XML builder class. +
|
|
56
88
|
I wanted something really simple that I could easily extend myself later on if I needed to. +
|
|
@@ -64,16 +96,16 @@ extensions: []
|
|
|
64
96
|
extra_rdoc_files:
|
|
65
97
|
- History.txt
|
|
66
98
|
files:
|
|
99
|
+
- .gemtest
|
|
67
100
|
- .gitignore
|
|
68
101
|
- History.txt
|
|
69
102
|
- README.asciidoc
|
|
70
|
-
- README.html
|
|
71
103
|
- Rakefile
|
|
72
104
|
- lib/tiny_xml_builder.rb
|
|
73
105
|
- test/test_tiny_xml_builder.rb
|
|
74
106
|
- version.txt
|
|
75
107
|
has_rdoc: true
|
|
76
|
-
homepage: http://rubygems.
|
|
108
|
+
homepage: http://rubygems.org/gems/tiny_xml_builder
|
|
77
109
|
licenses: []
|
|
78
110
|
|
|
79
111
|
post_install_message:
|
data/README.html
DELETED
|
@@ -1,682 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
4
|
-
<head>
|
|
5
|
-
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
|
|
6
|
-
<meta name="generator" content="AsciiDoc 8.6.3" />
|
|
7
|
-
<title>Tiny XML Builder</title>
|
|
8
|
-
<style type="text/css">
|
|
9
|
-
/* Debug borders */
|
|
10
|
-
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
|
|
11
|
-
/*
|
|
12
|
-
border: 1px solid red;
|
|
13
|
-
*/
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
body {
|
|
17
|
-
margin: 1em 5% 1em 5%;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
a {
|
|
21
|
-
color: blue;
|
|
22
|
-
text-decoration: underline;
|
|
23
|
-
}
|
|
24
|
-
a:visited {
|
|
25
|
-
color: fuchsia;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
em {
|
|
29
|
-
font-style: italic;
|
|
30
|
-
color: navy;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
strong {
|
|
34
|
-
font-weight: bold;
|
|
35
|
-
color: #083194;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
tt {
|
|
39
|
-
color: navy;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
h1, h2, h3, h4, h5, h6 {
|
|
43
|
-
color: #527bbd;
|
|
44
|
-
font-family: sans-serif;
|
|
45
|
-
margin-top: 1.2em;
|
|
46
|
-
margin-bottom: 0.5em;
|
|
47
|
-
line-height: 1.3;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
h1, h2, h3 {
|
|
51
|
-
border-bottom: 2px solid silver;
|
|
52
|
-
}
|
|
53
|
-
h2 {
|
|
54
|
-
padding-top: 0.5em;
|
|
55
|
-
}
|
|
56
|
-
h3 {
|
|
57
|
-
float: left;
|
|
58
|
-
}
|
|
59
|
-
h3 + * {
|
|
60
|
-
clear: left;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
div.sectionbody {
|
|
64
|
-
font-family: serif;
|
|
65
|
-
margin-left: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
hr {
|
|
69
|
-
border: 1px solid silver;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
p {
|
|
73
|
-
margin-top: 0.5em;
|
|
74
|
-
margin-bottom: 0.5em;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
ul, ol, li > p {
|
|
78
|
-
margin-top: 0;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
pre {
|
|
82
|
-
padding: 0;
|
|
83
|
-
margin: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
span#author {
|
|
87
|
-
color: #527bbd;
|
|
88
|
-
font-family: sans-serif;
|
|
89
|
-
font-weight: bold;
|
|
90
|
-
font-size: 1.1em;
|
|
91
|
-
}
|
|
92
|
-
span#email {
|
|
93
|
-
}
|
|
94
|
-
span#revnumber, span#revdate, span#revremark {
|
|
95
|
-
font-family: sans-serif;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
div#footer {
|
|
99
|
-
font-family: sans-serif;
|
|
100
|
-
font-size: small;
|
|
101
|
-
border-top: 2px solid silver;
|
|
102
|
-
padding-top: 0.5em;
|
|
103
|
-
margin-top: 4.0em;
|
|
104
|
-
}
|
|
105
|
-
div#footer-text {
|
|
106
|
-
float: left;
|
|
107
|
-
padding-bottom: 0.5em;
|
|
108
|
-
}
|
|
109
|
-
div#footer-badges {
|
|
110
|
-
float: right;
|
|
111
|
-
padding-bottom: 0.5em;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
div#preamble {
|
|
115
|
-
margin-top: 1.5em;
|
|
116
|
-
margin-bottom: 1.5em;
|
|
117
|
-
}
|
|
118
|
-
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
|
|
119
|
-
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
|
|
120
|
-
div.admonitionblock {
|
|
121
|
-
margin-top: 0.25em;
|
|
122
|
-
margin-bottom: 1.5em;
|
|
123
|
-
}
|
|
124
|
-
div.admonitionblock {
|
|
125
|
-
margin-top: 2.5em;
|
|
126
|
-
margin-bottom: 2.5em;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
div.content { /* Block element content. */
|
|
130
|
-
padding: 0;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/* Block element titles. */
|
|
134
|
-
div.title, caption.title {
|
|
135
|
-
color: #527bbd;
|
|
136
|
-
font-family: sans-serif;
|
|
137
|
-
font-weight: bold;
|
|
138
|
-
text-align: left;
|
|
139
|
-
margin-top: 1.0em;
|
|
140
|
-
margin-bottom: 0.5em;
|
|
141
|
-
}
|
|
142
|
-
div.title + * {
|
|
143
|
-
margin-top: 0;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
td div.title:first-child {
|
|
147
|
-
margin-top: 0.0em;
|
|
148
|
-
}
|
|
149
|
-
div.content div.title:first-child {
|
|
150
|
-
margin-top: 0.0em;
|
|
151
|
-
}
|
|
152
|
-
div.content + div.title {
|
|
153
|
-
margin-top: 0.0em;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
div.sidebarblock > div.content {
|
|
157
|
-
background: #ffffee;
|
|
158
|
-
border: 1px solid silver;
|
|
159
|
-
padding: 0.5em;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
div.listingblock > div.content {
|
|
163
|
-
border: 1px solid silver;
|
|
164
|
-
background: #f4f4f4;
|
|
165
|
-
padding: 0.5em;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
div.quoteblock {
|
|
169
|
-
padding-left: 2.0em;
|
|
170
|
-
margin-right: 10%;
|
|
171
|
-
}
|
|
172
|
-
div.quoteblock > div.attribution {
|
|
173
|
-
padding-top: 0.5em;
|
|
174
|
-
text-align: right;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
div.verseblock {
|
|
178
|
-
padding-left: 2.0em;
|
|
179
|
-
margin-right: 10%;
|
|
180
|
-
}
|
|
181
|
-
div.verseblock > div.content {
|
|
182
|
-
white-space: pre;
|
|
183
|
-
}
|
|
184
|
-
div.verseblock > div.attribution {
|
|
185
|
-
padding-top: 0.75em;
|
|
186
|
-
text-align: left;
|
|
187
|
-
}
|
|
188
|
-
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
|
|
189
|
-
div.verseblock + div.attribution {
|
|
190
|
-
text-align: left;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
div.admonitionblock .icon {
|
|
194
|
-
vertical-align: top;
|
|
195
|
-
font-size: 1.1em;
|
|
196
|
-
font-weight: bold;
|
|
197
|
-
text-decoration: underline;
|
|
198
|
-
color: #527bbd;
|
|
199
|
-
padding-right: 0.5em;
|
|
200
|
-
}
|
|
201
|
-
div.admonitionblock td.content {
|
|
202
|
-
padding-left: 0.5em;
|
|
203
|
-
border-left: 2px solid silver;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
div.exampleblock > div.content {
|
|
207
|
-
border-left: 2px solid silver;
|
|
208
|
-
padding: 0.5em;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
div.imageblock div.content { padding-left: 0; }
|
|
212
|
-
span.image img { border-style: none; }
|
|
213
|
-
a.image:visited { color: white; }
|
|
214
|
-
|
|
215
|
-
dl {
|
|
216
|
-
margin-top: 0.8em;
|
|
217
|
-
margin-bottom: 0.8em;
|
|
218
|
-
}
|
|
219
|
-
dt {
|
|
220
|
-
margin-top: 0.5em;
|
|
221
|
-
margin-bottom: 0;
|
|
222
|
-
font-style: normal;
|
|
223
|
-
color: navy;
|
|
224
|
-
}
|
|
225
|
-
dd > *:first-child {
|
|
226
|
-
margin-top: 0.1em;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
ul, ol {
|
|
230
|
-
list-style-position: outside;
|
|
231
|
-
}
|
|
232
|
-
ol.arabic {
|
|
233
|
-
list-style-type: decimal;
|
|
234
|
-
}
|
|
235
|
-
ol.loweralpha {
|
|
236
|
-
list-style-type: lower-alpha;
|
|
237
|
-
}
|
|
238
|
-
ol.upperalpha {
|
|
239
|
-
list-style-type: upper-alpha;
|
|
240
|
-
}
|
|
241
|
-
ol.lowerroman {
|
|
242
|
-
list-style-type: lower-roman;
|
|
243
|
-
}
|
|
244
|
-
ol.upperroman {
|
|
245
|
-
list-style-type: upper-roman;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
div.compact ul, div.compact ol,
|
|
249
|
-
div.compact p, div.compact p,
|
|
250
|
-
div.compact div, div.compact div {
|
|
251
|
-
margin-top: 0.1em;
|
|
252
|
-
margin-bottom: 0.1em;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
div.tableblock > table {
|
|
256
|
-
border: 3px solid #527bbd;
|
|
257
|
-
}
|
|
258
|
-
thead {
|
|
259
|
-
font-family: sans-serif;
|
|
260
|
-
font-weight: bold;
|
|
261
|
-
}
|
|
262
|
-
tfoot {
|
|
263
|
-
font-weight: bold;
|
|
264
|
-
}
|
|
265
|
-
td > div.verse {
|
|
266
|
-
white-space: pre;
|
|
267
|
-
}
|
|
268
|
-
p.table {
|
|
269
|
-
margin-top: 0;
|
|
270
|
-
}
|
|
271
|
-
/* Because the table frame attribute is overriden by CSS in most browsers. */
|
|
272
|
-
div.tableblock > table[frame="void"] {
|
|
273
|
-
border-style: none;
|
|
274
|
-
}
|
|
275
|
-
div.tableblock > table[frame="hsides"] {
|
|
276
|
-
border-left-style: none;
|
|
277
|
-
border-right-style: none;
|
|
278
|
-
}
|
|
279
|
-
div.tableblock > table[frame="vsides"] {
|
|
280
|
-
border-top-style: none;
|
|
281
|
-
border-bottom-style: none;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
div.hdlist {
|
|
286
|
-
margin-top: 0.8em;
|
|
287
|
-
margin-bottom: 0.8em;
|
|
288
|
-
}
|
|
289
|
-
div.hdlist tr {
|
|
290
|
-
padding-bottom: 15px;
|
|
291
|
-
}
|
|
292
|
-
dt.hdlist1.strong, td.hdlist1.strong {
|
|
293
|
-
font-weight: bold;
|
|
294
|
-
}
|
|
295
|
-
td.hdlist1 {
|
|
296
|
-
vertical-align: top;
|
|
297
|
-
font-style: normal;
|
|
298
|
-
padding-right: 0.8em;
|
|
299
|
-
color: navy;
|
|
300
|
-
}
|
|
301
|
-
td.hdlist2 {
|
|
302
|
-
vertical-align: top;
|
|
303
|
-
}
|
|
304
|
-
div.hdlist.compact tr {
|
|
305
|
-
margin: 0;
|
|
306
|
-
padding-bottom: 0;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.comment {
|
|
310
|
-
background: yellow;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.footnote, .footnoteref {
|
|
314
|
-
font-size: 0.8em;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
span.footnote, span.footnoteref {
|
|
318
|
-
vertical-align: super;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
#footnotes {
|
|
322
|
-
margin: 20px 0 20px 0;
|
|
323
|
-
padding: 7px 0 0 0;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
#footnotes div.footnote {
|
|
327
|
-
margin: 0 0 5px 0;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
#footnotes hr {
|
|
331
|
-
border: none;
|
|
332
|
-
border-top: 1px solid silver;
|
|
333
|
-
height: 1px;
|
|
334
|
-
text-align: left;
|
|
335
|
-
margin-left: 0;
|
|
336
|
-
width: 20%;
|
|
337
|
-
min-width: 100px;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
@media print {
|
|
342
|
-
div#footer-badges { display: none; }
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
div#toctitle {
|
|
346
|
-
color: #527bbd;
|
|
347
|
-
font-family: sans-serif;
|
|
348
|
-
font-size: 1.1em;
|
|
349
|
-
font-weight: bold;
|
|
350
|
-
margin-top: 1.0em;
|
|
351
|
-
margin-bottom: 0.1em;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
|
|
355
|
-
margin-top: 0;
|
|
356
|
-
margin-bottom: 0;
|
|
357
|
-
}
|
|
358
|
-
div.toclevel2 {
|
|
359
|
-
margin-left: 2em;
|
|
360
|
-
font-size: 0.9em;
|
|
361
|
-
}
|
|
362
|
-
div.toclevel3 {
|
|
363
|
-
margin-left: 4em;
|
|
364
|
-
font-size: 0.9em;
|
|
365
|
-
}
|
|
366
|
-
div.toclevel4 {
|
|
367
|
-
margin-left: 6em;
|
|
368
|
-
font-size: 0.9em;
|
|
369
|
-
}
|
|
370
|
-
</style>
|
|
371
|
-
<script type="text/javascript">
|
|
372
|
-
/*<+'])');
|
|
416
|
-
// Function that scans the DOM tree for header elements (the DOM2
|
|
417
|
-
// nodeIterator API would be a better technique but not supported by all
|
|
418
|
-
// browsers).
|
|
419
|
-
var iterate = function (el) {
|
|
420
|
-
for (var i = el.firstChild; i != null; i = i.nextSibling) {
|
|
421
|
-
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
|
|
422
|
-
var mo = re.exec(i.tagName);
|
|
423
|
-
if (mo)
|
|
424
|
-
result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
|
|
425
|
-
iterate(i);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
iterate(el);
|
|
430
|
-
return result;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
var toc = document.getElementById("toc");
|
|
434
|
-
var entries = tocEntries(document.getElementById("content"), toclevels);
|
|
435
|
-
for (var i = 0; i < entries.length; ++i) {
|
|
436
|
-
var entry = entries[i];
|
|
437
|
-
if (entry.element.id == "")
|
|
438
|
-
entry.element.id = "_toc_" + i;
|
|
439
|
-
var a = document.createElement("a");
|
|
440
|
-
a.href = "#" + entry.element.id;
|
|
441
|
-
a.appendChild(document.createTextNode(entry.text));
|
|
442
|
-
var div = document.createElement("div");
|
|
443
|
-
div.appendChild(a);
|
|
444
|
-
div.className = "toclevel" + entry.toclevel;
|
|
445
|
-
toc.appendChild(div);
|
|
446
|
-
}
|
|
447
|
-
if (entries.length == 0)
|
|
448
|
-
toc.parentNode.removeChild(toc);
|
|
449
|
-
},
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
/////////////////////////////////////////////////////////////////////
|
|
453
|
-
// Footnotes generator
|
|
454
|
-
/////////////////////////////////////////////////////////////////////
|
|
455
|
-
|
|
456
|
-
/* Based on footnote generation code from:
|
|
457
|
-
* http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
footnotes: function () {
|
|
461
|
-
var cont = document.getElementById("content");
|
|
462
|
-
var noteholder = document.getElementById("footnotes");
|
|
463
|
-
var spans = cont.getElementsByTagName("span");
|
|
464
|
-
var refs = {};
|
|
465
|
-
var n = 0;
|
|
466
|
-
for (i=0; i<spans.length; i++) {
|
|
467
|
-
if (spans[i].className == "footnote") {
|
|
468
|
-
n++;
|
|
469
|
-
// Use [\s\S] in place of . so multi-line matches work.
|
|
470
|
-
// Because JavaScript has no s (dotall) regex flag.
|
|
471
|
-
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
|
|
472
|
-
noteholder.innerHTML +=
|
|
473
|
-
"<div class='footnote' id='_footnote_" + n + "'>" +
|
|
474
|
-
"<a href='#_footnoteref_" + n + "' title='Return to text'>" +
|
|
475
|
-
n + "</a>. " + note + "</div>";
|
|
476
|
-
spans[i].innerHTML =
|
|
477
|
-
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
|
|
478
|
-
"' title='View footnote' class='footnote'>" + n + "</a>]";
|
|
479
|
-
var id =spans[i].getAttribute("id");
|
|
480
|
-
if (id != null) refs["#"+id] = n;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
if (n == 0)
|
|
484
|
-
noteholder.parentNode.removeChild(noteholder);
|
|
485
|
-
else {
|
|
486
|
-
// Process footnoterefs.
|
|
487
|
-
for (i=0; i<spans.length; i++) {
|
|
488
|
-
if (spans[i].className == "footnoteref") {
|
|
489
|
-
var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
|
|
490
|
-
href = href.match(/#.*/)[0]; // Because IE return full URL.
|
|
491
|
-
n = refs[href];
|
|
492
|
-
spans[i].innerHTML =
|
|
493
|
-
"[<a href='#_footnote_" + n +
|
|
494
|
-
"' title='View footnote' class='footnote'>" + n + "</a>]";
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
/*]]>*/
|
|
502
|
-
</script>
|
|
503
|
-
</head>
|
|
504
|
-
<body class="article">
|
|
505
|
-
<div id="header">
|
|
506
|
-
<h1>Tiny XML Builder</h1>
|
|
507
|
-
<span id="author">Alexandru Ungur</span><br />
|
|
508
|
-
<span id="email"><tt><<a href="mailto:alexaandru@gmail.com">alexaandru@gmail.com</a>></tt></span><br />
|
|
509
|
-
<div id="toc">
|
|
510
|
-
<div id="toctitle">Table of Contents</div>
|
|
511
|
-
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
|
|
512
|
-
</div>
|
|
513
|
-
</div>
|
|
514
|
-
<div id="content">
|
|
515
|
-
<div class="sect1">
|
|
516
|
-
<h2 id="_description">Description</h2>
|
|
517
|
-
<div class="sectionbody">
|
|
518
|
-
<div class="paragraph"><p>A very simple XML builder class.<br />
|
|
519
|
-
I wanted something really simple that I could easily extend myself later on if I needed to.<br />
|
|
520
|
-
Ironically, in four years since I created and used TinyXml, I never needed to extend it :-)
|
|
521
|
-
I figured, it may as well work for others in that case, so here it is.</p></div>
|
|
522
|
-
</div>
|
|
523
|
-
</div>
|
|
524
|
-
<div class="sect1">
|
|
525
|
-
<h2 id="_acknowledgements">Acknowledgements</h2>
|
|
526
|
-
<div class="sectionbody">
|
|
527
|
-
<div class="paragraph"><p>A big thanks to Jim Weirich for his great advices on Ruby-talk.<br />
|
|
528
|
-
The BlankSlate "mechanism" he describes at: <a href="http://onestepback.org/index.cgi/Tech/Ruby/BlankSlate.rdoc">http://onestepback.org/index.cgi/Tech/Ruby/BlankSlate.rdoc</a>
|
|
529
|
-
and which this library depends upon, is one of the first things I’ve learnt when started to play with Ruby DSLs.</p></div>
|
|
530
|
-
</div>
|
|
531
|
-
</div>
|
|
532
|
-
<div class="sect1">
|
|
533
|
-
<h2 id="_features_problems">Features/Problems</h2>
|
|
534
|
-
<div class="sectionbody">
|
|
535
|
-
<div class="ulist"><ul>
|
|
536
|
-
<li>
|
|
537
|
-
<p>
|
|
538
|
-
You cannot have XML elements named <em>__id__</em>, <em>__send__</em>, <em>method_missing</em>, <em>instance_eval</em> or <em>respond_to</em> as those are NOT undefined (on purpose) by BlankSlate mechanism;
|
|
539
|
-
</p>
|
|
540
|
-
</li>
|
|
541
|
-
<li>
|
|
542
|
-
<p>
|
|
543
|
-
There are other limitations related to “implicit receiver” calls, e.g.:
|
|
544
|
-
</p>
|
|
545
|
-
</li>
|
|
546
|
-
</ul></div>
|
|
547
|
-
<div class="listingblock">
|
|
548
|
-
<div class="title">Explicit receiver example</div>
|
|
549
|
-
<div class="content">
|
|
550
|
-
<pre><tt>puts TinyXml::Builder.new.foo {|f| f.p 'bar'}</tt></pre>
|
|
551
|
-
</div></div>
|
|
552
|
-
<div class="paragraph"><p>will output:</p></div>
|
|
553
|
-
<div class="listingblock">
|
|
554
|
-
<div class="content">
|
|
555
|
-
<pre><tt><foo>
|
|
556
|
-
<p>bar</p>
|
|
557
|
-
</foo></tt></pre>
|
|
558
|
-
</div></div>
|
|
559
|
-
<div class="paragraph"><p>while the following:</p></div>
|
|
560
|
-
<div class="listingblock">
|
|
561
|
-
<div class="title">Implicit receiver example</div>
|
|
562
|
-
<div class="content">
|
|
563
|
-
<pre><tt>puts TinyXml::Builder.new.foo { p 'bar' }</tt></pre>
|
|
564
|
-
</div></div>
|
|
565
|
-
<div class="paragraph"><p>will output:</p></div>
|
|
566
|
-
<div class="listingblock">
|
|
567
|
-
<div class="content">
|
|
568
|
-
<pre><tt>"bar"
|
|
569
|
-
<foo>
|
|
570
|
-
</foo></tt></pre>
|
|
571
|
-
</div></div>
|
|
572
|
-
<div class="paragraph"><p>as "p" method exists in outer scope and does an entirely different thing than what (missing) methods of TinyXml do.</p></div>
|
|
573
|
-
</div>
|
|
574
|
-
</div>
|
|
575
|
-
<div class="sect1">
|
|
576
|
-
<h2 id="_synopsis">Synopsis</h2>
|
|
577
|
-
<div class="sectionbody">
|
|
578
|
-
<div class="listingblock">
|
|
579
|
-
<div class="title">Example Usage</div>
|
|
580
|
-
<div class="content">
|
|
581
|
-
<pre><tt>builder = TinyXml::Builder.new
|
|
582
|
-
builder.html do |xhtml|
|
|
583
|
-
xhtml.head do |head|
|
|
584
|
-
head.title 'Hello World'
|
|
585
|
-
head.meta :name => :keywords, :content => 'hello, world'
|
|
586
|
-
head.meta :name => :description, :content => 'hello world sample usage for XML class'
|
|
587
|
-
end
|
|
588
|
-
xhtml.body do |body|
|
|
589
|
-
body.div :id => 'main' do |div_main|
|
|
590
|
-
div_main.h1 "Hello World"
|
|
591
|
-
div_main.p "Hello HTML world", "from XML"
|
|
592
|
-
end
|
|
593
|
-
end
|
|
594
|
-
end
|
|
595
|
-
|
|
596
|
-
puts builder</tt></pre>
|
|
597
|
-
</div></div>
|
|
598
|
-
<div class="listingblock">
|
|
599
|
-
<div class="title">Alternate Example Usage</div>
|
|
600
|
-
<div class="content">
|
|
601
|
-
<pre><tt>puts TinyXml::Builder.new.html {
|
|
602
|
-
head {
|
|
603
|
-
title 'Hello World'
|
|
604
|
-
meta :name => :keywords, :content => 'hello, world'
|
|
605
|
-
meta :name => :description, :content => 'hello world sample usage for XML class'
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
body {
|
|
609
|
-
div(:id => 'main') { |div|
|
|
610
|
-
div.h1 "Hello World"
|
|
611
|
-
div.p "Hello HTML world", "from XML"
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}</tt></pre>
|
|
615
|
-
</div></div>
|
|
616
|
-
<div class="paragraph"><p>both will output:</p></div>
|
|
617
|
-
<div class="listingblock">
|
|
618
|
-
<div class="content">
|
|
619
|
-
<pre><tt><html>
|
|
620
|
-
<head>
|
|
621
|
-
<title>Hello World</title>
|
|
622
|
-
<meta name="keywords" content="hello, world" />
|
|
623
|
-
<meta name="description" content="hello world sample usage for XML class" />
|
|
624
|
-
</head>
|
|
625
|
-
<body>
|
|
626
|
-
<div id="main">
|
|
627
|
-
<h1>Hello World</h1>
|
|
628
|
-
<p>Hello HTML world</p>
|
|
629
|
-
<p>from XML</p>
|
|
630
|
-
</div>
|
|
631
|
-
</body>
|
|
632
|
-
</html></tt></pre>
|
|
633
|
-
</div></div>
|
|
634
|
-
</div>
|
|
635
|
-
</div>
|
|
636
|
-
<div class="sect1">
|
|
637
|
-
<h2 id="_requirements">Requirements</h2>
|
|
638
|
-
<div class="sectionbody">
|
|
639
|
-
<div class="paragraph"><p>NONE</p></div>
|
|
640
|
-
</div>
|
|
641
|
-
</div>
|
|
642
|
-
<div class="sect1">
|
|
643
|
-
<h2 id="_install">Install</h2>
|
|
644
|
-
<div class="sectionbody">
|
|
645
|
-
<div class="sidebarblock">
|
|
646
|
-
<div class="content">
|
|
647
|
-
<div class="paragraph"><p>sudo gem install tiny_xml_builder</p></div>
|
|
648
|
-
</div></div>
|
|
649
|
-
</div>
|
|
650
|
-
</div>
|
|
651
|
-
<div class="sect1">
|
|
652
|
-
<h2 id="_license">License</h2>
|
|
653
|
-
<div class="sectionbody">
|
|
654
|
-
<div class="paragraph"><p>(The MIT License)</p></div>
|
|
655
|
-
<div class="paragraph"><p>Copyright (c) 2010 Alexandru Ungur</p></div>
|
|
656
|
-
<div class="paragraph"><p>Permission is hereby granted, free of charge, to any person obtaining
|
|
657
|
-
a copy of this software and associated documentation files (the
|
|
658
|
-
<em>Software</em>), to deal in the Software without restriction, including
|
|
659
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
660
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
661
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
662
|
-
the following conditions:</p></div>
|
|
663
|
-
<div class="paragraph"><p>The above copyright notice and this permission notice shall be
|
|
664
|
-
included in all copies or substantial portions of the Software.</p></div>
|
|
665
|
-
<div class="paragraph"><p>THE SOFTWARE IS PROVIDED <em>AS IS</em>, WITHOUT WARRANTY OF ANY KIND,
|
|
666
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
667
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
668
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
669
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
670
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
671
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></div>
|
|
672
|
-
</div>
|
|
673
|
-
</div>
|
|
674
|
-
</div>
|
|
675
|
-
<div id="footnotes"><hr /></div>
|
|
676
|
-
<div id="footer">
|
|
677
|
-
<div id="footer-text">
|
|
678
|
-
Last updated 2011-02-04 14:02:13 EET
|
|
679
|
-
</div>
|
|
680
|
-
</div>
|
|
681
|
-
</body>
|
|
682
|
-
</html>
|