rpub 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -1
- data/.rspec +0 -1
- data/.travis.yml +3 -4
- data/.yardopts +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +70 -46
- data/Guardfile +6 -0
- data/HISTORY.md +10 -0
- data/README.md +1 -1
- data/Rakefile +7 -2
- data/bin/rpub +64 -1
- data/doc/.gitignore +8 -0
- data/doc/api/Rpub.html +339 -0
- data/doc/api/Rpub/Book.html +983 -0
- data/doc/api/Rpub/Chapter.html +737 -0
- data/doc/api/Rpub/Command.html +356 -0
- data/doc/api/Rpub/Commands.html +117 -0
- data/doc/api/Rpub/Commands/Clean.html +216 -0
- data/doc/api/Rpub/Commands/Compile.html +218 -0
- data/doc/api/Rpub/Commands/Generate.html +242 -0
- data/doc/api/Rpub/Commands/Package.html +230 -0
- data/doc/api/Rpub/Commands/Preview.html +216 -0
- data/doc/api/Rpub/Commands/Stats.html +226 -0
- data/doc/api/Rpub/Compressor.html +687 -0
- data/doc/api/Rpub/Context.html +553 -0
- data/doc/api/Rpub/Document.html +647 -0
- data/doc/api/Rpub/Document/OutlineElement.html +388 -0
- data/doc/api/Rpub/Epub.html +465 -0
- data/doc/api/Rpub/Epub/Container.html +224 -0
- data/doc/api/Rpub/Epub/Content.html +344 -0
- data/doc/api/Rpub/Epub/Cover.html +236 -0
- data/doc/api/Rpub/Epub/HtmlToc.html +240 -0
- data/doc/api/Rpub/Epub/Toc.html +244 -0
- data/doc/api/Rpub/FilesystemSource.html +544 -0
- data/doc/api/Rpub/HashDelegation.html +281 -0
- data/doc/api/Rpub/HashDelegation/ClassMethods.html +175 -0
- data/doc/api/Rpub/MediaType.html +192 -0
- data/doc/api/Rpub/Preview.html +464 -0
- data/doc/api/Rpub/XmlFile.html +457 -0
- data/doc/api/_index.html +405 -0
- data/doc/api/class_list.html +54 -0
- data/doc/api/css/common.css +1 -0
- data/doc/api/css/full_list.css +57 -0
- data/doc/api/css/style.css +339 -0
- data/doc/api/file.HISTORY.html +131 -0
- data/doc/api/file.LICENSE.html +92 -0
- data/doc/api/file.README.html +337 -0
- data/doc/api/file_list.html +62 -0
- data/doc/api/frames.html +26 -0
- data/doc/api/index.html +337 -0
- data/doc/api/js/app.js +219 -0
- data/doc/api/js/full_list.js +178 -0
- data/doc/api/js/jquery.js +4 -0
- data/doc/api/method_list.html +533 -0
- data/doc/api/top-level-namespace.html +112 -0
- data/doc/index.html +312 -0
- data/doc/javascripts/scale.fix.js +17 -0
- data/doc/params.json +1 -0
- data/doc/stylesheets/pygment_trac.css +69 -0
- data/doc/stylesheets/styles.css +255 -0
- data/features/clean.feature +31 -0
- data/features/compile.feature +49 -0
- data/features/embedded_assets.feature +51 -0
- data/features/generate.feature +63 -0
- data/features/layout.feature +41 -0
- data/features/package.feature +30 -0
- data/features/previews.feature +66 -0
- data/features/stats.feature +18 -0
- data/features/step_definitions/general_steps.rb +60 -0
- data/features/styles.feature +33 -0
- data/features/support/env.rb +7 -0
- data/features/table_of_contents.feature +35 -0
- data/lib/rpub.rb +28 -31
- data/lib/rpub/book.rb +9 -16
- data/lib/rpub/chapter.rb +4 -54
- data/lib/rpub/command.rb +32 -0
- data/lib/rpub/commands/clean.rb +4 -49
- data/lib/rpub/commands/compile.rb +4 -49
- data/lib/rpub/commands/generate.rb +10 -67
- data/lib/rpub/commands/package.rb +9 -37
- data/lib/rpub/commands/preview.rb +4 -54
- data/lib/rpub/commands/stats.rb +6 -10
- data/lib/rpub/compressor.rb +3 -3
- data/lib/rpub/context.rb +48 -0
- data/lib/rpub/document.rb +68 -0
- data/lib/rpub/epub.rb +8 -7
- data/lib/rpub/epub/content.rb +9 -30
- data/lib/rpub/epub/cover.rb +1 -8
- data/lib/rpub/epub/html_toc.rb +4 -9
- data/lib/rpub/epub/toc.rb +16 -13
- data/lib/rpub/filesystem_source.rb +47 -0
- data/lib/rpub/media_type.rb +16 -0
- data/lib/rpub/preview.rb +29 -0
- data/lib/rpub/version.rb +1 -1
- data/lib/rpub/xml_file.rb +4 -1
- data/rpub.gemspec +6 -7
- data/spec/rpub/book_spec.rb +45 -45
- data/spec/rpub/chapter_spec.rb +87 -22
- data/spec/rpub/epub/container_spec.rb +3 -5
- data/spec/rpub/epub/content_spec.rb +62 -41
- data/spec/rpub/epub/cover_spec.rb +3 -5
- data/spec/rpub/epub/html_toc_spec.rb +8 -8
- data/spec/rpub/epub/toc_spec.rb +20 -22
- data/spec/rpub_spec.rb +1 -3
- data/spec/spec_helper.rb +28 -0
- data/support/config.yml +1 -0
- data/support/styles.css +3 -3
- metadata +131 -120
- data/lib/rpub/commander.rb +0 -23
- data/lib/rpub/commands/base.rb +0 -33
- data/lib/rpub/commands/help.rb +0 -37
- data/lib/rpub/commands/main.rb +0 -45
- data/lib/rpub/compilation_helpers.rb +0 -73
- data/lib/rpub/subclass_tracker.rb +0 -53
- data/spec/rpub/commands/clean_spec.rb +0 -46
- data/spec/rpub/commands/generate_spec.rb +0 -52
- data/spec/rpub/commands/main_spec.rb +0 -26
- data/spec/rpub/commands/package_spec.rb +0 -33
- data/spec/rpub/commands/preview_spec.rb +0 -43
@@ -0,0 +1,737 @@
|
|
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: Rpub::Chapter
|
8
|
+
|
9
|
+
— Rpub, a simple ePub generator library in Ruby
|
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#!Rpub/Chapter.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 (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Rpub.html" title="Rpub (module)">Rpub</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Chapter</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: Rpub::Chapter
|
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">Rpub::Chapter</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2">Extended by:</dt>
|
92
|
+
<dd class="r2">Forwardable</dd>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dt class="r1 last">Defined in:</dt>
|
101
|
+
<dd class="r1 last">lib/rpub/chapter.rb</dd>
|
102
|
+
|
103
|
+
</dl>
|
104
|
+
<div class="clear"></div>
|
105
|
+
|
106
|
+
<h2>Overview</h2><div class="docstring">
|
107
|
+
<div class="discussion">
|
108
|
+
<p>Representation of a chapter in the book, from a single input file from the
|
109
|
+
project directory. The Chapter object knows how to turn itself into HTML
|
110
|
+
suitable for writing to the epub archive with the appropriate identifiers
|
111
|
+
to be listed in the epub manifest files.</p>
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<div class="tags">
|
117
|
+
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
124
|
+
<ul class="summary">
|
125
|
+
|
126
|
+
<li class="public ">
|
127
|
+
<span class="summary_signature">
|
128
|
+
|
129
|
+
<a href="#content-instance_method" title="#content (instance method)">- (String) <strong>content</strong> </a>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
</span>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<span class="note title readonly">readonly</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<span class="summary_desc"><div class='inline'><p>Raw textual contents of this chapter.</p>
|
149
|
+
</div></span>
|
150
|
+
|
151
|
+
</li>
|
152
|
+
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#layout-instance_method" title="#layout (instance method)">- (String) <strong>layout</strong> </a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<span class="note title readonly">readonly</span>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'><p>Filename of the layout to use, to be passed directly to the Kramdown gem.</p>
|
177
|
+
</div></span>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#number-instance_method" title="#number (instance method)">- (Fixnum) <strong>number</strong> </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="note title readonly">readonly</span>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
<span class="summary_desc"><div class='inline'><p>Chapter number provided by its associated Book object.</p>
|
205
|
+
</div></span>
|
206
|
+
|
207
|
+
</li>
|
208
|
+
|
209
|
+
|
210
|
+
</ul>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<h2>
|
217
|
+
Instance Method Summary
|
218
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
219
|
+
</h2>
|
220
|
+
|
221
|
+
<ul class="summary">
|
222
|
+
|
223
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#filename-instance_method" title="#filename (instance method)">- (String) <strong>filename</strong> </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'><p>Name for the file in the zip to use, based on the title.</p>
|
241
|
+
</div></span>
|
242
|
+
|
243
|
+
</li>
|
244
|
+
|
245
|
+
|
246
|
+
<li class="public ">
|
247
|
+
<span class="summary_signature">
|
248
|
+
|
249
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Chapter) <strong>initialize</strong>(content, number, layout) </a>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</span>
|
254
|
+
|
255
|
+
|
256
|
+
<span class="note title constructor">constructor</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Chapter.</p>
|
266
|
+
</div></span>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
|
271
|
+
<li class="public ">
|
272
|
+
<span class="summary_signature">
|
273
|
+
|
274
|
+
<a href="#uid-instance_method" title="#uid (instance method)">- (String) <strong>uid</strong> </a>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
</span>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<span class="summary_desc"><div class='inline'><p>Unique identifier for this chapter.</p>
|
289
|
+
</div></span>
|
290
|
+
|
291
|
+
</li>
|
292
|
+
|
293
|
+
|
294
|
+
<li class="public ">
|
295
|
+
<span class="summary_signature">
|
296
|
+
|
297
|
+
<a href="#xml_id-instance_method" title="#xml_id (instance method)">- (String) <strong>xml_id</strong> </a>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
</span>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
<span class="summary_desc"><div class='inline'><p>XML-friendly slug for this chapter based on its number.</p>
|
312
|
+
</div></span>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
|
317
|
+
</ul>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
<div id="constructor_details" class="method_details_list">
|
322
|
+
<h2>Constructor Details</h2>
|
323
|
+
|
324
|
+
<div class="method_details first">
|
325
|
+
<h3 class="signature first" id="initialize-instance_method">
|
326
|
+
|
327
|
+
- (<tt><span class='object_link'><a href="" title="Rpub::Chapter (class)">Chapter</a></span></tt>) <strong>initialize</strong>(content, number, layout)
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
</h3><div class="docstring">
|
334
|
+
<div class="discussion">
|
335
|
+
<p>Returns a new instance of Chapter</p>
|
336
|
+
|
337
|
+
|
338
|
+
</div>
|
339
|
+
</div>
|
340
|
+
<div class="tags">
|
341
|
+
|
342
|
+
|
343
|
+
</div><table class="source_code">
|
344
|
+
<tr>
|
345
|
+
<td>
|
346
|
+
<pre class="lines">
|
347
|
+
|
348
|
+
|
349
|
+
19
|
350
|
+
20
|
351
|
+
21
|
352
|
+
22</pre>
|
353
|
+
</td>
|
354
|
+
<td>
|
355
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 19</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_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_number'>number</span><span class='comma'>,</span> <span class='id identifier rubyid_layout'>layout</span><span class='rparen'>)</span>
|
358
|
+
<span class='ivar'>@content</span><span class='comma'>,</span> <span class='ivar'>@number</span><span class='comma'>,</span> <span class='ivar'>@layout</span> <span class='op'>=</span> <span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_number'>number</span><span class='comma'>,</span> <span class='id identifier rubyid_layout'>layout</span>
|
359
|
+
<span class='ivar'>@document</span> <span class='op'>=</span> <span class='const'>Rpub</span><span class='period'>.</span><span class='id identifier rubyid_document_factory'>document_factory</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_layout'>layout</span><span class='rparen'>)</span>
|
360
|
+
<span class='kw'>end</span></pre>
|
361
|
+
</td>
|
362
|
+
</tr>
|
363
|
+
</table>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div id="instance_attr_details" class="attr_details">
|
369
|
+
<h2>Instance Attribute Details</h2>
|
370
|
+
|
371
|
+
|
372
|
+
<span id=""></span>
|
373
|
+
<div class="method_details first">
|
374
|
+
<h3 class="signature first" id="content-instance_method">
|
375
|
+
|
376
|
+
- (<tt>String</tt>) <strong>content</strong> <span class="extras">(readonly)</span>
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
</h3><div class="docstring">
|
383
|
+
<div class="discussion">
|
384
|
+
<p>Returns raw textual contents of this chapter</p>
|
385
|
+
|
386
|
+
|
387
|
+
</div>
|
388
|
+
</div>
|
389
|
+
<div class="tags">
|
390
|
+
|
391
|
+
<p class="tag_title">Returns:</p>
|
392
|
+
<ul class="return">
|
393
|
+
|
394
|
+
<li>
|
395
|
+
|
396
|
+
|
397
|
+
<span class='type'>(<tt>String</tt>)</span>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
—
|
402
|
+
<div class='inline'><p>raw textual contents of this chapter</p>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
</li>
|
406
|
+
|
407
|
+
</ul>
|
408
|
+
|
409
|
+
</div><table class="source_code">
|
410
|
+
<tr>
|
411
|
+
<td>
|
412
|
+
<pre class="lines">
|
413
|
+
|
414
|
+
|
415
|
+
11
|
416
|
+
12
|
417
|
+
13</pre>
|
418
|
+
</td>
|
419
|
+
<td>
|
420
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 11</span>
|
421
|
+
|
422
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span>
|
423
|
+
<span class='ivar'>@content</span>
|
424
|
+
<span class='kw'>end</span></pre>
|
425
|
+
</td>
|
426
|
+
</tr>
|
427
|
+
</table>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
|
431
|
+
<span id=""></span>
|
432
|
+
<div class="method_details ">
|
433
|
+
<h3 class="signature " id="layout-instance_method">
|
434
|
+
|
435
|
+
- (<tt>String</tt>) <strong>layout</strong> <span class="extras">(readonly)</span>
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
</h3><div class="docstring">
|
442
|
+
<div class="discussion">
|
443
|
+
<p>Returns filename of the layout to use, to be passed directly to the Kramdown gem.</p>
|
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>String</tt>)</span>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
—
|
461
|
+
<div class='inline'><p>filename of the layout to use, to be passed directly to the Kramdown gem.</p>
|
462
|
+
</div>
|
463
|
+
|
464
|
+
</li>
|
465
|
+
|
466
|
+
</ul>
|
467
|
+
|
468
|
+
</div><table class="source_code">
|
469
|
+
<tr>
|
470
|
+
<td>
|
471
|
+
<pre class="lines">
|
472
|
+
|
473
|
+
|
474
|
+
17
|
475
|
+
18
|
476
|
+
19</pre>
|
477
|
+
</td>
|
478
|
+
<td>
|
479
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 17</span>
|
480
|
+
|
481
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_layout'>layout</span>
|
482
|
+
<span class='ivar'>@layout</span>
|
483
|
+
<span class='kw'>end</span></pre>
|
484
|
+
</td>
|
485
|
+
</tr>
|
486
|
+
</table>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
|
490
|
+
<span id=""></span>
|
491
|
+
<div class="method_details ">
|
492
|
+
<h3 class="signature " id="number-instance_method">
|
493
|
+
|
494
|
+
- (<tt>Fixnum</tt>) <strong>number</strong> <span class="extras">(readonly)</span>
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
</h3><div class="docstring">
|
501
|
+
<div class="discussion">
|
502
|
+
<p>Returns chapter number provided by its associated Book object</p>
|
503
|
+
|
504
|
+
|
505
|
+
</div>
|
506
|
+
</div>
|
507
|
+
<div class="tags">
|
508
|
+
|
509
|
+
<p class="tag_title">Returns:</p>
|
510
|
+
<ul class="return">
|
511
|
+
|
512
|
+
<li>
|
513
|
+
|
514
|
+
|
515
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
—
|
520
|
+
<div class='inline'><p>chapter number provided by its associated Book object</p>
|
521
|
+
</div>
|
522
|
+
|
523
|
+
</li>
|
524
|
+
|
525
|
+
</ul>
|
526
|
+
|
527
|
+
</div><table class="source_code">
|
528
|
+
<tr>
|
529
|
+
<td>
|
530
|
+
<pre class="lines">
|
531
|
+
|
532
|
+
|
533
|
+
14
|
534
|
+
15
|
535
|
+
16</pre>
|
536
|
+
</td>
|
537
|
+
<td>
|
538
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 14</span>
|
539
|
+
|
540
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_number'>number</span>
|
541
|
+
<span class='ivar'>@number</span>
|
542
|
+
<span class='kw'>end</span></pre>
|
543
|
+
</td>
|
544
|
+
</tr>
|
545
|
+
</table>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
</div>
|
549
|
+
|
550
|
+
|
551
|
+
<div id="instance_method_details" class="method_details_list">
|
552
|
+
<h2>Instance Method Details</h2>
|
553
|
+
|
554
|
+
|
555
|
+
<div class="method_details first">
|
556
|
+
<h3 class="signature first" id="filename-instance_method">
|
557
|
+
|
558
|
+
- (<tt>String</tt>) <strong>filename</strong>
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
</h3><div class="docstring">
|
565
|
+
<div class="discussion">
|
566
|
+
<p>Returns name for the file in the zip to use, based on the title</p>
|
567
|
+
|
568
|
+
|
569
|
+
</div>
|
570
|
+
</div>
|
571
|
+
<div class="tags">
|
572
|
+
|
573
|
+
<p class="tag_title">Returns:</p>
|
574
|
+
<ul class="return">
|
575
|
+
|
576
|
+
<li>
|
577
|
+
|
578
|
+
|
579
|
+
<span class='type'>(<tt>String</tt>)</span>
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
—
|
584
|
+
<div class='inline'><p>name for the file in the zip to use, based on the title</p>
|
585
|
+
</div>
|
586
|
+
|
587
|
+
</li>
|
588
|
+
|
589
|
+
</ul>
|
590
|
+
|
591
|
+
</div><table class="source_code">
|
592
|
+
<tr>
|
593
|
+
<td>
|
594
|
+
<pre class="lines">
|
595
|
+
|
596
|
+
|
597
|
+
35
|
598
|
+
36
|
599
|
+
37</pre>
|
600
|
+
</td>
|
601
|
+
<td>
|
602
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 35</span>
|
603
|
+
|
604
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_filename'>filename</span>
|
605
|
+
<span class='ivar'>@filename</span> <span class='op'>||=</span> <span class='id identifier rubyid_xml_id'>xml_id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span> <span class='op'>+</span> <span class='id identifier rubyid_title'>title</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[^\w\.]</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_squeeze'>squeeze</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_chomp'>chomp</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.html</span><span class='tstring_end'>'</span></span>
|
606
|
+
<span class='kw'>end</span></pre>
|
607
|
+
</td>
|
608
|
+
</tr>
|
609
|
+
</table>
|
610
|
+
</div>
|
611
|
+
|
612
|
+
<div class="method_details ">
|
613
|
+
<h3 class="signature " id="uid-instance_method">
|
614
|
+
|
615
|
+
- (<tt>String</tt>) <strong>uid</strong>
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
</h3><div class="docstring">
|
622
|
+
<div class="discussion">
|
623
|
+
<p>Returns Unique identifier for this chapter.</p>
|
624
|
+
|
625
|
+
|
626
|
+
</div>
|
627
|
+
</div>
|
628
|
+
<div class="tags">
|
629
|
+
|
630
|
+
<p class="tag_title">Returns:</p>
|
631
|
+
<ul class="return">
|
632
|
+
|
633
|
+
<li>
|
634
|
+
|
635
|
+
|
636
|
+
<span class='type'>(<tt>String</tt>)</span>
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
—
|
641
|
+
<div class='inline'><p>Unique identifier for this chapter.</p>
|
642
|
+
</div>
|
643
|
+
|
644
|
+
</li>
|
645
|
+
|
646
|
+
</ul>
|
647
|
+
|
648
|
+
</div><table class="source_code">
|
649
|
+
<tr>
|
650
|
+
<td>
|
651
|
+
<pre class="lines">
|
652
|
+
|
653
|
+
|
654
|
+
25
|
655
|
+
26
|
656
|
+
27</pre>
|
657
|
+
</td>
|
658
|
+
<td>
|
659
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 25</span>
|
660
|
+
|
661
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_uid'>uid</span>
|
662
|
+
<span class='ivar'>@uid</span> <span class='op'>||=</span> <span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_xml_id'>xml_id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_layout'>layout</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='rparen'>)</span>
|
663
|
+
<span class='kw'>end</span></pre>
|
664
|
+
</td>
|
665
|
+
</tr>
|
666
|
+
</table>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div class="method_details ">
|
670
|
+
<h3 class="signature " id="xml_id-instance_method">
|
671
|
+
|
672
|
+
- (<tt>String</tt>) <strong>xml_id</strong>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
</h3><div class="docstring">
|
679
|
+
<div class="discussion">
|
680
|
+
<p>Returns XML-friendly slug for this chapter based on its number.</p>
|
681
|
+
|
682
|
+
|
683
|
+
</div>
|
684
|
+
</div>
|
685
|
+
<div class="tags">
|
686
|
+
|
687
|
+
<p class="tag_title">Returns:</p>
|
688
|
+
<ul class="return">
|
689
|
+
|
690
|
+
<li>
|
691
|
+
|
692
|
+
|
693
|
+
<span class='type'>(<tt>String</tt>)</span>
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
—
|
698
|
+
<div class='inline'><p>XML-friendly slug for this chapter based on its number.</p>
|
699
|
+
</div>
|
700
|
+
|
701
|
+
</li>
|
702
|
+
|
703
|
+
</ul>
|
704
|
+
|
705
|
+
</div><table class="source_code">
|
706
|
+
<tr>
|
707
|
+
<td>
|
708
|
+
<pre class="lines">
|
709
|
+
|
710
|
+
|
711
|
+
30
|
712
|
+
31
|
713
|
+
32</pre>
|
714
|
+
</td>
|
715
|
+
<td>
|
716
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/chapter.rb', line 30</span>
|
717
|
+
|
718
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_xml_id'>xml_id</span>
|
719
|
+
<span class='ivar'>@id</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>chapter-</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_number'>number</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
720
|
+
<span class='kw'>end</span></pre>
|
721
|
+
</td>
|
722
|
+
</tr>
|
723
|
+
</table>
|
724
|
+
</div>
|
725
|
+
|
726
|
+
</div>
|
727
|
+
|
728
|
+
</div>
|
729
|
+
|
730
|
+
<div id="footer">
|
731
|
+
Generated on Thu Aug 14 19:54:32 2014 by
|
732
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
733
|
+
0.8.7.4 (ruby-2.1.2).
|
734
|
+
</div>
|
735
|
+
|
736
|
+
</body>
|
737
|
+
</html>
|