prismic.io 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +6 -14
- data/docs/Prismic.html +1074 -0
- data/docs/Prismic/API.html +2987 -0
- data/docs/Prismic/API/BadPrismicResponseError.html +147 -0
- data/docs/Prismic/API/OAuth.html +560 -0
- data/docs/Prismic/API/PrismicWSAuthError.html +375 -0
- data/docs/Prismic/API/PrismicWSConnectionError.html +221 -0
- data/docs/Prismic/BasicNullCache.html +255 -0
- data/docs/Prismic/DefaultHTTPClient.html +350 -0
- data/docs/Prismic/Document.html +873 -0
- data/docs/Prismic/Error.html +418 -0
- data/docs/Prismic/Experiment.html +633 -0
- data/docs/Prismic/Experiments.html +633 -0
- data/docs/Prismic/Field.html +424 -0
- data/docs/Prismic/Form.html +827 -0
- data/docs/Prismic/Fragments.html +117 -0
- data/docs/Prismic/Fragments/Color.html +632 -0
- data/docs/Prismic/Fragments/Date.html +399 -0
- data/docs/Prismic/Fragments/DocumentLink.html +1048 -0
- data/docs/Prismic/Fragments/Embed.html +679 -0
- data/docs/Prismic/Fragments/FileLink.html +604 -0
- data/docs/Prismic/Fragments/Fragment.html +339 -0
- data/docs/Prismic/Fragments/GeoPoint.html +469 -0
- data/docs/Prismic/Fragments/Group.html +710 -0
- data/docs/Prismic/Fragments/GroupDocument.html +382 -0
- data/docs/Prismic/Fragments/Image.html +780 -0
- data/docs/Prismic/Fragments/Image/View.html +759 -0
- data/docs/Prismic/Fragments/Image/ViewDoesNotExistException.html +147 -0
- data/docs/Prismic/Fragments/ImageLink.html +336 -0
- data/docs/Prismic/Fragments/Link.html +412 -0
- data/docs/Prismic/Fragments/Multiple.html +513 -0
- data/docs/Prismic/Fragments/Number.html +401 -0
- data/docs/Prismic/Fragments/Select.html +349 -0
- data/docs/Prismic/Fragments/Separator.html +396 -0
- data/docs/Prismic/Fragments/Slice.html +632 -0
- data/docs/Prismic/Fragments/SliceZone.html +474 -0
- data/docs/Prismic/Fragments/StructuredText.html +664 -0
- data/docs/Prismic/Fragments/StructuredText/Block.html +232 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Embed.html +367 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Heading.html +366 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Image.html +755 -0
- data/docs/Prismic/Fragments/StructuredText/Block/ListItem.html +372 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Paragraph.html +223 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Preformatted.html +223 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Text.html +818 -0
- data/docs/Prismic/Fragments/StructuredText/BlockGroup.html +423 -0
- data/docs/Prismic/Fragments/StructuredText/Span.html +384 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Em.html +213 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Hyperlink.html +359 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Label.html +362 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Strong.html +213 -0
- data/docs/Prismic/Fragments/Text.html +396 -0
- data/docs/Prismic/Fragments/Timestamp.html +399 -0
- data/docs/Prismic/Fragments/WebLink.html +340 -0
- data/docs/Prismic/HtmlSerializer.html +270 -0
- data/docs/Prismic/JsonParser.html +1764 -0
- data/docs/Prismic/LinkResolver.html +399 -0
- data/docs/Prismic/LruCache.html +1140 -0
- data/docs/Prismic/Predicates.html +1630 -0
- data/docs/Prismic/Ref.html +643 -0
- data/docs/Prismic/Response.html +1159 -0
- data/docs/Prismic/SearchForm.html +2172 -0
- data/docs/Prismic/SearchForm/AuthenticationException.html +147 -0
- data/docs/Prismic/SearchForm/AuthorizationException.html +147 -0
- data/docs/Prismic/SearchForm/FormSearchException.html +147 -0
- data/docs/Prismic/SearchForm/NoRefSetException.html +147 -0
- data/docs/Prismic/SearchForm/RefNotFoundException.html +147 -0
- data/docs/Prismic/SearchForm/UnsupportedFormKind.html +147 -0
- data/docs/Prismic/Variation.html +546 -0
- data/docs/Prismic/WithFragments.html +1803 -0
- data/docs/_index.html +752 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +57 -0
- data/docs/css/style.css +339 -0
- data/docs/file.README.html +180 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +26 -0
- data/docs/index.html +180 -0
- data/docs/js/app.js +219 -0
- data/docs/js/full_list.js +178 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +2381 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/prismic.rb +17 -1
- data/lib/prismic/api.rb +31 -19
- data/lib/prismic/fragments/image.rb +6 -0
- data/lib/prismic/json_parsers.rb +2 -0
- data/lib/prismic/version.rb +1 -1
- data/spec/cache_spec.rb +12 -12
- data/spec/json_parsers_spec.rb +10 -5
- data/spec/oauth_spec.rb +3 -3
- data/spec/prismic_spec.rb +7 -7
- data/spec/responses_mocks/api.json +12 -12
- data/spec/responses_mocks/document.json +4 -2
- data/spec/responses_mocks/document_with_unknown_fragment.json +2 -0
- data/spec/responses_mocks/fragments.json +5 -3
- data/spec/responses_mocks/slices.json +2 -0
- data/spec/responses_mocks/structured_text_with_labels.json +2 -2
- data/spec/simple_search_spec.rb +55 -0
- metadata +103 -24
- data/deploy-doc.sh +0 -9
- data/spec/doc_spec.rb +0 -298
- data/spec/lesbonneschoses_spec.rb +0 -228
@@ -0,0 +1,223 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Prismic::Fragments::StructuredText::Block::Preformatted
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../../../';
|
20
|
+
framesUrl = "../../../../frames.html#!Prismic/Fragments/StructuredText/Block/Preformatted.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../../../_index.html">Index (P)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../../../Prismic.html" title="Prismic (module)">Prismic</a></span></span> » <span class='title'><span class='object_link'><a href="../../../Fragments.html" title="Prismic::Fragments (module)">Fragments</a></span></span> » <span class='title'><span class='object_link'><a href="../../StructuredText.html" title="Prismic::Fragments::StructuredText (class)">StructuredText</a></span></span> » <span class='title'><span class='object_link'><a href="../Block.html" title="Prismic::Fragments::StructuredText::Block (class)">Block</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Preformatted</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Prismic::Fragments::StructuredText::Block::Preformatted
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName"><span class='object_link'><a href="Text.html" title="Prismic::Fragments::StructuredText::Block::Text (class)">Text</a></span></span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next"><span class='object_link'><a href="Text.html" title="Prismic::Fragments::StructuredText::Block::Text (class)">Text</a></span></li>
|
82
|
+
|
83
|
+
<li class="next">Prismic::Fragments::StructuredText::Block::Preformatted</li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
<a href="#" class="inheritanceTree">show all</a>
|
87
|
+
|
88
|
+
</dd>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/prismic/fragments/structured_text.rb</dd>
|
100
|
+
|
101
|
+
</dl>
|
102
|
+
<div class="clear"></div>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>Instance Attribute Summary</h2>
|
111
|
+
|
112
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Text.html" title="Prismic::Fragments::StructuredText::Block::Text (class)">Text</a></span></h3>
|
113
|
+
<p class="inherited"><span class='object_link'><a href="Text.html#label-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#label (method)">#label</a></span>, <span class='object_link'><a href="Text.html#spans-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#spans (method)">#spans</a></span>, <span class='object_link'><a href="Text.html#text-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#text (method)">#text</a></span></p>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<h2>
|
118
|
+
Instance Method Summary
|
119
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
120
|
+
</h2>
|
121
|
+
|
122
|
+
<ul class="summary">
|
123
|
+
|
124
|
+
<li class="public ">
|
125
|
+
<span class="summary_signature">
|
126
|
+
|
127
|
+
<a href="#as_html-instance_method" title="#as_html (instance method)">- (Object) <strong>as_html</strong>(link_resolver = nil, html_serializer = nil) </a>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
</span>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
142
|
+
|
143
|
+
</li>
|
144
|
+
|
145
|
+
|
146
|
+
</ul>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Text.html" title="Prismic::Fragments::StructuredText::Block::Text (class)">Text</a></span></h3>
|
159
|
+
<p class="inherited"><span class='object_link'><a href="Text.html#as_text-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#as_text (method)">#as_text</a></span>, <span class='object_link'><a href="Text.html#initialize-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Text.html#prepare_spans-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#prepare_spans (method)">#prepare_spans</a></span>, <span class='object_link'><a href="Text.html#serialize-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#serialize (method)">#serialize</a></span></p>
|
160
|
+
<div id="constructor_details" class="method_details_list">
|
161
|
+
<h2>Constructor Details</h2>
|
162
|
+
|
163
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Text.html#initialize-instance_method" title="Prismic::Fragments::StructuredText::Block::Text#initialize (method)">Prismic::Fragments::StructuredText::Block::Text</a></span></p>
|
164
|
+
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
<div id="instance_method_details" class="method_details_list">
|
169
|
+
<h2>Instance Method Details</h2>
|
170
|
+
|
171
|
+
|
172
|
+
<div class="method_details first">
|
173
|
+
<h3 class="signature first" id="as_html-instance_method">
|
174
|
+
|
175
|
+
- (<tt>Object</tt>) <strong>as_html</strong>(link_resolver = nil, html_serializer = nil)
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</h3><table class="source_code">
|
182
|
+
<tr>
|
183
|
+
<td>
|
184
|
+
<pre class="lines">
|
185
|
+
|
186
|
+
|
187
|
+
294
|
188
|
+
295
|
189
|
+
296
|
190
|
+
297
|
191
|
+
298
|
192
|
+
299
|
193
|
+
300
|
194
|
+
301</pre>
|
195
|
+
</td>
|
196
|
+
<td>
|
197
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 294</span>
|
198
|
+
|
199
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_as_html'>as_html</span><span class='lparen'>(</span><span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
200
|
+
<span class='id identifier rubyid_custom_html'>custom_html</span> <span class='op'>=</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span> <span class='op'>&&</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='period'>.</span><span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='kw'>super</span><span class='rparen'>)</span>
|
201
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_custom_html'>custom_html</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
202
|
+
<span class='tstring'><span class='tstring_beg'>%(</span><span class='tstring_content'><pre</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_class_code'>class_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='embexpr_beg'>#{</span><span class='kw'>super</span><span class='embexpr_end'>}</span><span class='tstring_content'></pre></span><span class='tstring_end'>)</span></span>
|
203
|
+
<span class='kw'>else</span>
|
204
|
+
<span class='id identifier rubyid_custom_html'>custom_html</span>
|
205
|
+
<span class='kw'>end</span>
|
206
|
+
<span class='kw'>end</span></pre>
|
207
|
+
</td>
|
208
|
+
</tr>
|
209
|
+
</table>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div id="footer">
|
217
|
+
Generated on Tue Sep 27 10:47:08 2016 by
|
218
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
219
|
+
0.8.7.4 (ruby-2.0.0).
|
220
|
+
</div>
|
221
|
+
|
222
|
+
</body>
|
223
|
+
</html>
|
@@ -0,0 +1,818 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Prismic::Fragments::StructuredText::Block::Text
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../../../';
|
20
|
+
framesUrl = "../../../../frames.html#!Prismic/Fragments/StructuredText/Block/Text.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../../../_index.html">Index (T)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../../../Prismic.html" title="Prismic (module)">Prismic</a></span></span> » <span class='title'><span class='object_link'><a href="../../../Fragments.html" title="Prismic::Fragments (module)">Fragments</a></span></span> » <span class='title'><span class='object_link'><a href="../../StructuredText.html" title="Prismic::Fragments::StructuredText (class)">StructuredText</a></span></span> » <span class='title'><span class='object_link'><a href="../Block.html" title="Prismic::Fragments::StructuredText::Block (class)">Block</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Text</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Prismic::Fragments::StructuredText::Block::Text
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Prismic::Fragments::StructuredText::Block::Text</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/prismic/fragments/structured_text.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<div id="subclasses">
|
103
|
+
<h2>Direct Known Subclasses</h2>
|
104
|
+
<p class="children"><span class='object_link'><a href="Heading.html" title="Prismic::Fragments::StructuredText::Block::Heading (class)">Heading</a></span>, <span class='object_link'><a href="ListItem.html" title="Prismic::Fragments::StructuredText::Block::ListItem (class)">ListItem</a></span>, <span class='object_link'><a href="Paragraph.html" title="Prismic::Fragments::StructuredText::Block::Paragraph (class)">Paragraph</a></span>, <span class='object_link'><a href="Preformatted.html" title="Prismic::Fragments::StructuredText::Block::Preformatted (class)">Preformatted</a></span></p>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#label-instance_method" title="#label (instance method)">- (String) <strong>label</strong> </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>May be nil.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#spans-instance_method" title="#spans (instance method)">- (Array<Span>) <strong>spans</strong> </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
160
|
+
|
161
|
+
</li>
|
162
|
+
|
163
|
+
|
164
|
+
<li class="public ">
|
165
|
+
<span class="summary_signature">
|
166
|
+
|
167
|
+
<a href="#text-instance_method" title="#text (instance method)">- (String) <strong>text</strong> </a>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
</span>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
|
189
|
+
</ul>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<h2>
|
196
|
+
Instance Method Summary
|
197
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
198
|
+
</h2>
|
199
|
+
|
200
|
+
<ul class="summary">
|
201
|
+
|
202
|
+
<li class="public ">
|
203
|
+
<span class="summary_signature">
|
204
|
+
|
205
|
+
<a href="#as_html-instance_method" title="#as_html (instance method)">- (Object) <strong>as_html</strong>(link_resolver = nil, html_serializer = nil) </a>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</span>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
<li class="public ">
|
225
|
+
<span class="summary_signature">
|
226
|
+
|
227
|
+
<a href="#as_text-instance_method" title="#as_text (instance method)">- (Object) <strong>as_text</strong> </a>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</span>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'><p>Zero-formatted textual value of the block.</p>
|
242
|
+
</div></span>
|
243
|
+
|
244
|
+
</li>
|
245
|
+
|
246
|
+
|
247
|
+
<li class="public ">
|
248
|
+
<span class="summary_signature">
|
249
|
+
|
250
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Text) <strong>initialize</strong>(text, spans, label = nil) </a>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
</span>
|
255
|
+
|
256
|
+
|
257
|
+
<span class="note title constructor">constructor</span>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Text.</p>
|
267
|
+
</div></span>
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
|
272
|
+
<li class="public ">
|
273
|
+
<span class="summary_signature">
|
274
|
+
|
275
|
+
<a href="#prepare_spans-instance_method" title="#prepare_spans (instance method)">- (Object) <strong>prepare_spans</strong> </a>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
</span>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<span class="summary_desc"><div class='inline'><p>Building two span Hashes: * start_spans, with the starting positions as keys, and spans as values * end_spans, with the ending positions as keys, and spans as values.</p>
|
290
|
+
</div></span>
|
291
|
+
|
292
|
+
</li>
|
293
|
+
|
294
|
+
|
295
|
+
<li class="public ">
|
296
|
+
<span class="summary_signature">
|
297
|
+
|
298
|
+
<a href="#serialize-instance_method" title="#serialize (instance method)">- (Object) <strong>serialize</strong>(elt, text, link_resolver, html_serializer) </a>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
</span>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
|
317
|
+
</ul>
|
318
|
+
|
319
|
+
|
320
|
+
<div id="constructor_details" class="method_details_list">
|
321
|
+
<h2>Constructor Details</h2>
|
322
|
+
|
323
|
+
<div class="method_details first">
|
324
|
+
<h3 class="signature first" id="initialize-instance_method">
|
325
|
+
|
326
|
+
- (<tt><span class='object_link'><a href="" title="Prismic::Fragments::StructuredText::Block::Text (class)">Text</a></span></tt>) <strong>initialize</strong>(text, spans, label = nil)
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
</h3><div class="docstring">
|
333
|
+
<div class="discussion">
|
334
|
+
<p>Returns a new instance of Text</p>
|
335
|
+
|
336
|
+
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
<div class="tags">
|
340
|
+
|
341
|
+
|
342
|
+
</div><table class="source_code">
|
343
|
+
<tr>
|
344
|
+
<td>
|
345
|
+
<pre class="lines">
|
346
|
+
|
347
|
+
|
348
|
+
167
|
349
|
+
168
|
350
|
+
169
|
351
|
+
170
|
352
|
+
171</pre>
|
353
|
+
</td>
|
354
|
+
<td>
|
355
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 167</span>
|
356
|
+
|
357
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='id identifier rubyid_spans'>spans</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
358
|
+
<span class='ivar'>@text</span> <span class='op'>=</span> <span class='id identifier rubyid_text'>text</span>
|
359
|
+
<span class='ivar'>@spans</span> <span class='op'>=</span> <span class='id identifier rubyid_spans'>spans</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_span'>span</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span> <span class='op'><</span> <span class='id identifier rubyid_span'>span</span><span class='period'>.</span><span class='id identifier rubyid_end'>end</span><span class='rbrace'>}</span>
|
360
|
+
<span class='ivar'>@label</span> <span class='op'>=</span> <span class='id identifier rubyid_label'>label</span>
|
361
|
+
<span class='kw'>end</span></pre>
|
362
|
+
</td>
|
363
|
+
</tr>
|
364
|
+
</table>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
</div>
|
368
|
+
|
369
|
+
<div id="instance_attr_details" class="attr_details">
|
370
|
+
<h2>Instance Attribute Details</h2>
|
371
|
+
|
372
|
+
|
373
|
+
<span id="label=-instance_method"></span>
|
374
|
+
<div class="method_details first">
|
375
|
+
<h3 class="signature first" id="label-instance_method">
|
376
|
+
|
377
|
+
- (<tt>String</tt>) <strong>label</strong>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
</h3><div class="docstring">
|
384
|
+
<div class="discussion">
|
385
|
+
<p>Returns may be nil</p>
|
386
|
+
|
387
|
+
|
388
|
+
</div>
|
389
|
+
</div>
|
390
|
+
<div class="tags">
|
391
|
+
|
392
|
+
<p class="tag_title">Returns:</p>
|
393
|
+
<ul class="return">
|
394
|
+
|
395
|
+
<li>
|
396
|
+
|
397
|
+
|
398
|
+
<span class='type'>(<tt>String</tt>)</span>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
—
|
403
|
+
<div class='inline'><p>may be nil</p>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
|
408
|
+
</ul>
|
409
|
+
|
410
|
+
</div><table class="source_code">
|
411
|
+
<tr>
|
412
|
+
<td>
|
413
|
+
<pre class="lines">
|
414
|
+
|
415
|
+
|
416
|
+
165
|
417
|
+
166
|
418
|
+
167</pre>
|
419
|
+
</td>
|
420
|
+
<td>
|
421
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 165</span>
|
422
|
+
|
423
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_label'>label</span>
|
424
|
+
<span class='ivar'>@label</span>
|
425
|
+
<span class='kw'>end</span></pre>
|
426
|
+
</td>
|
427
|
+
</tr>
|
428
|
+
</table>
|
429
|
+
</div>
|
430
|
+
|
431
|
+
|
432
|
+
<span id="spans=-instance_method"></span>
|
433
|
+
<div class="method_details ">
|
434
|
+
<h3 class="signature " id="spans-instance_method">
|
435
|
+
|
436
|
+
- (<tt>Array<<span class='object_link'><a href="../Span.html" title="Prismic::Fragments::StructuredText::Span (class)">Span</a></span>></tt>) <strong>spans</strong>
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
</h3><div class="docstring">
|
443
|
+
<div class="discussion">
|
444
|
+
|
445
|
+
|
446
|
+
</div>
|
447
|
+
</div>
|
448
|
+
<div class="tags">
|
449
|
+
|
450
|
+
<p class="tag_title">Returns:</p>
|
451
|
+
<ul class="return">
|
452
|
+
|
453
|
+
<li>
|
454
|
+
|
455
|
+
|
456
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="../Span.html" title="Prismic::Fragments::StructuredText::Span (class)">Span</a></span>></tt>)</span>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
</li>
|
461
|
+
|
462
|
+
</ul>
|
463
|
+
|
464
|
+
</div><table class="source_code">
|
465
|
+
<tr>
|
466
|
+
<td>
|
467
|
+
<pre class="lines">
|
468
|
+
|
469
|
+
|
470
|
+
163
|
471
|
+
164
|
472
|
+
165</pre>
|
473
|
+
</td>
|
474
|
+
<td>
|
475
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 163</span>
|
476
|
+
|
477
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_spans'>spans</span>
|
478
|
+
<span class='ivar'>@spans</span>
|
479
|
+
<span class='kw'>end</span></pre>
|
480
|
+
</td>
|
481
|
+
</tr>
|
482
|
+
</table>
|
483
|
+
</div>
|
484
|
+
|
485
|
+
|
486
|
+
<span id="text=-instance_method"></span>
|
487
|
+
<div class="method_details ">
|
488
|
+
<h3 class="signature " id="text-instance_method">
|
489
|
+
|
490
|
+
- (<tt>String</tt>) <strong>text</strong>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
</h3><div class="docstring">
|
497
|
+
<div class="discussion">
|
498
|
+
|
499
|
+
|
500
|
+
</div>
|
501
|
+
</div>
|
502
|
+
<div class="tags">
|
503
|
+
|
504
|
+
<p class="tag_title">Returns:</p>
|
505
|
+
<ul class="return">
|
506
|
+
|
507
|
+
<li>
|
508
|
+
|
509
|
+
|
510
|
+
<span class='type'>(<tt>String</tt>)</span>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
</li>
|
515
|
+
|
516
|
+
</ul>
|
517
|
+
|
518
|
+
</div><table class="source_code">
|
519
|
+
<tr>
|
520
|
+
<td>
|
521
|
+
<pre class="lines">
|
522
|
+
|
523
|
+
|
524
|
+
161
|
525
|
+
162
|
526
|
+
163</pre>
|
527
|
+
</td>
|
528
|
+
<td>
|
529
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 161</span>
|
530
|
+
|
531
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_text'>text</span>
|
532
|
+
<span class='ivar'>@text</span>
|
533
|
+
<span class='kw'>end</span></pre>
|
534
|
+
</td>
|
535
|
+
</tr>
|
536
|
+
</table>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
</div>
|
540
|
+
|
541
|
+
|
542
|
+
<div id="instance_method_details" class="method_details_list">
|
543
|
+
<h2>Instance Method Details</h2>
|
544
|
+
|
545
|
+
|
546
|
+
<div class="method_details first">
|
547
|
+
<h3 class="signature first" id="as_html-instance_method">
|
548
|
+
|
549
|
+
- (<tt>Object</tt>) <strong>as_html</strong>(link_resolver = nil, html_serializer = nil)
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
</h3><table class="source_code">
|
556
|
+
<tr>
|
557
|
+
<td>
|
558
|
+
<pre class="lines">
|
559
|
+
|
560
|
+
|
561
|
+
177
|
562
|
+
178
|
563
|
+
179
|
564
|
+
180
|
565
|
+
181
|
566
|
+
182
|
567
|
+
183
|
568
|
+
184
|
569
|
+
185
|
570
|
+
186
|
571
|
+
187
|
572
|
+
188
|
573
|
+
189
|
574
|
+
190
|
575
|
+
191
|
576
|
+
192
|
577
|
+
193
|
578
|
+
194
|
579
|
+
195
|
580
|
+
196
|
581
|
+
197
|
582
|
+
198
|
583
|
+
199
|
584
|
+
200
|
585
|
+
201
|
586
|
+
202
|
587
|
+
203
|
588
|
+
204
|
589
|
+
205
|
590
|
+
206
|
591
|
+
207
|
592
|
+
208
|
593
|
+
209
|
594
|
+
210
|
595
|
+
211
|
596
|
+
212
|
597
|
+
213
|
598
|
+
214</pre>
|
599
|
+
</td>
|
600
|
+
<td>
|
601
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 177</span>
|
602
|
+
|
603
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_as_html'>as_html</span><span class='lparen'>(</span><span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
604
|
+
<span class='id identifier rubyid_html'>html</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
605
|
+
<span class='comment'># Getting Hashes of spanning tags to insert, sorted by starting position, and by ending position
|
606
|
+
</span> <span class='id identifier rubyid_start_spans'>start_spans</span><span class='comma'>,</span> <span class='id identifier rubyid_end_spans'>end_spans</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_spans'>prepare_spans</span>
|
607
|
+
<span class='comment'># Open tags
|
608
|
+
</span> <span class='id identifier rubyid_stack'>stack</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
609
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>+</span> <span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_pos'>pos</span><span class='op'>|</span> <span class='comment'># Looping to length + 1 to catch closing tags
|
610
|
+
</span> <span class='id identifier rubyid_end_spans'>end_spans</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
|
611
|
+
<span class='comment'># Close a tag
|
612
|
+
</span> <span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_stack'>stack</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
|
613
|
+
<span class='id identifier rubyid_inner_html'>inner_html</span> <span class='op'>=</span> <span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='lbracket'>[</span><span class='symbol'>:span</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_tag'>tag</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='comma'>,</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='rparen'>)</span>
|
614
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_stack'>stack</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
615
|
+
<span class='comment'># The tag was top-level
|
616
|
+
</span> <span class='id identifier rubyid_html'>html</span> <span class='op'>+=</span> <span class='id identifier rubyid_inner_html'>inner_html</span>
|
617
|
+
<span class='kw'>else</span>
|
618
|
+
<span class='comment'># Add the content to the parent tag
|
619
|
+
</span> <span class='id identifier rubyid_stack'>stack</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='id identifier rubyid_inner_html'>inner_html</span>
|
620
|
+
<span class='kw'>end</span>
|
621
|
+
<span class='kw'>end</span>
|
622
|
+
<span class='id identifier rubyid_start_spans'>start_spans</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tag'>tag</span><span class='op'>|</span>
|
623
|
+
<span class='comment'># Open a tag
|
624
|
+
</span> <span class='id identifier rubyid_stack'>stack</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='lbrace'>{</span>
|
625
|
+
<span class='symbol'>:span</span> <span class='op'>=></span> <span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span>
|
626
|
+
<span class='symbol'>:html</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
627
|
+
<span class='rbrace'>}</span><span class='rparen'>)</span>
|
628
|
+
<span class='kw'>end</span>
|
629
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_pos'>pos</span> <span class='op'><</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
630
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_stack'>stack</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
631
|
+
<span class='comment'># Top level text
|
632
|
+
</span> <span class='id identifier rubyid_html'>html</span> <span class='op'>+=</span> <span class='id identifier rubyid_cgi_escape_html'>cgi_escape_html</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
633
|
+
<span class='kw'>else</span>
|
634
|
+
<span class='comment'># Inner text of a span
|
635
|
+
</span> <span class='id identifier rubyid_stack'>stack</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:html</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='id identifier rubyid_cgi_escape_html'>cgi_escape_html</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
636
|
+
<span class='kw'>end</span>
|
637
|
+
<span class='kw'>end</span>
|
638
|
+
<span class='kw'>end</span>
|
639
|
+
<span class='id identifier rubyid_html'>html</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'><br></span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
640
|
+
<span class='kw'>end</span></pre>
|
641
|
+
</td>
|
642
|
+
</tr>
|
643
|
+
</table>
|
644
|
+
</div>
|
645
|
+
|
646
|
+
<div class="method_details ">
|
647
|
+
<h3 class="signature " id="as_text-instance_method">
|
648
|
+
|
649
|
+
- (<tt>Object</tt>) <strong>as_text</strong>
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
</h3><div class="docstring">
|
656
|
+
<div class="discussion">
|
657
|
+
<p>Zero-formatted textual value of the block.</p>
|
658
|
+
|
659
|
+
|
660
|
+
</div>
|
661
|
+
</div>
|
662
|
+
<div class="tags">
|
663
|
+
|
664
|
+
<p class="tag_title">Returns:</p>
|
665
|
+
<ul class="return">
|
666
|
+
|
667
|
+
<li>
|
668
|
+
|
669
|
+
|
670
|
+
<span class='type'></span>
|
671
|
+
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
<div class='inline'><p>The textual value.</p>
|
676
|
+
</div>
|
677
|
+
|
678
|
+
</li>
|
679
|
+
|
680
|
+
</ul>
|
681
|
+
|
682
|
+
</div><table class="source_code">
|
683
|
+
<tr>
|
684
|
+
<td>
|
685
|
+
<pre class="lines">
|
686
|
+
|
687
|
+
|
688
|
+
248
|
689
|
+
249
|
690
|
+
250</pre>
|
691
|
+
</td>
|
692
|
+
<td>
|
693
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 248</span>
|
694
|
+
|
695
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_as_text'>as_text</span>
|
696
|
+
<span class='ivar'>@text</span>
|
697
|
+
<span class='kw'>end</span></pre>
|
698
|
+
</td>
|
699
|
+
</tr>
|
700
|
+
</table>
|
701
|
+
</div>
|
702
|
+
|
703
|
+
<div class="method_details ">
|
704
|
+
<h3 class="signature " id="prepare_spans-instance_method">
|
705
|
+
|
706
|
+
- (<tt>Object</tt>) <strong>prepare_spans</strong>
|
707
|
+
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
|
712
|
+
</h3><div class="docstring">
|
713
|
+
<div class="discussion">
|
714
|
+
<p>Building two span Hashes:
|
715
|
+
* start_spans, with the starting positions as keys, and spans as values
|
716
|
+
* end_spans, with the ending positions as keys, and spans as values</p>
|
717
|
+
|
718
|
+
|
719
|
+
</div>
|
720
|
+
</div>
|
721
|
+
<div class="tags">
|
722
|
+
|
723
|
+
|
724
|
+
</div><table class="source_code">
|
725
|
+
<tr>
|
726
|
+
<td>
|
727
|
+
<pre class="lines">
|
728
|
+
|
729
|
+
|
730
|
+
230
|
731
|
+
231
|
732
|
+
232
|
733
|
+
233
|
734
|
+
234
|
735
|
+
235
|
736
|
+
236
|
737
|
+
237
|
738
|
+
238
|
739
|
+
239
|
740
|
+
240
|
741
|
+
241
|
742
|
+
242
|
743
|
+
243</pre>
|
744
|
+
</td>
|
745
|
+
<td>
|
746
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 230</span>
|
747
|
+
|
748
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_prepare_spans'>prepare_spans</span>
|
749
|
+
<span class='kw'>unless</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@prepared_spans</span><span class='rparen'>)</span>
|
750
|
+
<span class='id identifier rubyid_start_spans'>start_spans</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_h'>h</span><span class='comma'>,</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
|
751
|
+
<span class='id identifier rubyid_end_spans'>end_spans</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_h'>h</span><span class='comma'>,</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
|
752
|
+
<span class='id identifier rubyid_spans'>spans</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span>
|
753
|
+
<span class='id identifier rubyid_start_spans'>start_spans</span><span class='lbracket'>[</span><span class='id identifier rubyid_span'>span</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_span'>span</span>
|
754
|
+
<span class='id identifier rubyid_end_spans'>end_spans</span><span class='lbracket'>[</span><span class='id identifier rubyid_span'>span</span><span class='period'>.</span><span class='id identifier rubyid_end'>end</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_span'>span</span>
|
755
|
+
<span class='rbrace'>}</span>
|
756
|
+
<span class='comment'># Make sure the spans are sorted bigger first to respect the hierarchy
|
757
|
+
</span> <span class='ivar'>@start_spans</span> <span class='op'>=</span> <span class='id identifier rubyid_start_spans'>start_spans</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_spans'>spans</span><span class='op'>|</span> <span class='id identifier rubyid_spans'>spans</span><span class='period'>.</span><span class='id identifier rubyid_sort!'>sort!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_end'>end</span> <span class='op'>-</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span> <span class='op'><=></span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_end'>end</span> <span class='op'>-</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
758
|
+
<span class='ivar'>@end_spans</span> <span class='op'>=</span> <span class='id identifier rubyid_end_spans'>end_spans</span>
|
759
|
+
<span class='kw'>end</span>
|
760
|
+
<span class='lbracket'>[</span><span class='ivar'>@start_spans</span><span class='comma'>,</span> <span class='ivar'>@end_spans</span><span class='rbracket'>]</span>
|
761
|
+
<span class='kw'>end</span></pre>
|
762
|
+
</td>
|
763
|
+
</tr>
|
764
|
+
</table>
|
765
|
+
</div>
|
766
|
+
|
767
|
+
<div class="method_details ">
|
768
|
+
<h3 class="signature " id="serialize-instance_method">
|
769
|
+
|
770
|
+
- (<tt>Object</tt>) <strong>serialize</strong>(elt, text, link_resolver, html_serializer)
|
771
|
+
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
</h3><table class="source_code">
|
777
|
+
<tr>
|
778
|
+
<td>
|
779
|
+
<pre class="lines">
|
780
|
+
|
781
|
+
|
782
|
+
252
|
783
|
+
253
|
784
|
+
254
|
785
|
+
255
|
786
|
+
256
|
787
|
+
257
|
788
|
+
258
|
789
|
+
259</pre>
|
790
|
+
</td>
|
791
|
+
<td>
|
792
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/fragments/structured_text.rb', line 252</span>
|
793
|
+
|
794
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='id identifier rubyid_elt'>elt</span><span class='comma'>,</span> <span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='comma'>,</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='rparen'>)</span>
|
795
|
+
<span class='id identifier rubyid_custom_html'>custom_html</span> <span class='op'>=</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span> <span class='op'>&&</span> <span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='period'>.</span><span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='id identifier rubyid_elt'>elt</span><span class='comma'>,</span> <span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
|
796
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_custom_html'>custom_html</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
797
|
+
<span class='id identifier rubyid_elt'>elt</span><span class='period'>.</span><span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span> <span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='rparen'>)</span>
|
798
|
+
<span class='kw'>else</span>
|
799
|
+
<span class='id identifier rubyid_custom_html'>custom_html</span>
|
800
|
+
<span class='kw'>end</span>
|
801
|
+
<span class='kw'>end</span></pre>
|
802
|
+
</td>
|
803
|
+
</tr>
|
804
|
+
</table>
|
805
|
+
</div>
|
806
|
+
|
807
|
+
</div>
|
808
|
+
|
809
|
+
</div>
|
810
|
+
|
811
|
+
<div id="footer">
|
812
|
+
Generated on Tue Sep 27 10:47:07 2016 by
|
813
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
814
|
+
0.8.7.4 (ruby-2.0.0).
|
815
|
+
</div>
|
816
|
+
|
817
|
+
</body>
|
818
|
+
</html>
|