atom-tools 0.9.0 → 2.0.5
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/COPYING +3 -3
- data/README +9 -49
- data/Rakefile +65 -62
- data/bin/atom-cp +159 -0
- data/bin/atom-grep +78 -0
- data/bin/atom-post +73 -0
- data/bin/atom-purge +82 -0
- data/doc/classes/Atom/AttrEl.html +163 -0
- data/doc/classes/Atom/Author.html +2 -19
- data/doc/classes/Atom/AutodiscoveryFailure.html +111 -0
- data/doc/classes/Atom/Categories.html +168 -0
- data/doc/classes/Atom/Category.html +10 -1
- data/doc/classes/Atom/Collection.html +194 -91
- data/doc/classes/Atom/Content.html +42 -1
- data/doc/classes/Atom/Contributor.html +2 -8
- data/doc/classes/Atom/Control.html +126 -0
- data/doc/classes/Atom/Converters.html +571 -0
- data/doc/classes/Atom/DigestAuth.html +285 -0
- data/doc/classes/Atom/Element.html +673 -106
- data/doc/classes/Atom/FileCache.html +287 -0
- data/doc/classes/Atom/HTTP.html +211 -95
- data/doc/classes/Atom/HTTPResponse.html +190 -0
- data/doc/classes/Atom/HasCategories.html +187 -0
- data/doc/classes/Atom/HasLinks.html +168 -0
- data/doc/classes/Atom/Link.html +80 -3
- data/doc/classes/Atom/NilCache.html +202 -0
- data/doc/classes/Atom/ParseError.html +111 -0
- data/doc/classes/Atom/Parsers.html +311 -0
- data/doc/classes/Atom/Person.html +130 -0
- data/doc/classes/Atom/Rights.html +113 -0
- data/doc/classes/Atom/Service.html +298 -0
- data/doc/{files/lib/atom/yaml_rb.html → classes/Atom/Source.html} +26 -24
- data/doc/classes/Atom/Subtitle.html +113 -0
- data/doc/classes/Atom/Summary.html +113 -0
- data/doc/classes/Atom/Text.html +196 -53
- data/doc/classes/Atom/Title.html +113 -0
- data/doc/classes/Atom/Tools.html +525 -0
- data/doc/classes/Atom/Workspace.html +121 -0
- data/doc/classes/Object.html +204 -0
- data/doc/created.rid +1 -1
- data/doc/files/README.html +9 -49
- data/doc/files/lib/atom/cache_rb.html +302 -0
- data/doc/files/lib/atom/collection_rb.html +1 -2
- data/doc/files/lib/atom/element_rb.html +2 -1
- data/doc/files/lib/atom/entry_rb.html +2 -2
- data/doc/files/lib/atom/feed_rb.html +1 -2
- data/doc/files/lib/atom/http_rb.html +6 -1
- data/doc/files/lib/atom/{xml_rb.html → service_rb.html} +8 -6
- data/doc/files/lib/atom/text_rb.html +2 -1
- data/doc/files/lib/atom/{app_rb.html → tools_rb.html} +4 -6
- data/doc/fr_class_index.html +23 -3
- data/doc/fr_file_index.html +3 -3
- data/doc/fr_method_index.html +111 -36
- data/lib/atom/cache.rb +178 -0
- data/lib/atom/collection.rb +90 -40
- data/lib/atom/element.rb +569 -161
- data/lib/atom/entry.rb +63 -89
- data/lib/atom/feed.rb +65 -67
- data/lib/atom/http.rb +421 -49
- data/lib/atom/service.rb +106 -0
- data/lib/atom/text.rb +138 -61
- data/lib/atom/tools.rb +163 -0
- data/spec/entry_spec.rb +364 -0
- data/spec/ext_spec.rb +42 -0
- data/spec/feed_spec.rb +39 -0
- data/spec/fixtures/contacts-feed.xml +34 -0
- data/spec/fixtures/entry-w-ext.xml +15 -0
- data/spec/fixtures/entry-w-xml.xml +24 -0
- data/spec/fixtures/entry.xml +42 -0
- data/spec/fixtures/feed-w-ext.xml +33 -0
- data/spec/fixtures/service-w-xhtml-ns.xml +21 -0
- data/spec/fixtures/service.xml +36 -0
- data/spec/service_spec.rb +108 -0
- data/spec/spec_helper.rb +9 -0
- data/test/conformance/order.rb +11 -10
- data/test/conformance/title.rb +9 -9
- data/test/conformance/updated.rb +2 -1
- data/test/runtests.rb +0 -0
- data/test/test_constructs.rb +78 -8
- data/test/test_feed.rb +35 -29
- data/test/test_general.rb +3 -30
- data/test/test_http.rb +248 -34
- data/test/test_protocol.rb +143 -24
- data/test/test_xml.rb +145 -53
- metadata +116 -62
- data/bin/atom-client.rb +0 -246
- data/bin/atom-server.rb~ +0 -71
- data/doc/classes/Atom/App.html +0 -217
- data/doc/classes/Atom/Entry.html +0 -365
- data/doc/classes/Atom/Feed.html +0 -585
- data/lib/atom/app.rb +0 -87
- data/lib/atom/xml.rb +0 -200
- data/lib/atom/yaml.rb +0 -101
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Atom::Subtitle</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Atom::Subtitle</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/atom/text_rb.html">
|
|
59
|
+
lib/atom/text.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Text.html">
|
|
69
|
+
Atom::Text
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
<!-- if includes -->
|
|
92
|
+
|
|
93
|
+
<div id="section">
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<!-- if method_list -->
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<div id="validator-badges">
|
|
109
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
</body>
|
|
113
|
+
</html>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Atom::Summary</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Atom::Summary</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/atom/text_rb.html">
|
|
59
|
+
lib/atom/text.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Text.html">
|
|
69
|
+
Atom::Text
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
<!-- if includes -->
|
|
92
|
+
|
|
93
|
+
<div id="section">
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<!-- if method_list -->
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<div id="validator-badges">
|
|
109
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
</body>
|
|
113
|
+
</html>
|
data/doc/classes/Atom/Text.html
CHANGED
|
@@ -55,10 +55,6 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../files/lib/atom/yaml_rb.html">
|
|
59
|
-
lib/atom/yaml.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
58
|
<a href="../../files/lib/atom/text_rb.html">
|
|
63
59
|
lib/atom/text.rb
|
|
64
60
|
</a>
|
|
@@ -87,8 +83,29 @@
|
|
|
87
83
|
<div id="description">
|
|
88
84
|
<p>
|
|
89
85
|
An <a href="Element.html">Atom::Element</a> representing a text construct.
|
|
90
|
-
It has a single attribute, "
|
|
91
|
-
|
|
86
|
+
It has a single attribute, "<a
|
|
87
|
+
href="Text.html#M000052">type</a>", which specifies how to interpret
|
|
88
|
+
the element‘s content. Different types are:
|
|
89
|
+
</p>
|
|
90
|
+
<table>
|
|
91
|
+
<tr><td valign="top">text:</td><td>a plain string, without any markup (default)
|
|
92
|
+
|
|
93
|
+
</td></tr>
|
|
94
|
+
<tr><td valign="top"><a href="Text.html#M000054">html</a>:</td><td>a chunk of HTML
|
|
95
|
+
|
|
96
|
+
</td></tr>
|
|
97
|
+
<tr><td valign="top">xhtml:</td><td>a chunk of *well-formed* <a href="../XHTML.html">XHTML</a>
|
|
98
|
+
|
|
99
|
+
</td></tr>
|
|
100
|
+
</table>
|
|
101
|
+
<p>
|
|
102
|
+
You should set this attribute appropriately after you set a <a
|
|
103
|
+
href="Text.html">Text</a> element (entry.content, entry.title or
|
|
104
|
+
entry.summary).
|
|
105
|
+
</p>
|
|
106
|
+
<p>
|
|
107
|
+
This content of this element can be retrieved in different formats, see <a
|
|
108
|
+
href="Text.html#M000054">html</a> and <a href="Text.html#M000055">xml</a>
|
|
92
109
|
</p>
|
|
93
110
|
|
|
94
111
|
</div>
|
|
@@ -100,9 +117,12 @@ It has a single attribute, "type", which accepts values
|
|
|
100
117
|
<h3 class="section-bar">Methods</h3>
|
|
101
118
|
|
|
102
119
|
<div class="name-list">
|
|
103
|
-
<a href="#
|
|
104
|
-
<a href="#
|
|
105
|
-
<a href="#
|
|
120
|
+
<a href="#M000054">html</a>
|
|
121
|
+
<a href="#M000051">new</a>
|
|
122
|
+
<a href="#M000053">to_s</a>
|
|
123
|
+
<a href="#M000052">type</a>
|
|
124
|
+
<a href="#M000056">type=</a>
|
|
125
|
+
<a href="#M000055">xml</a>
|
|
106
126
|
</div>
|
|
107
127
|
</div>
|
|
108
128
|
|
|
@@ -110,6 +130,13 @@ It has a single attribute, "type", which accepts values
|
|
|
110
130
|
|
|
111
131
|
|
|
112
132
|
<!-- if includes -->
|
|
133
|
+
<div id="includes">
|
|
134
|
+
<h3 class="section-bar">Included Modules</h3>
|
|
135
|
+
|
|
136
|
+
<div id="includes-list">
|
|
137
|
+
<span class="include-name"><a href="AttrEl.html">AttrEl</a></span>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
113
140
|
|
|
114
141
|
<div id="section">
|
|
115
142
|
|
|
@@ -122,93 +149,209 @@ It has a single attribute, "type", which accepts values
|
|
|
122
149
|
|
|
123
150
|
<!-- if method_list -->
|
|
124
151
|
<div id="methods">
|
|
152
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
153
|
+
|
|
154
|
+
<div id="method-M000051" class="method-detail">
|
|
155
|
+
<a name="M000051"></a>
|
|
156
|
+
|
|
157
|
+
<div class="method-heading">
|
|
158
|
+
<a href="#M000051" class="method-signature">
|
|
159
|
+
<span class="method-name">new</span><span class="method-args">(value = nil)</span>
|
|
160
|
+
</a>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div class="method-description">
|
|
164
|
+
<p><a class="source-toggle" href="#"
|
|
165
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
|
166
|
+
<div class="method-source-code" id="M000051-source">
|
|
167
|
+
<pre>
|
|
168
|
+
<span class="ruby-comment cmt"># File lib/atom/text.rb, line 73</span>
|
|
169
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>
|
|
170
|
+
<span class="ruby-keyword kw">super</span>()
|
|
171
|
+
|
|
172
|
+
<span class="ruby-ivar">@content</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:to_xml</span>
|
|
173
|
+
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_xml</span>[<span class="ruby-value">0</span>]
|
|
174
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">value</span>
|
|
175
|
+
<span class="ruby-identifier">value</span>
|
|
176
|
+
<span class="ruby-keyword kw">else</span>
|
|
177
|
+
<span class="ruby-value str">''</span>
|
|
178
|
+
<span class="ruby-keyword kw">end</span>
|
|
179
|
+
<span class="ruby-keyword kw">end</span>
|
|
180
|
+
</pre>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
125
185
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
126
186
|
|
|
127
|
-
<div id="method-
|
|
128
|
-
<a name="
|
|
187
|
+
<div id="method-M000054" class="method-detail">
|
|
188
|
+
<a name="M000054"></a>
|
|
129
189
|
|
|
130
190
|
<div class="method-heading">
|
|
131
|
-
<a href="#
|
|
191
|
+
<a href="#M000054" class="method-signature">
|
|
132
192
|
<span class="method-name">html</span><span class="method-args">()</span>
|
|
133
193
|
</a>
|
|
134
194
|
</div>
|
|
135
195
|
|
|
136
196
|
<div class="method-description">
|
|
137
197
|
<p>
|
|
138
|
-
returns a string suitable for dumping into an HTML document
|
|
198
|
+
returns a string suitable for dumping into an HTML document.
|
|
199
|
+
</p>
|
|
200
|
+
<pre>
|
|
201
|
+
(or nil if that's impossible)
|
|
202
|
+
</pre>
|
|
203
|
+
<p>
|
|
204
|
+
if you‘re storing the content of a <a href="Text.html">Text</a>
|
|
205
|
+
construct, you probably want this representation.
|
|
139
206
|
</p>
|
|
140
207
|
<p><a class="source-toggle" href="#"
|
|
141
|
-
onclick="toggleCode('
|
|
142
|
-
<div class="method-source-code" id="
|
|
208
|
+
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
|
209
|
+
<div class="method-source-code" id="M000054-source">
|
|
143
210
|
<pre>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
211
|
+
<span class="ruby-comment cmt"># File lib/atom/text.rb, line 102</span>
|
|
212
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">html</span>
|
|
213
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"xhtml"</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"html"</span>
|
|
214
|
+
<span class="ruby-identifier">to_s</span>
|
|
215
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"text"</span>
|
|
216
|
+
<span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Text</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">to_s</span>
|
|
217
|
+
<span class="ruby-keyword kw">end</span>
|
|
218
|
+
<span class="ruby-keyword kw">end</span>
|
|
152
219
|
</pre>
|
|
153
220
|
</div>
|
|
154
221
|
</div>
|
|
155
222
|
</div>
|
|
156
223
|
|
|
157
|
-
<div id="method-
|
|
158
|
-
<a name="
|
|
224
|
+
<div id="method-M000053" class="method-detail">
|
|
225
|
+
<a name="M000053"></a>
|
|
159
226
|
|
|
160
227
|
<div class="method-heading">
|
|
161
|
-
<a href="#
|
|
228
|
+
<a href="#M000053" class="method-signature">
|
|
162
229
|
<span class="method-name">to_s</span><span class="method-args">()</span>
|
|
163
230
|
</a>
|
|
164
231
|
</div>
|
|
165
232
|
|
|
166
233
|
<div class="method-description">
|
|
167
234
|
<p><a class="source-toggle" href="#"
|
|
168
|
-
onclick="toggleCode('
|
|
169
|
-
<div class="method-source-code" id="
|
|
235
|
+
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
|
236
|
+
<div class="method-source-code" id="M000053-source">
|
|
170
237
|
<pre>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
238
|
+
<span class="ruby-comment cmt"># File lib/atom/text.rb, line 89</span>
|
|
239
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
|
240
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'xhtml'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@content</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@content</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'div'</span>
|
|
241
|
+
<span class="ruby-ivar">@content</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">to_s</span>
|
|
242
|
+
<span class="ruby-keyword kw">else</span>
|
|
243
|
+
<span class="ruby-ivar">@content</span>.<span class="ruby-identifier">to_s</span>
|
|
244
|
+
<span class="ruby-keyword kw">end</span>
|
|
245
|
+
<span class="ruby-keyword kw">end</span>
|
|
179
246
|
</pre>
|
|
180
247
|
</div>
|
|
181
248
|
</div>
|
|
182
249
|
</div>
|
|
183
250
|
|
|
184
|
-
<div id="method-
|
|
185
|
-
<a name="
|
|
251
|
+
<div id="method-M000052" class="method-detail">
|
|
252
|
+
<a name="M000052"></a>
|
|
186
253
|
|
|
187
254
|
<div class="method-heading">
|
|
188
|
-
<a href="#
|
|
255
|
+
<a href="#M000052" class="method-signature">
|
|
256
|
+
<span class="method-name">type</span><span class="method-args">()</span>
|
|
257
|
+
</a>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<div class="method-description">
|
|
261
|
+
<p><a class="source-toggle" href="#"
|
|
262
|
+
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
|
263
|
+
<div class="method-source-code" id="M000052-source">
|
|
264
|
+
<pre>
|
|
265
|
+
<span class="ruby-comment cmt"># File lib/atom/text.rb, line 85</span>
|
|
266
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span>
|
|
267
|
+
<span class="ruby-ivar">@type</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@type</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'text'</span>
|
|
268
|
+
<span class="ruby-keyword kw">end</span>
|
|
269
|
+
</pre>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
<div id="method-M000056" class="method-detail">
|
|
275
|
+
<a name="M000056"></a>
|
|
276
|
+
|
|
277
|
+
<div class="method-heading">
|
|
278
|
+
<a href="#M000056" class="method-signature">
|
|
279
|
+
<span class="method-name">type=</span><span class="method-args">(value)</span>
|
|
280
|
+
</a>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div class="method-description">
|
|
284
|
+
<p><a class="source-toggle" href="#"
|
|
285
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
|
286
|
+
<div class="method-source-code" id="M000056-source">
|
|
287
|
+
<pre>
|
|
288
|
+
<span class="ruby-comment cmt"># File lib/atom/text.rb, line 143</span>
|
|
289
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type=</span> <span class="ruby-identifier">value</span>
|
|
290
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_type?</span> <span class="ruby-identifier">value</span>
|
|
291
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseError</span>, <span class="ruby-node">"atomTextConstruct type '#{value}' is meaningless"</span>
|
|
292
|
+
<span class="ruby-keyword kw">end</span>
|
|
293
|
+
|
|
294
|
+
<span class="ruby-ivar">@type</span> = <span class="ruby-identifier">value</span>
|
|
295
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"xhtml"</span>
|
|
296
|
+
<span class="ruby-keyword kw">begin</span>
|
|
297
|
+
<span class="ruby-identifier">parse_xhtml_content</span>
|
|
298
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseException</span>
|
|
299
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseError</span>, <span class="ruby-node">"#{@content.inspect} can't be parsed as XML"</span>
|
|
300
|
+
<span class="ruby-keyword kw">end</span>
|
|
301
|
+
<span class="ruby-keyword kw">end</span>
|
|
302
|
+
<span class="ruby-keyword kw">end</span>
|
|
303
|
+
</pre>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<div id="method-M000055" class="method-detail">
|
|
309
|
+
<a name="M000055"></a>
|
|
310
|
+
|
|
311
|
+
<div class="method-heading">
|
|
312
|
+
<a href="#M000055" class="method-signature">
|
|
189
313
|
<span class="method-name">xml</span><span class="method-args">()</span>
|
|
190
314
|
</a>
|
|
191
315
|
</div>
|
|
192
316
|
|
|
193
317
|
<div class="method-description">
|
|
194
318
|
<p>
|
|
195
|
-
|
|
319
|
+
attempts to parse the content of this element as XML and return it as an
|
|
320
|
+
array of REXML::Elements.
|
|
321
|
+
</p>
|
|
322
|
+
<p>
|
|
323
|
+
If self["<a href="Text.html#M000052">type</a>"] is "<a
|
|
324
|
+
href="Text.html#M000054">html</a>" and Hpricot is installed, it will
|
|
325
|
+
be converted to <a href="../XHTML.html">XHTML</a> first.
|
|
196
326
|
</p>
|
|
197
327
|
<p><a class="source-toggle" href="#"
|
|
198
|
-
onclick="toggleCode('
|
|
199
|
-
<div class="method-source-code" id="
|
|
328
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
|
329
|
+
<div class="method-source-code" id="M000055-source">
|
|
200
330
|
<pre>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
331
|
+
<span class="ruby-comment cmt"># File lib/atom/text.rb, line 115</span>
|
|
332
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xml</span>
|
|
333
|
+
<span class="ruby-identifier">xml</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span> <span class="ruby-value str">'div'</span>
|
|
334
|
+
|
|
335
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"xhtml"</span>
|
|
336
|
+
<span class="ruby-ivar">@content</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span> <span class="ruby-identifier">xml</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span> }
|
|
337
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"text"</span>
|
|
338
|
+
<span class="ruby-identifier">xml</span>.<span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>
|
|
339
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"html"</span>
|
|
340
|
+
<span class="ruby-keyword kw">begin</span>
|
|
341
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">"hpricot"</span>
|
|
342
|
+
<span class="ruby-keyword kw">rescue</span>
|
|
343
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Turning HTML content into XML requires Hpricot."</span>
|
|
344
|
+
<span class="ruby-keyword kw">end</span>
|
|
345
|
+
|
|
346
|
+
<span class="ruby-identifier">fixed</span> = <span class="ruby-constant">Hpricot</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">:xhtml_strict</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>)
|
|
347
|
+
<span class="ruby-identifier">xml</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"<div>#{fixed}</div>"</span>).<span class="ruby-identifier">root</span>
|
|
348
|
+
<span class="ruby-keyword kw">else</span>
|
|
349
|
+
<span class="ruby-comment cmt"># Not XHTML, HTML, or text - return the REXML::Element, leave it up to the user to parse the content</span>
|
|
350
|
+
<span class="ruby-identifier">xml</span> = <span class="ruby-ivar">@content</span>
|
|
351
|
+
<span class="ruby-keyword kw">end</span>
|
|
352
|
+
|
|
353
|
+
<span class="ruby-identifier">xml</span>
|
|
354
|
+
<span class="ruby-keyword kw">end</span>
|
|
212
355
|
</pre>
|
|
213
356
|
</div>
|
|
214
357
|
</div>
|