rrtf 0.1.1 → 0.1.2

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -7
  3. data/documentation/RRTF/CharacterFormatting.html +1002 -0
  4. data/documentation/RRTF/CharacterStyle.html +1058 -0
  5. data/documentation/RRTF/Colour.html +813 -0
  6. data/documentation/RRTF/ColourTable.html +770 -0
  7. data/documentation/RRTF/CommandNode.html +2372 -0
  8. data/documentation/RRTF/ContainerNode.html +826 -0
  9. data/documentation/RRTF/Converters/HTML/Helpers.html +272 -0
  10. data/documentation/RRTF/Converters/HTML/Node.html +364 -0
  11. data/documentation/RRTF/Converters/HTML/NodeSet.html +265 -0
  12. data/documentation/RRTF/Converters/HTML.html +337 -0
  13. data/documentation/RRTF/Converters.html +117 -0
  14. data/documentation/RRTF/Document.html +2405 -0
  15. data/documentation/RRTF/DocumentStyle.html +1367 -0
  16. data/documentation/RRTF/Font.html +790 -0
  17. data/documentation/RRTF/FontTable.html +763 -0
  18. data/documentation/RRTF/FooterNode.html +515 -0
  19. data/documentation/RRTF/HeaderNode.html +515 -0
  20. data/documentation/RRTF/ImageNode.html +1374 -0
  21. data/documentation/RRTF/Information.html +809 -0
  22. data/documentation/RRTF/LinkNode.html +264 -0
  23. data/documentation/RRTF/ListLevel.html +799 -0
  24. data/documentation/RRTF/ListLevelNode.html +612 -0
  25. data/documentation/RRTF/ListMarker.html +595 -0
  26. data/documentation/RRTF/ListNode.html +368 -0
  27. data/documentation/RRTF/ListTable.html +343 -0
  28. data/documentation/RRTF/ListTemplate.html +433 -0
  29. data/documentation/RRTF/ListTextNode.html +285 -0
  30. data/documentation/RRTF/Node.html +616 -0
  31. data/documentation/RRTF/Paper.html +624 -0
  32. data/documentation/RRTF/ParagraphFormatting.html +749 -0
  33. data/documentation/RRTF/ParagraphNode.html +275 -0
  34. data/documentation/RRTF/ParagraphStyle.html +1319 -0
  35. data/documentation/RRTF/RTFError.html +295 -0
  36. data/documentation/RRTF/Style.html +1767 -0
  37. data/documentation/RRTF/Stylesheet.html +1768 -0
  38. data/documentation/RRTF/TableCellNode.html +1704 -0
  39. data/documentation/RRTF/TableNode.html +1025 -0
  40. data/documentation/RRTF/TableRowNode.html +675 -0
  41. data/documentation/RRTF/TextNode.html +600 -0
  42. data/documentation/RRTF/Utilities.html +201 -0
  43. data/documentation/RRTF.html +129 -0
  44. data/documentation/_index.html +478 -0
  45. data/documentation/class_list.html +51 -0
  46. data/documentation/css/common.css +1 -0
  47. data/documentation/css/full_list.css +58 -0
  48. data/documentation/css/style.css +492 -0
  49. data/documentation/file.README.html +223 -0
  50. data/documentation/file_list.html +56 -0
  51. data/documentation/frames.html +17 -0
  52. data/documentation/index.html +223 -0
  53. data/documentation/js/app.js +248 -0
  54. data/documentation/js/full_list.js +216 -0
  55. data/documentation/js/jquery.js +4 -0
  56. data/documentation/method_list.html +2203 -0
  57. data/documentation/top-level-namespace.html +110 -0
  58. data/examples/01.rtf +14 -17
  59. data/examples/01_mac_word15_36.png +0 -0
  60. data/examples/01_styles_and_paragraphs.rb +3 -4
  61. data/examples/resources/json/redshirt_styles.json +4 -2
  62. data/lib/rrtf/node.rb +86 -167
  63. data/lib/rrtf/style/character_style.rb +4 -3
  64. data/lib/rrtf/style/formatting.rb +55 -11
  65. data/lib/rrtf/style/paragraph_style.rb +19 -4
  66. data/lib/rrtf/style/style.rb +15 -15
  67. data/lib/rrtf/stylesheet.rb +57 -16
  68. data/lib/rrtf/version.rb +1 -1
  69. data/rrtf.gemspec +1 -0
  70. metadata +70 -1
@@ -0,0 +1,1768 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: RRTF::Stylesheet
8
+
9
+ &mdash; Documentation by YARD 0.9.9
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
+ pathId = "RRTF::Stylesheet";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../RRTF.html" title="RRTF (module)">RRTF</a></span></span>
41
+ &raquo;
42
+ <span class="title">Stylesheet</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: RRTF::Stylesheet
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">RRTF::Stylesheet</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/rrtf/stylesheet.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Represents a stylesheet in an RTF document.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+ <p class="tag_title">Author:</p>
113
+ <ul class="author">
114
+
115
+ <li>
116
+
117
+
118
+
119
+
120
+
121
+ <div class='inline'>
122
+ <p>Wesley Hileman</p>
123
+ </div>
124
+
125
+ </li>
126
+
127
+ </ul>
128
+
129
+ </div>
130
+
131
+
132
+
133
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
134
+ <ul class="summary">
135
+
136
+ <li class="public ">
137
+ <span class="summary_signature">
138
+
139
+ <a href="#document-instance_method" title="#document (instance method)">#<strong>document</strong> &#x21d2; Document </a>
140
+
141
+
142
+
143
+ </span>
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'>
157
+ <p>The document to which the stylesheet belongs.</p>
158
+ </div></span>
159
+
160
+ </li>
161
+
162
+
163
+ <li class="public ">
164
+ <span class="summary_signature">
165
+
166
+ <a href="#styles-instance_method" title="#styles (instance method)">#<strong>styles</strong> &#x21d2; Hash&lt;String, Style&gt; </a>
167
+
168
+
169
+
170
+ </span>
171
+
172
+
173
+
174
+
175
+ <span class="note title readonly">readonly</span>
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ <span class="summary_desc"><div class='inline'>
186
+ <p>Stores the Style objects associated with the stylesheet, each of which is
187
+ keyed by its assigned ID.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ </ul>
194
+
195
+
196
+
197
+
198
+
199
+ <h2>
200
+ Instance Method Summary
201
+ <small><a href="#" class="summary_toggle">collapse</a></small>
202
+ </h2>
203
+
204
+ <ul class="summary">
205
+
206
+ <li class="public ">
207
+ <span class="summary_signature">
208
+
209
+ <a href="#add_style-instance_method" title="#add_style (instance method)">#<strong>add_style</strong>(options) &#x21d2; Object </a>
210
+
211
+
212
+
213
+ </span>
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <span class="summary_desc"><div class='inline'>
224
+ <p>Adds a single style to the stylesheet.</p>
225
+ </div></span>
226
+
227
+ </li>
228
+
229
+
230
+ <li class="public ">
231
+ <span class="summary_signature">
232
+
233
+ <a href="#add_styles-instance_method" title="#add_styles (instance method)">#<strong>add_styles</strong>(hash_array) &#x21d2; Object </a>
234
+
235
+
236
+
237
+ </span>
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+ <span class="summary_desc"><div class='inline'>
248
+ <p>Adds the specified styles to the stylesheet.</p>
249
+ </div></span>
250
+
251
+ </li>
252
+
253
+
254
+ <li class="public ">
255
+ <span class="summary_signature">
256
+
257
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(document, options = {}) &#x21d2; Stylesheet </a>
258
+
259
+
260
+
261
+ </span>
262
+
263
+
264
+ <span class="note title constructor">constructor</span>
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <span class="summary_desc"><div class='inline'>
274
+ <p>Builds a Stylesheet object.</p>
275
+ </div></span>
276
+
277
+ </li>
278
+
279
+
280
+ <li class="public ">
281
+ <span class="summary_signature">
282
+
283
+ <a href="#to_rtf-instance_method" title="#to_rtf (instance method)">#<strong>to_rtf</strong>(options = {}) &#x21d2; Object </a>
284
+
285
+
286
+
287
+ </span>
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+ <span class="summary_desc"><div class='inline'>
298
+ <p>Converts the stylesheet to its RTF representation.</p>
299
+ </div></span>
300
+
301
+ </li>
302
+
303
+
304
+ </ul>
305
+
306
+
307
+ <div id="constructor_details" class="method_details_list">
308
+ <h2>Constructor Details</h2>
309
+
310
+ <div class="method_details first">
311
+ <h3 class="signature first" id="initialize-instance_method">
312
+
313
+ #<strong>initialize</strong>(document, options = {}) &#x21d2; <tt><span class='object_link'><a href="" title="RRTF::Stylesheet (class)">Stylesheet</a></span></tt>
314
+
315
+
316
+
317
+
318
+
319
+ </h3><div class="docstring">
320
+ <div class="discussion">
321
+
322
+ <p>Builds a Stylesheet object.</p>
323
+
324
+
325
+ </div>
326
+ </div>
327
+ <div class="tags">
328
+ <p class="tag_title">Parameters:</p>
329
+ <ul class="param">
330
+
331
+ <li>
332
+
333
+ <span class='name'>document</span>
334
+
335
+
336
+ <span class='type'>(<tt><span class='object_link'><a href="Document.html" title="RRTF::Document (class)">Document</a></span></tt>)</span>
337
+
338
+
339
+
340
+ &mdash;
341
+ <div class='inline'>
342
+ <p>the document to which the stylesheet belongs.</p>
343
+ </div>
344
+
345
+ </li>
346
+
347
+ <li>
348
+
349
+ <span class='name'>options</span>
350
+
351
+
352
+ <span class='type'>(<tt>Hash</tt>)</span>
353
+
354
+
355
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
356
+
357
+
358
+ &mdash;
359
+ <div class='inline'>
360
+ <p>the stylesheet options.</p>
361
+ </div>
362
+
363
+ </li>
364
+
365
+ </ul>
366
+
367
+
368
+
369
+
370
+
371
+
372
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
373
+ <ul class="option">
374
+
375
+ <li>
376
+ <span class="name">"styles"</span>
377
+ <span class="type">(<tt>Array&lt;Hash&gt;</tt>)</span>
378
+ <span class="default">
379
+
380
+ &mdash; default:
381
+ <tt>[]</tt>
382
+
383
+ </span>
384
+
385
+ &mdash; <div class='inline'>
386
+ <p>a hashmap array specifying the styles to include in the stylesheet.</p>
387
+ </div>
388
+
389
+ </li>
390
+
391
+ <li>
392
+ <span class="name">"assign_style_handles"</span>
393
+ <span class="type">(<tt>Array&lt;Boolean&gt;</tt>)</span>
394
+ <span class="default">
395
+
396
+ &mdash; default:
397
+ <tt>true</tt>
398
+
399
+ </span>
400
+
401
+ &mdash; <div class='inline'>
402
+ <p>whether or not to auto-assign handles to included styles.</p>
403
+ </div>
404
+
405
+ </li>
406
+
407
+ <li>
408
+ <span class="name">"assign_style_priorities"</span>
409
+ <span class="type">(<tt>Array&lt;Boolean&gt;</tt>)</span>
410
+ <span class="default">
411
+
412
+ &mdash; default:
413
+ <tt>true</tt>
414
+
415
+ </span>
416
+
417
+ &mdash; <div class='inline'>
418
+ <p>whether or not to auto-assign priority to included styles.</p>
419
+ </div>
420
+
421
+ </li>
422
+
423
+ <li>
424
+ <span class="name">"base_style_handle"</span>
425
+ <span class="type">(<tt>Array&lt;Integer&gt;</tt>)</span>
426
+ <span class="default">
427
+
428
+ &mdash; default:
429
+ <tt>1</tt>
430
+
431
+ </span>
432
+
433
+ &mdash; <div class='inline'>
434
+ <p>the handle number at which to start indexing styles.</p>
435
+ </div>
436
+
437
+ </li>
438
+
439
+ <li>
440
+ <span class="name">"base_style_handle"</span>
441
+ <span class="type">(<tt>Array&lt;Integer&gt;</tt>)</span>
442
+ <span class="default">
443
+
444
+ &mdash; default:
445
+ <tt>20</tt>
446
+
447
+ </span>
448
+
449
+ &mdash; <div class='inline'>
450
+ <p>the priority number at which to start indexing styles.</p>
451
+ </div>
452
+
453
+ </li>
454
+
455
+ </ul>
456
+
457
+
458
+
459
+ <p class="tag_title">See Also:</p>
460
+ <ul class="see">
461
+
462
+ <li><span class='object_link'><a href="#add_style-instance_method" title="RRTF::Stylesheet#add_style (method)">#add_style for available style options.</a></span></li>
463
+
464
+ </ul>
465
+
466
+ </div><table class="source_code">
467
+ <tr>
468
+ <td>
469
+ <pre class="lines">
470
+
471
+
472
+ 27
473
+ 28
474
+ 29
475
+ 30
476
+ 31
477
+ 32
478
+ 33
479
+ 34
480
+ 35
481
+ 36
482
+ 37
483
+ 38
484
+ 39
485
+ 40</pre>
486
+ </td>
487
+ <td>
488
+ <pre class="code"><span class="info file"># File 'lib/rrtf/stylesheet.rb', line 27</span>
489
+
490
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_document'>document</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
491
+ <span class='ivar'>@options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
492
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>styles</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span>
493
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>base_style_handle</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span>
494
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>base_style_priority</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span>
495
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>assign_style_handles</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='comma'>,</span>
496
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>assign_style_priorities</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>true</span>
497
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
498
+ <span class='ivar'>@document</span> <span class='op'>=</span> <span class='id identifier rubyid_document'>document</span>
499
+ <span class='ivar'>@next_styles_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
500
+ <span class='ivar'>@base_styles_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
501
+ <span class='ivar'>@styles</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
502
+ <span class='id identifier rubyid_add_styles'>add_styles</span><span class='lparen'>(</span><span class='ivar'>@options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>styles</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
503
+ <span class='kw'>end</span></pre>
504
+ </td>
505
+ </tr>
506
+ </table>
507
+ </div>
508
+
509
+ </div>
510
+
511
+ <div id="instance_attr_details" class="attr_details">
512
+ <h2>Instance Attribute Details</h2>
513
+
514
+
515
+ <span id="document=-instance_method"></span>
516
+ <div class="method_details first">
517
+ <h3 class="signature first" id="document-instance_method">
518
+
519
+ #<strong>document</strong> &#x21d2; <tt><span class='object_link'><a href="Document.html" title="RRTF::Document (class)">Document</a></span></tt>
520
+
521
+
522
+
523
+
524
+
525
+ </h3><div class="docstring">
526
+ <div class="discussion">
527
+
528
+ <p>The document to which the stylesheet belongs.</p>
529
+
530
+
531
+ </div>
532
+ </div>
533
+ <div class="tags">
534
+
535
+ <p class="tag_title">Returns:</p>
536
+ <ul class="return">
537
+
538
+ <li>
539
+
540
+
541
+ <span class='type'>(<tt><span class='object_link'><a href="Document.html" title="RRTF::Document (class)">Document</a></span></tt>)</span>
542
+
543
+
544
+
545
+ &mdash;
546
+ <div class='inline'>
547
+ <p>the document object.</p>
548
+ </div>
549
+
550
+ </li>
551
+
552
+ </ul>
553
+
554
+ </div><table class="source_code">
555
+ <tr>
556
+ <td>
557
+ <pre class="lines">
558
+
559
+
560
+ 15
561
+ 16
562
+ 17</pre>
563
+ </td>
564
+ <td>
565
+ <pre class="code"><span class="info file"># File 'lib/rrtf/stylesheet.rb', line 15</span>
566
+
567
+ <span class='kw'>def</span> <span class='id identifier rubyid_document'>document</span>
568
+ <span class='ivar'>@document</span>
569
+ <span class='kw'>end</span></pre>
570
+ </td>
571
+ </tr>
572
+ </table>
573
+ </div>
574
+
575
+
576
+ <span id=""></span>
577
+ <div class="method_details ">
578
+ <h3 class="signature " id="styles-instance_method">
579
+
580
+ #<strong>styles</strong> &#x21d2; <tt>Hash&lt;String, <span class='object_link'><a href="Style.html" title="RRTF::Style (class)">Style</a></span>&gt;</tt> <span class="extras">(readonly)</span>
581
+
582
+
583
+
584
+
585
+
586
+ </h3><div class="docstring">
587
+ <div class="discussion">
588
+
589
+ <p>Stores the Style objects associated with the stylesheet, each of which is
590
+ keyed by its assigned ID.</p>
591
+
592
+
593
+ </div>
594
+ </div>
595
+ <div class="tags">
596
+
597
+ <p class="tag_title">Returns:</p>
598
+ <ul class="return">
599
+
600
+ <li>
601
+
602
+
603
+ <span class='type'>(<tt>Hash&lt;String, <span class='object_link'><a href="Style.html" title="RRTF::Style (class)">Style</a></span>&gt;</tt>)</span>
604
+
605
+
606
+
607
+ &mdash;
608
+ <div class='inline'>
609
+ <p>the style hash.</p>
610
+ </div>
611
+
612
+ </li>
613
+
614
+ </ul>
615
+
616
+ </div><table class="source_code">
617
+ <tr>
618
+ <td>
619
+ <pre class="lines">
620
+
621
+
622
+ 11
623
+ 12
624
+ 13</pre>
625
+ </td>
626
+ <td>
627
+ <pre class="code"><span class="info file"># File 'lib/rrtf/stylesheet.rb', line 11</span>
628
+
629
+ <span class='kw'>def</span> <span class='id identifier rubyid_styles'>styles</span>
630
+ <span class='ivar'>@styles</span>
631
+ <span class='kw'>end</span></pre>
632
+ </td>
633
+ </tr>
634
+ </table>
635
+ </div>
636
+
637
+ </div>
638
+
639
+
640
+ <div id="instance_method_details" class="method_details_list">
641
+ <h2>Instance Method Details</h2>
642
+
643
+
644
+ <div class="method_details first">
645
+ <h3 class="signature first" id="add_style-instance_method">
646
+
647
+ #<strong>add_style</strong>(options) &#x21d2; <tt>Object</tt>
648
+
649
+
650
+
651
+
652
+
653
+ </h3><div class="docstring">
654
+ <div class="discussion">
655
+
656
+ <p>Adds a single style to the stylesheet.</p>
657
+
658
+
659
+ </div>
660
+ </div>
661
+ <div class="tags">
662
+ <p class="tag_title">Parameters:</p>
663
+ <ul class="param">
664
+
665
+ <li>
666
+
667
+ <span class='name'>options</span>
668
+
669
+
670
+ <span class='type'>(<tt>Hash</tt>)</span>
671
+
672
+
673
+
674
+ &mdash;
675
+ <div class='inline'>
676
+ <p>the options to use in building the style.</p>
677
+ </div>
678
+
679
+ </li>
680
+
681
+ </ul>
682
+
683
+
684
+
685
+
686
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
687
+ <ul class="option">
688
+
689
+ <li>
690
+ <span class="name">"style"</span>
691
+ <span class="type">(<tt><span class='object_link'><a href="Style.html" title="RRTF::Style (class)">Style</a></span></tt>)</span>
692
+ <span class="default">
693
+
694
+ </span>
695
+
696
+ &mdash; <div class='inline'>
697
+ <p>the style object to add to the stylesheet (can be specified directly in
698
+ place of “type”).</p>
699
+ </div>
700
+
701
+ </li>
702
+
703
+ <li>
704
+ <span class="name">"type"</span>
705
+ <span class="type">(<tt>String</tt>)</span>
706
+ <span class="default">
707
+
708
+ </span>
709
+
710
+ &mdash; <div class='inline'>
711
+ <p>the type of style to build (“character” or “paragraph”).</p>
712
+ </div>
713
+
714
+ </li>
715
+
716
+ <li>
717
+ <span class="name">"id"</span>
718
+ <span class="type">(<tt>String</tt>)</span>
719
+ <span class="default">
720
+
721
+ </span>
722
+
723
+ &mdash; <div class='inline'>
724
+ <p>the ID for the style (used in generating code only).</p>
725
+ </div>
726
+
727
+ </li>
728
+
729
+ <li>
730
+ <span class="name">"default"</span>
731
+ <span class="type">(<tt>Boolean</tt>)</span>
732
+ <span class="default">
733
+
734
+ &mdash; default:
735
+ <tt>false</tt>
736
+
737
+ </span>
738
+
739
+ &mdash; <div class='inline'>
740
+ <p>whether or not this style is the default style for the document.</p>
741
+ </div>
742
+
743
+ </li>
744
+
745
+ <li>
746
+ <span class="name">"next_style"</span>
747
+ <span class="type">(<tt>Integer</tt>)</span>
748
+ <span class="default">
749
+
750
+ &mdash; default:
751
+ <tt>nil</tt>
752
+
753
+ </span>
754
+
755
+ &mdash; <div class='inline'>
756
+ <p>the ID of the next style (the style to be used in the paragraph created
757
+ after paragraphs with this style applied).</p>
758
+ </div>
759
+
760
+ </li>
761
+
762
+ <li>
763
+ <span class="name">"base_style"</span>
764
+ <span class="type">(<tt>Integer</tt>)</span>
765
+ <span class="default">
766
+
767
+ &mdash; default:
768
+ <tt>nil</tt>
769
+
770
+ </span>
771
+
772
+ &mdash; <div class='inline'>
773
+ <p>the ID of the base style (the style on which this one is based).</p>
774
+ </div>
775
+
776
+ </li>
777
+
778
+ <li>
779
+ <span class="name">"assign_handle"</span>
780
+ <span class="type">(<tt>Boolean</tt>)</span>
781
+ <span class="default">
782
+
783
+ </span>
784
+
785
+ &mdash; <div class='inline'>
786
+ <p>whether or not a handle should be auto-assigned to this style.</p>
787
+ </div>
788
+
789
+ </li>
790
+
791
+ <li>
792
+ <span class="name">"assign_priority"</span>
793
+ <span class="type">(<tt>Boolean</tt>)</span>
794
+ <span class="default">
795
+
796
+ </span>
797
+
798
+ &mdash; <div class='inline'>
799
+ <p>whether or not a priority should be auto-assigned to this style.</p>
800
+ </div>
801
+
802
+ </li>
803
+
804
+ <li>
805
+ <span class="name">"name"</span>
806
+ <span class="type">(<tt>String</tt>)</span>
807
+ <span class="default">
808
+
809
+ &mdash; default:
810
+ <tt>nil</tt>
811
+
812
+ </span>
813
+
814
+ &mdash; <div class='inline'>
815
+ <p>human-readable name for the style.</p>
816
+ </div>
817
+
818
+ </li>
819
+
820
+ <li>
821
+ <span class="name">"handle"</span>
822
+ <span class="type">(<tt>Integer</tt>)</span>
823
+ <span class="default">
824
+
825
+ &mdash; default:
826
+ <tt>nil</tt>
827
+
828
+ </span>
829
+
830
+ &mdash; <div class='inline'>
831
+ <p>16-bit integer that identifies the style in a document.</p>
832
+ </div>
833
+
834
+ </li>
835
+
836
+ <li>
837
+ <span class="name">"next_style_handle"</span>
838
+ <span class="type">(<tt>Integer</tt>)</span>
839
+ <span class="default">
840
+
841
+ &mdash; default:
842
+ <tt>nil</tt>
843
+
844
+ </span>
845
+
846
+ &mdash; <div class='inline'>
847
+ <p>16-bit integer that identifies the next style for this style.</p>
848
+ </div>
849
+
850
+ </li>
851
+
852
+ <li>
853
+ <span class="name">"based_on_style_handle"</span>
854
+ <span class="type">(<tt>Integer</tt>)</span>
855
+ <span class="default">
856
+
857
+ &mdash; default:
858
+ <tt>nil</tt>
859
+
860
+ </span>
861
+
862
+ &mdash; <div class='inline'>
863
+ <p>16-bit integer that identifies the base style for this style.</p>
864
+ </div>
865
+
866
+ </li>
867
+
868
+ <li>
869
+ <span class="name">"priority"</span>
870
+ <span class="type">(<tt>Integer</tt>)</span>
871
+ <span class="default">
872
+
873
+ &mdash; default:
874
+ <tt>nil</tt>
875
+
876
+ </span>
877
+
878
+ &mdash; <div class='inline'>
879
+ <p>16-bit integer that indicates the ordering of the style among other styles
880
+ in a document.</p>
881
+ </div>
882
+
883
+ </li>
884
+
885
+ <li>
886
+ <span class="name">"primary"</span>
887
+ <span class="type">(<tt>Boolean</tt>)</span>
888
+ <span class="default">
889
+
890
+ &mdash; default:
891
+ <tt>false</tt>
892
+
893
+ </span>
894
+
895
+ &mdash; <div class='inline'>
896
+ <p>whether or not this style is a primary or “quick” style.</p>
897
+ </div>
898
+
899
+ </li>
900
+
901
+ <li>
902
+ <span class="name">"additive"</span>
903
+ <span class="type">(<tt>Boolean</tt>)</span>
904
+ <span class="default">
905
+
906
+ &mdash; default:
907
+ <tt>false</tt>
908
+
909
+ </span>
910
+
911
+ &mdash; <div class='inline'>
912
+ <p>whether or not this character style is additive to the current paragraph
913
+ style.</p>
914
+ </div>
915
+
916
+ </li>
917
+
918
+ <li>
919
+ <span class="name">"auto_update"</span>
920
+ <span class="type">(<tt>Boolean</tt>)</span>
921
+ <span class="default">
922
+
923
+ &mdash; default:
924
+ <tt>false</tt>
925
+
926
+ </span>
927
+
928
+ &mdash; <div class='inline'>
929
+ <p>whether or not this style should be updated when any node to which the
930
+ style is applied is updated.</p>
931
+ </div>
932
+
933
+ </li>
934
+
935
+ <li>
936
+ <span class="name">"hidden"</span>
937
+ <span class="type">(<tt>Boolean</tt>)</span>
938
+ <span class="default">
939
+
940
+ &mdash; default:
941
+ <tt>false</tt>
942
+
943
+ </span>
944
+
945
+ &mdash; <div class='inline'>
946
+ <p>whether or not the style should be hidden.</p>
947
+ </div>
948
+
949
+ </li>
950
+
951
+ <li>
952
+ <span class="name">"bold"</span>
953
+ <span class="type">(<tt>Boolean</tt>)</span>
954
+ <span class="default">
955
+
956
+ &mdash; default:
957
+ <tt>nil</tt>
958
+
959
+ </span>
960
+
961
+ &mdash; <div class='inline'>
962
+ <p>enable or disable bold (nil to remain same).</p>
963
+ </div>
964
+
965
+ </li>
966
+
967
+ <li>
968
+ <span class="name">"italic"</span>
969
+ <span class="type">(<tt>Boolean</tt>)</span>
970
+ <span class="default">
971
+
972
+ &mdash; default:
973
+ <tt>nil</tt>
974
+
975
+ </span>
976
+
977
+ &mdash; <div class='inline'>
978
+ <p>enable or disable italic (nil to remain same).</p>
979
+ </div>
980
+
981
+ </li>
982
+
983
+ <li>
984
+ <span class="name">"underline"</span>
985
+ <span class="type">(<tt>Boolean</tt>, <tt>String</tt>)</span>
986
+ <span class="default">
987
+
988
+ &mdash; default:
989
+ <tt>nil</tt>
990
+
991
+ </span>
992
+
993
+ &mdash; <div class='inline'>
994
+ <p>enable or disable underline (nil to remain same); can also be a string (see
995
+ <span class='object_link'><a href="CharacterFormatting.html#CHARACTER_ATTRIBUTES-constant" title="RRTF::CharacterFormatting::CHARACTER_ATTRIBUTES (constant)">CharacterFormatting::CHARACTER_ATTRIBUTES</a></span>).</p>
996
+ </div>
997
+
998
+ </li>
999
+
1000
+ <li>
1001
+ <span class="name">"uppercase"</span>
1002
+ <span class="type">(<tt>Boolean</tt>)</span>
1003
+ <span class="default">
1004
+
1005
+ &mdash; default:
1006
+ <tt>nil</tt>
1007
+
1008
+ </span>
1009
+
1010
+ &mdash; <div class='inline'>
1011
+ <p>enable or disable all caps (nil to remain same).</p>
1012
+ </div>
1013
+
1014
+ </li>
1015
+
1016
+ <li>
1017
+ <span class="name">"superscript"</span>
1018
+ <span class="type">(<tt>Boolean</tt>)</span>
1019
+ <span class="default">
1020
+
1021
+ &mdash; default:
1022
+ <tt>nil</tt>
1023
+
1024
+ </span>
1025
+
1026
+ &mdash; <div class='inline'>
1027
+ <p>enable or disable superscript (nil to remain same).</p>
1028
+ </div>
1029
+
1030
+ </li>
1031
+
1032
+ <li>
1033
+ <span class="name">"subscript"</span>
1034
+ <span class="type">(<tt>Boolean</tt>)</span>
1035
+ <span class="default">
1036
+
1037
+ &mdash; default:
1038
+ <tt>nil</tt>
1039
+
1040
+ </span>
1041
+
1042
+ &mdash; <div class='inline'>
1043
+ <p>enable or disable subscript (nil to remain same).</p>
1044
+ </div>
1045
+
1046
+ </li>
1047
+
1048
+ <li>
1049
+ <span class="name">"strike"</span>
1050
+ <span class="type">(<tt>Boolean</tt>)</span>
1051
+ <span class="default">
1052
+
1053
+ &mdash; default:
1054
+ <tt>nil</tt>
1055
+
1056
+ </span>
1057
+
1058
+ &mdash; <div class='inline'>
1059
+ <p>enable or disable single line-through (nil to remain same).</p>
1060
+ </div>
1061
+
1062
+ </li>
1063
+
1064
+ <li>
1065
+ <span class="name">"emboss"</span>
1066
+ <span class="type">(<tt>Boolean</tt>)</span>
1067
+ <span class="default">
1068
+
1069
+ &mdash; default:
1070
+ <tt>nil</tt>
1071
+
1072
+ </span>
1073
+
1074
+ &mdash; <div class='inline'>
1075
+ <p>enable or disable emboss (nil to remain same).</p>
1076
+ </div>
1077
+
1078
+ </li>
1079
+
1080
+ <li>
1081
+ <span class="name">"imprint"</span>
1082
+ <span class="type">(<tt>Boolean</tt>)</span>
1083
+ <span class="default">
1084
+
1085
+ &mdash; default:
1086
+ <tt>nil</tt>
1087
+
1088
+ </span>
1089
+
1090
+ &mdash; <div class='inline'>
1091
+ <p>enable or disable imprint (nil to remain same).</p>
1092
+ </div>
1093
+
1094
+ </li>
1095
+
1096
+ <li>
1097
+ <span class="name">"outline"</span>
1098
+ <span class="type">(<tt>Boolean</tt>)</span>
1099
+ <span class="default">
1100
+
1101
+ &mdash; default:
1102
+ <tt>nil</tt>
1103
+
1104
+ </span>
1105
+
1106
+ &mdash; <div class='inline'>
1107
+ <p>enable or disable outline (nil to remain same).</p>
1108
+ </div>
1109
+
1110
+ </li>
1111
+
1112
+ <li>
1113
+ <span class="name">"text_hidden"</span>
1114
+ <span class="type">(<tt>Boolean</tt>)</span>
1115
+ <span class="default">
1116
+
1117
+ &mdash; default:
1118
+ <tt>nil</tt>
1119
+
1120
+ </span>
1121
+
1122
+ &mdash; <div class='inline'>
1123
+ <p>enable or disable hidden (nil to remain same).</p>
1124
+ </div>
1125
+
1126
+ </li>
1127
+
1128
+ <li>
1129
+ <span class="name">"kerning"</span>
1130
+ <span class="type">(<tt>Boolean</tt>, <tt>Integer</tt>)</span>
1131
+ <span class="default">
1132
+
1133
+ &mdash; default:
1134
+ <tt>nil</tt>
1135
+
1136
+ </span>
1137
+
1138
+ &mdash; <div class='inline'>
1139
+ <p>enable or disable kerning (nil to remain same); to enable specify the font
1140
+ size in half-points above which kerining will be applied.</p>
1141
+ </div>
1142
+
1143
+ </li>
1144
+
1145
+ <li>
1146
+ <span class="name">"character_spacing_offset"</span>
1147
+ <span class="type">(<tt>Integer</tt>)</span>
1148
+ <span class="default">
1149
+
1150
+ &mdash; default:
1151
+ <tt>nil</tt>
1152
+
1153
+ </span>
1154
+
1155
+ &mdash; <div class='inline'>
1156
+ <p>quarter points by which to expand or compress character spacing (negative
1157
+ for compress).</p>
1158
+ </div>
1159
+
1160
+ </li>
1161
+
1162
+ <li>
1163
+ <span class="name">"foreground_color"</span>
1164
+ <span class="type">(<tt>String</tt>, <tt><span class='object_link'><a href="Colour.html" title="RRTF::Colour (class)">Colour</a></span></tt>)</span>
1165
+ <span class="default">
1166
+
1167
+ &mdash; default:
1168
+ <tt>nil</tt>
1169
+
1170
+ </span>
1171
+
1172
+ &mdash; <div class='inline'>
1173
+ <p>colour to apply to the foreground (text); see <span class='object_link'><a href="Colour.html#from_string-class_method" title="RRTF::Colour.from_string (method)">Colour.from_string</a></span> for
1174
+ string format.</p>
1175
+ </div>
1176
+
1177
+ </li>
1178
+
1179
+ <li>
1180
+ <span class="name">"background_color"</span>
1181
+ <span class="type">(<tt>String</tt>, <tt><span class='object_link'><a href="Colour.html" title="RRTF::Colour (class)">Colour</a></span></tt>)</span>
1182
+ <span class="default">
1183
+
1184
+ &mdash; default:
1185
+ <tt>nil</tt>
1186
+
1187
+ </span>
1188
+
1189
+ &mdash; <div class='inline'>
1190
+ <p>colour to apply to the background (highlight); see <span class='object_link'><a href="Colour.html#from_string-class_method" title="RRTF::Colour.from_string (method)">Colour.from_string</a></span> for
1191
+ string format.</p>
1192
+ </div>
1193
+
1194
+ </li>
1195
+
1196
+ <li>
1197
+ <span class="name">"underline_color"</span>
1198
+ <span class="type">(<tt>String</tt>, <tt><span class='object_link'><a href="Colour.html" title="RRTF::Colour (class)">Colour</a></span></tt>)</span>
1199
+ <span class="default">
1200
+
1201
+ &mdash; default:
1202
+ <tt>nil</tt>
1203
+
1204
+ </span>
1205
+
1206
+ &mdash; <div class='inline'>
1207
+ <p>colour to apply to the underline; see <span class='object_link'><a href="Colour.html#from_string-class_method" title="RRTF::Colour.from_string (method)">Colour.from_string</a></span> for string
1208
+ format.</p>
1209
+ </div>
1210
+
1211
+ </li>
1212
+
1213
+ <li>
1214
+ <span class="name">"font"</span>
1215
+ <span class="type">(<tt>String</tt>, <tt><span class='object_link'><a href="Font.html" title="RRTF::Font (class)">Font</a></span></tt>)</span>
1216
+ <span class="default">
1217
+
1218
+ &mdash; default:
1219
+ <tt>nil</tt>
1220
+
1221
+ </span>
1222
+
1223
+ &mdash; <div class='inline'>
1224
+ <p>font to apply to text; see <span class='object_link'><a href="Font.html#from_string-class_method" title="RRTF::Font.from_string (method)">Font.from_string</a></span> for string format.</p>
1225
+ </div>
1226
+
1227
+ </li>
1228
+
1229
+ <li>
1230
+ <span class="name">"font_size"</span>
1231
+ <span class="type">(<tt>Integer</tt>)</span>
1232
+ <span class="default">
1233
+
1234
+ &mdash; default:
1235
+ <tt>nil</tt>
1236
+
1237
+ </span>
1238
+
1239
+ &mdash; <div class='inline'>
1240
+ <p>font size in half-points.</p>
1241
+ </div>
1242
+
1243
+ </li>
1244
+
1245
+ <li>
1246
+ <span class="name">"justification"</span>
1247
+ <span class="type">(<tt>String</tt>)</span>
1248
+ <span class="default">
1249
+
1250
+ &mdash; default:
1251
+ <tt>&#39;LEFT&#39;</tt>
1252
+
1253
+ </span>
1254
+
1255
+ &mdash; <div class='inline'>
1256
+ <p>the paragraph justification (&#39;LEFT&#39;,
1257
+ &#39;CENTER&#39;/&#39;CENTRE&#39;, &#39;RIGHT&#39;, or &#39;FULL&#39;).</p>
1258
+ </div>
1259
+
1260
+ </li>
1261
+
1262
+ <li>
1263
+ <span class="name">"left_indent"</span>
1264
+ <span class="type">(<tt>Integer</tt>)</span>
1265
+ <span class="default">
1266
+
1267
+ &mdash; default:
1268
+ <tt>nil</tt>
1269
+
1270
+ </span>
1271
+
1272
+ &mdash; <div class='inline'>
1273
+ <p>the left indent of the paragraph (twentieth points).</p>
1274
+ </div>
1275
+
1276
+ </li>
1277
+
1278
+ <li>
1279
+ <span class="name">"right_indent"</span>
1280
+ <span class="type">(<tt>Integer</tt>)</span>
1281
+ <span class="default">
1282
+
1283
+ &mdash; default:
1284
+ <tt>nil</tt>
1285
+
1286
+ </span>
1287
+
1288
+ &mdash; <div class='inline'>
1289
+ <p>the right indent of the paragraph (twentieth points).</p>
1290
+ </div>
1291
+
1292
+ </li>
1293
+
1294
+ <li>
1295
+ <span class="name">"first_line_indent"</span>
1296
+ <span class="type">(<tt>Integer</tt>)</span>
1297
+ <span class="default">
1298
+
1299
+ &mdash; default:
1300
+ <tt>nil</tt>
1301
+
1302
+ </span>
1303
+
1304
+ &mdash; <div class='inline'>
1305
+ <p>the first line indent of the paragraph (twentieth points).</p>
1306
+ </div>
1307
+
1308
+ </li>
1309
+
1310
+ <li>
1311
+ <span class="name">"space_before"</span>
1312
+ <span class="type">(<tt>Integer</tt>)</span>
1313
+ <span class="default">
1314
+
1315
+ &mdash; default:
1316
+ <tt>nil</tt>
1317
+
1318
+ </span>
1319
+
1320
+ &mdash; <div class='inline'>
1321
+ <p>the space before the paragraph (twentieth points).</p>
1322
+ </div>
1323
+
1324
+ </li>
1325
+
1326
+ <li>
1327
+ <span class="name">"space_after"</span>
1328
+ <span class="type">(<tt>Integer</tt>)</span>
1329
+ <span class="default">
1330
+
1331
+ &mdash; default:
1332
+ <tt>nil</tt>
1333
+
1334
+ </span>
1335
+
1336
+ &mdash; <div class='inline'>
1337
+ <p>the space after the paragraph (twentieth points).</p>
1338
+ </div>
1339
+
1340
+ </li>
1341
+
1342
+ <li>
1343
+ <span class="name">"line_spacing"</span>
1344
+ <span class="type">(<tt>Integer</tt>)</span>
1345
+ <span class="default">
1346
+
1347
+ &mdash; default:
1348
+ <tt>nil</tt>
1349
+
1350
+ </span>
1351
+
1352
+ &mdash; <div class='inline'>
1353
+ <p>the line spacing in the paragraph (twentieth points).</p>
1354
+ </div>
1355
+
1356
+ </li>
1357
+
1358
+ <li>
1359
+ <span class="name">"widow_orphan_ctl"</span>
1360
+ <span class="type">(<tt>Boolean</tt>)</span>
1361
+ <span class="default">
1362
+
1363
+ &mdash; default:
1364
+ <tt>nil</tt>
1365
+
1366
+ </span>
1367
+
1368
+ &mdash; <div class='inline'>
1369
+ <p>enable or disable widow-and-orphan control.</p>
1370
+ </div>
1371
+
1372
+ </li>
1373
+
1374
+ <li>
1375
+ <span class="name">"no_break"</span>
1376
+ <span class="type">(<tt>Boolean</tt>)</span>
1377
+ <span class="default">
1378
+
1379
+ &mdash; default:
1380
+ <tt>nil</tt>
1381
+
1382
+ </span>
1383
+
1384
+ &mdash; <div class='inline'>
1385
+ <p>when true, tries to keep the paragraph on the same page (i.e. without
1386
+ breaking).</p>
1387
+ </div>
1388
+
1389
+ </li>
1390
+
1391
+ <li>
1392
+ <span class="name">"no_break_with_next"</span>
1393
+ <span class="type">(<tt>Boolean</tt>)</span>
1394
+ <span class="default">
1395
+
1396
+ &mdash; default:
1397
+ <tt>nil</tt>
1398
+
1399
+ </span>
1400
+
1401
+ &mdash; <div class='inline'>
1402
+ <p>when true, tries to keep the paragraph with the next paragraph on the same
1403
+ page (i.e. without breaking).</p>
1404
+ </div>
1405
+
1406
+ </li>
1407
+
1408
+ <li>
1409
+ <span class="name">"hyphenate"</span>
1410
+ <span class="type">(<tt>Boolean</tt>)</span>
1411
+ <span class="default">
1412
+
1413
+ &mdash; default:
1414
+ <tt>nil</tt>
1415
+
1416
+ </span>
1417
+
1418
+ &mdash; <div class='inline'>
1419
+ <p>enable or disable hyphenation for the paragraph.</p>
1420
+ </div>
1421
+
1422
+ </li>
1423
+
1424
+ <li>
1425
+ <span class="name">"paragraph_flow"</span>
1426
+ <span class="type">(<tt>String</tt>)</span>
1427
+ <span class="default">
1428
+
1429
+ &mdash; default:
1430
+ <tt>&#39;LEFT_TO_RIGHT&#39;</tt>
1431
+
1432
+ </span>
1433
+
1434
+ &mdash; <div class='inline'>
1435
+ <p>the text flow direction in the paragraph (&#39;LEFT_TO_RIGHT&#39; or
1436
+ &#39;RIGHT_TO_LEFT&#39;).</p>
1437
+ </div>
1438
+
1439
+ </li>
1440
+
1441
+ </ul>
1442
+
1443
+
1444
+
1445
+ </div><table class="source_code">
1446
+ <tr>
1447
+ <td>
1448
+ <pre class="lines">
1449
+
1450
+
1451
+ 59
1452
+ 60
1453
+ 61
1454
+ 62
1455
+ 63
1456
+ 64
1457
+ 65
1458
+ 66
1459
+ 67
1460
+ 68
1461
+ 69
1462
+ 70
1463
+ 71
1464
+ 72
1465
+ 73
1466
+ 74
1467
+ 75
1468
+ 76
1469
+ 77
1470
+ 78
1471
+ 79
1472
+ 80
1473
+ 81
1474
+ 82</pre>
1475
+ </td>
1476
+ <td>
1477
+ <pre class="code"><span class="info file"># File 'lib/rrtf/stylesheet.rb', line 59</span>
1478
+
1479
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_style'>add_style</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
1480
+ <span class='id identifier rubyid_style'>style</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>style</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1481
+ <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>type</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1482
+ <span class='id identifier rubyid_add_options'>add_options</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_add_options'>extract_add_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
1483
+
1484
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_style'>style</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1485
+ <span class='comment'># style object given; add directly
1486
+ </span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_add_style_object'>add_style_object</span><span class='lparen'>(</span><span class='id identifier rubyid_style'>style</span><span class='comma'>,</span> <span class='id identifier rubyid_add_options'>add_options</span><span class='rparen'>)</span>
1487
+ <span class='const'><span class='object_link'><a href="RTFError.html" title="RRTF::RTFError (class)">RTFError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fire'><span class='object_link'><a href="RTFError.html#fire-class_method" title="RRTF::RTFError.fire (method)">fire</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_style'>style</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'> could not be added to the stylesheet (hint: make sure it&#39;s a style object).</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1488
+ <span class='kw'>end</span> <span class='comment'># if
1489
+ </span> <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1490
+ <span class='comment'># style object not given; create based on type
1491
+ </span> <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
1492
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>paragraph</span><span class='tstring_end'>&quot;</span></span>
1493
+ <span class='id identifier rubyid_add_style_object'>add_style_object</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="ParagraphStyle.html" title="RRTF::ParagraphStyle (class)">ParagraphStyle</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ParagraphStyle.html#initialize-instance_method" title="RRTF::ParagraphStyle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_add_options'>add_options</span><span class='rparen'>)</span>
1494
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>character</span><span class='tstring_end'>&quot;</span></span>
1495
+ <span class='id identifier rubyid_add_style_object'>add_style_object</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="CharacterStyle.html" title="RRTF::CharacterStyle (class)">CharacterStyle</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="CharacterStyle.html#initialize-instance_method" title="RRTF::CharacterStyle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_add_options'>add_options</span><span class='rparen'>)</span>
1496
+ <span class='kw'>else</span>
1497
+ <span class='const'><span class='object_link'><a href="RTFError.html" title="RRTF::RTFError (class)">RTFError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fire'><span class='object_link'><a href="RTFError.html#fire-class_method" title="RRTF::RTFError.fire (method)">fire</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unreconized style type &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1498
+ <span class='kw'>end</span> <span class='comment'># case
1499
+ </span> <span class='kw'>else</span>
1500
+ <span class='const'><span class='object_link'><a href="RTFError.html" title="RRTF::RTFError (class)">RTFError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fire'><span class='object_link'><a href="RTFError.html#fire-class_method" title="RRTF::RTFError.fire (method)">fire</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>A style type or style object must be specified for each style in a stylesheet.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1501
+ <span class='kw'>end</span> <span class='comment'># if
1502
+ </span><span class='kw'>end</span></pre>
1503
+ </td>
1504
+ </tr>
1505
+ </table>
1506
+ </div>
1507
+
1508
+ <div class="method_details ">
1509
+ <h3 class="signature " id="add_styles-instance_method">
1510
+
1511
+ #<strong>add_styles</strong>(hash_array) &#x21d2; <tt>Object</tt>
1512
+
1513
+
1514
+
1515
+
1516
+
1517
+ </h3><div class="docstring">
1518
+ <div class="discussion">
1519
+
1520
+ <p>Adds the specified styles to the stylesheet.</p>
1521
+
1522
+
1523
+ </div>
1524
+ </div>
1525
+ <div class="tags">
1526
+ <p class="tag_title">Parameters:</p>
1527
+ <ul class="param">
1528
+
1529
+ <li>
1530
+
1531
+ <span class='name'>hash_array</span>
1532
+
1533
+
1534
+ <span class='type'>(<tt>Array&lt;Hash&gt;</tt>)</span>
1535
+
1536
+
1537
+
1538
+ &mdash;
1539
+ <div class='inline'>
1540
+ <p>a hashmap array specifying the styles to add to the stylesheet.</p>
1541
+ </div>
1542
+
1543
+ </li>
1544
+
1545
+ </ul>
1546
+
1547
+
1548
+ <p class="tag_title">See Also:</p>
1549
+ <ul class="see">
1550
+
1551
+ <li><span class='object_link'><a href="#add_style-instance_method" title="RRTF::Stylesheet#add_style (method)">#add_style for available style options.</a></span></li>
1552
+
1553
+ </ul>
1554
+
1555
+ </div><table class="source_code">
1556
+ <tr>
1557
+ <td>
1558
+ <pre class="lines">
1559
+
1560
+
1561
+ 46
1562
+ 47
1563
+ 48</pre>
1564
+ </td>
1565
+ <td>
1566
+ <pre class="code"><span class="info file"># File 'lib/rrtf/stylesheet.rb', line 46</span>
1567
+
1568
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_styles'>add_styles</span><span class='lparen'>(</span><span class='id identifier rubyid_hash_array'>hash_array</span><span class='rparen'>)</span>
1569
+ <span class='id identifier rubyid_hash_array'>hash_array</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_hash'>hash</span><span class='op'>|</span> <span class='id identifier rubyid_add_style'>add_style</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1570
+ <span class='kw'>end</span></pre>
1571
+ </td>
1572
+ </tr>
1573
+ </table>
1574
+ </div>
1575
+
1576
+ <div class="method_details ">
1577
+ <h3 class="signature " id="to_rtf-instance_method">
1578
+
1579
+ #<strong>to_rtf</strong>(options = {}) &#x21d2; <tt>Object</tt>
1580
+
1581
+
1582
+
1583
+
1584
+
1585
+ </h3><div class="docstring">
1586
+ <div class="discussion">
1587
+
1588
+ <div class="note notetag">
1589
+ <strong>Note:</strong>
1590
+ <div class='inline'>
1591
+ <p>calling `to_rtf` causes all next and base styles to be updated (to_rtf
1592
+ “commits” the stylesheet); errors might be raised if next or base styles
1593
+ are missing (have yet to be added to the stylesheet).</p>
1594
+ </div>
1595
+ </div>
1596
+
1597
+
1598
+ <p>Converts the stylesheet to its RTF representation.</p>
1599
+
1600
+
1601
+ </div>
1602
+ </div>
1603
+ <div class="tags">
1604
+ <p class="tag_title">Parameters:</p>
1605
+ <ul class="param">
1606
+
1607
+ <li>
1608
+
1609
+ <span class='name'>options</span>
1610
+
1611
+
1612
+ <span class='type'>(<tt>Hash</tt>)</span>
1613
+
1614
+
1615
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
1616
+
1617
+
1618
+ </li>
1619
+
1620
+ </ul>
1621
+
1622
+
1623
+
1624
+
1625
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
1626
+ <ul class="option">
1627
+
1628
+ <li>
1629
+ <span class="name">"uglify"</span>
1630
+ <span class="type">(<tt>Boolean</tt>)</span>
1631
+ <span class="default">
1632
+
1633
+ &mdash; default:
1634
+ <tt>false</tt>
1635
+
1636
+ </span>
1637
+
1638
+ &mdash; <div class='inline'>
1639
+ <p>removes most line breaks and spaces from RTF output.</p>
1640
+ </div>
1641
+
1642
+ </li>
1643
+
1644
+ <li>
1645
+ <span class="name">"base_indent"</span>
1646
+ <span class="type">(<tt>Integer</tt>)</span>
1647
+ <span class="default">
1648
+
1649
+ &mdash; default:
1650
+ <tt>0</tt>
1651
+
1652
+ </span>
1653
+
1654
+ &mdash; <div class='inline'>
1655
+ <p>the base indent (in spaces) for RTF output (ignored if uglify is true).</p>
1656
+ </div>
1657
+
1658
+ </li>
1659
+
1660
+ <li>
1661
+ <span class="name">"child_indent"</span>
1662
+ <span class="type">(<tt>Integer</tt>)</span>
1663
+ <span class="default">
1664
+
1665
+ &mdash; default:
1666
+ <tt>0</tt>
1667
+
1668
+ </span>
1669
+
1670
+ &mdash; <div class='inline'>
1671
+ <p>the amount of spaces by which to indent the component styles (ignored if
1672
+ uglify is true).</p>
1673
+ </div>
1674
+
1675
+ </li>
1676
+
1677
+ </ul>
1678
+
1679
+
1680
+
1681
+ </div><table class="source_code">
1682
+ <tr>
1683
+ <td>
1684
+ <pre class="lines">
1685
+
1686
+
1687
+ 93
1688
+ 94
1689
+ 95
1690
+ 96
1691
+ 97
1692
+ 98
1693
+ 99
1694
+ 100
1695
+ 101
1696
+ 102
1697
+ 103
1698
+ 104
1699
+ 105
1700
+ 106
1701
+ 107
1702
+ 108
1703
+ 109
1704
+ 110
1705
+ 111
1706
+ 112
1707
+ 113
1708
+ 114
1709
+ 115
1710
+ 116
1711
+ 117
1712
+ 118
1713
+ 119
1714
+ 120
1715
+ 121
1716
+ 122</pre>
1717
+ </td>
1718
+ <td>
1719
+ <pre class="code"><span class="info file"># File 'lib/rrtf/stylesheet.rb', line 93</span>
1720
+
1721
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_rtf'>to_rtf</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1722
+ <span class='comment'># load default options
1723
+ </span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
1724
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>uglify</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='kw'>false</span><span class='comma'>,</span>
1725
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>base_indent</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='int'>0</span><span class='comma'>,</span>
1726
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>child_indent</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='int'>0</span>
1727
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
1728
+ <span class='comment'># build line prefixes
1729
+ </span> <span class='id identifier rubyid_newline_prefix'>newline_prefix</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>uglify</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
1730
+ <span class='id identifier rubyid_base_prefix'>base_prefix</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>uglify</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span><span class='op'>*</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>base_indent</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
1731
+
1732
+ <span class='comment'># lookup and set next and base style handles on component styles
1733
+ </span> <span class='id identifier rubyid_substitute_next_style_handles'>substitute_next_style_handles</span><span class='lparen'>(</span><span class='rparen'>)</span>
1734
+ <span class='id identifier rubyid_substitute_base_style_handles'>substitute_base_style_handles</span><span class='lparen'>(</span><span class='rparen'>)</span>
1735
+
1736
+ <span class='id identifier rubyid_rtf'>rtf</span> <span class='op'>=</span> <span class='const'>StringIO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1737
+
1738
+ <span class='id identifier rubyid_rtf'>rtf</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_base_prefix'>base_prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'>{\\stylesheet</span><span class='tstring_end'>&quot;</span></span>
1739
+ <span class='ivar'>@styles</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</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_style'>style</span><span class='op'>|</span>
1740
+ <span class='id identifier rubyid_rtf'>rtf</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_newline_prefix'>newline_prefix</span>
1741
+ <span class='id identifier rubyid_rtf'>rtf</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_style'>style</span><span class='period'>.</span><span class='id identifier rubyid_to_rtf'>to_rtf</span><span class='lparen'>(</span>
1742
+ <span class='id identifier rubyid_document'>document</span><span class='comma'>,</span>
1743
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>uglify</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>uglify</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
1744
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>base_indent</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>base_indent</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='op'>+</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>child_indent</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
1745
+ <span class='rparen'>)</span>
1746
+ <span class='kw'>end</span>
1747
+ <span class='id identifier rubyid_rtf'>rtf</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_newline_prefix'>newline_prefix</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_base_prefix'>base_prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'>}</span><span class='tstring_end'>&quot;</span></span>
1748
+
1749
+ <span class='id identifier rubyid_rtf'>rtf</span><span class='period'>.</span><span class='id identifier rubyid_string'>string</span>
1750
+ <span class='kw'>end</span></pre>
1751
+ </td>
1752
+ </tr>
1753
+ </table>
1754
+ </div>
1755
+
1756
+ </div>
1757
+
1758
+ </div>
1759
+
1760
+ <div id="footer">
1761
+ Generated on Mon Jul 24 15:49:01 2017 by
1762
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1763
+ 0.9.9 (ruby-2.3.3).
1764
+ </div>
1765
+
1766
+ </div>
1767
+ </body>
1768
+ </html>