org-ruby 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/History.txt +12 -0
  2. data/Rakefile +3 -5
  3. data/announcement.txt +24 -0
  4. data/doc/History_txt.html +272 -0
  5. data/doc/OrgRuby.html +149 -0
  6. data/doc/Orgmode.html +960 -0
  7. data/doc/Orgmode/Headline.html +522 -0
  8. data/doc/Orgmode/HtmlOutputBuffer.html +480 -0
  9. data/doc/Orgmode/Line.html +1251 -0
  10. data/doc/Orgmode/OutputBuffer.html +810 -0
  11. data/doc/Orgmode/Parser.html +852 -0
  12. data/doc/Orgmode/RegexpHelper.html +639 -0
  13. data/doc/Orgmode/TextileOutputBuffer.html +456 -0
  14. data/doc/README_rdoc.html +178 -0
  15. data/doc/announcement_txt.html +142 -0
  16. data/doc/bin/org-ruby.html +54 -0
  17. data/doc/created.rid +15 -0
  18. data/doc/images/brick.png +0 -0
  19. data/doc/images/brick_link.png +0 -0
  20. data/doc/images/bug.png +0 -0
  21. data/doc/images/bullet_black.png +0 -0
  22. data/doc/images/bullet_toggle_minus.png +0 -0
  23. data/doc/images/bullet_toggle_plus.png +0 -0
  24. data/doc/images/date.png +0 -0
  25. data/doc/images/find.png +0 -0
  26. data/doc/images/loadingAnimation.gif +0 -0
  27. data/doc/images/macFFBgHack.png +0 -0
  28. data/doc/images/package.png +0 -0
  29. data/doc/images/page_green.png +0 -0
  30. data/doc/images/page_white_text.png +0 -0
  31. data/doc/images/page_white_width.png +0 -0
  32. data/doc/images/plugin.png +0 -0
  33. data/doc/images/ruby.png +0 -0
  34. data/doc/images/tag_green.png +0 -0
  35. data/doc/images/wrench.png +0 -0
  36. data/doc/images/wrench_orange.png +0 -0
  37. data/doc/images/zoom.png +0 -0
  38. data/doc/index.html +306 -0
  39. data/doc/js/darkfish.js +116 -0
  40. data/doc/js/jquery.js +32 -0
  41. data/doc/js/quicksearch.js +114 -0
  42. data/doc/js/thickbox-compressed.js +10 -0
  43. data/doc/lib/org-ruby/headline_rb.html +52 -0
  44. data/doc/lib/org-ruby/html_output_buffer_rb.html +52 -0
  45. data/doc/lib/org-ruby/html_symbol_replace_rb.html +54 -0
  46. data/doc/lib/org-ruby/line_rb.html +52 -0
  47. data/doc/lib/org-ruby/output_buffer_rb.html +54 -0
  48. data/doc/lib/org-ruby/parser_rb.html +56 -0
  49. data/doc/lib/org-ruby/regexp_helper_rb.html +54 -0
  50. data/doc/lib/org-ruby/textile_output_buffer_rb.html +54 -0
  51. data/doc/lib/org-ruby/textile_symbol_replace_rb.html +54 -0
  52. data/doc/lib/org-ruby_rb.html +52 -0
  53. data/doc/rdoc.css +763 -0
  54. data/lib/org-ruby.rb +1 -1
  55. data/lib/org-ruby/headline.rb +2 -2
  56. data/lib/org-ruby/html_output_buffer.rb +62 -5
  57. data/lib/org-ruby/html_symbol_replace.rb +345 -0
  58. data/lib/org-ruby/line.rb +20 -9
  59. data/lib/org-ruby/output_buffer.rb +8 -1
  60. data/lib/org-ruby/parser.rb +47 -19
  61. data/lib/org-ruby/regexp_helper.rb +16 -0
  62. data/lib/org-ruby/textile_output_buffer.rb +37 -2
  63. data/lib/org-ruby/textile_symbol_replace.rb +345 -0
  64. data/org-ruby.gemspec +41 -0
  65. data/spec/headline_spec.rb +5 -0
  66. data/spec/html_examples/advanced-code.html +10 -0
  67. data/spec/html_examples/advanced-code.org +13 -0
  68. data/spec/html_examples/blockcomment.html +3 -0
  69. data/spec/html_examples/blockcomment.org +15 -0
  70. data/spec/html_examples/center.html +6 -0
  71. data/spec/html_examples/center.org +7 -0
  72. data/spec/html_examples/deflist.html +6 -0
  73. data/spec/html_examples/deflist.org +6 -0
  74. data/spec/html_examples/footnotes.html +10 -0
  75. data/spec/html_examples/footnotes.org +7 -0
  76. data/spec/html_examples/inline-formatting.html +8 -0
  77. data/spec/html_examples/inline-formatting.org +10 -0
  78. data/spec/html_examples/inline-images.html +1 -1
  79. data/spec/html_examples/lists.html +4 -0
  80. data/spec/html_examples/lists.org +11 -0
  81. data/spec/html_examples/subsupscript-nil.html +3 -0
  82. data/spec/html_examples/subsupscript-nil.org +6 -0
  83. data/spec/html_examples/subsupscript.html +3 -0
  84. data/spec/html_examples/subsupscript.org +5 -0
  85. data/spec/html_examples/tables.html +15 -0
  86. data/spec/html_examples/tables.org +24 -0
  87. data/spec/line_spec.rb +17 -13
  88. data/spec/spec_helper.rb +1 -2
  89. data/spec/textile_examples/center.org +7 -0
  90. data/spec/textile_examples/center.textile +6 -0
  91. data/spec/textile_examples/footnotes.org +7 -0
  92. data/spec/textile_examples/footnotes.textile +8 -0
  93. data/spec/textile_examples/tables.org +24 -0
  94. data/spec/textile_examples/tables.textile +17 -0
  95. data/util/gen-special-replace.el +37 -0
  96. metadata +111 -19
  97. data/.gitignore +0 -1
@@ -0,0 +1,639 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Orgmode::RegexpHelper</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../lib/org-ruby/regexp_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/org-ruby/regexp_helper.rb">lib/org-ruby/regexp_helper.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link">Object</p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-new">::new</a></li>
69
+
70
+ <li><a href="#method-i-match_all">#match_all</a></li>
71
+
72
+ <li><a href="#method-i-rewrite_emphasis">#rewrite_emphasis</a></li>
73
+
74
+ <li><a href="#method-i-rewrite_footnote">#rewrite_footnote</a></li>
75
+
76
+ <li><a href="#method-i-rewrite_images">#rewrite_images</a></li>
77
+
78
+ <li><a href="#method-i-rewrite_links">#rewrite_links</a></li>
79
+
80
+ <li><a href="#method-i-rewrite_subp">#rewrite_subp</a></li>
81
+
82
+ </ul>
83
+ </div>
84
+
85
+
86
+
87
+ </div>
88
+
89
+ <div id="project-metadata">
90
+
91
+
92
+ <div id="fileindex-section" class="section project-section">
93
+ <h3 class="section-header">Files</h3>
94
+ <ul>
95
+
96
+ <li class="file"><a href="../History_txt.html">History.txt</a></li>
97
+
98
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
99
+
100
+ <li class="file"><a href="../announcement_txt.html">announcement.txt</a></li>
101
+
102
+ </ul>
103
+ </div>
104
+
105
+
106
+ <div id="classindex-section" class="section project-section">
107
+ <h3 class="section-header">Class/Module Index
108
+ <span class="search-toggle"><img src="../images/find.png"
109
+ height="16" width="16" alt="[+]"
110
+ title="show/hide quicksearch" /></span></h3>
111
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
112
+ <fieldset>
113
+ <legend>Quicksearch</legend>
114
+ <input type="text" name="quicksearch" value=""
115
+ class="quicksearch-field" />
116
+ </fieldset>
117
+ </form>
118
+
119
+ <ul class="link-list">
120
+
121
+ <li><a href="../Orgmode.html">Orgmode</a></li>
122
+
123
+ <li><a href="../Orgmode/Headline.html">Orgmode::Headline</a></li>
124
+
125
+ <li><a href="../Orgmode/HtmlOutputBuffer.html">Orgmode::HtmlOutputBuffer</a></li>
126
+
127
+ <li><a href="../Orgmode/Line.html">Orgmode::Line</a></li>
128
+
129
+ <li><a href="../Orgmode/OutputBuffer.html">Orgmode::OutputBuffer</a></li>
130
+
131
+ <li><a href="../Orgmode/Parser.html">Orgmode::Parser</a></li>
132
+
133
+ <li><a href="../Orgmode/RegexpHelper.html">Orgmode::RegexpHelper</a></li>
134
+
135
+ <li><a href="../Orgmode/TextileOutputBuffer.html">Orgmode::TextileOutputBuffer</a></li>
136
+
137
+ <li><a href="../OrgRuby.html">OrgRuby</a></li>
138
+
139
+ </ul>
140
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
141
+ </div>
142
+
143
+
144
+ </div>
145
+ </div>
146
+
147
+ <div id="documentation">
148
+ <h1 class="class">Orgmode::RegexpHelper</h1>
149
+
150
+ <div id="description" class="description">
151
+
152
+ <h1>Summary</h1>
153
+
154
+ <p>This class contains helper routines to deal with the Regexp “black
155
+ magic” you need to properly parse org-mode files.</p>
156
+
157
+ <h1>Key methods</h1>
158
+ <ul><li>
159
+ <p>Use <tt><a
160
+ href="RegexpHelper.html#method-i-rewrite_emphasis">rewrite_emphasis</a></tt>
161
+ to replace org-mode emphasis strings (e.g., /italic/) with the suitable
162
+ markup for the output.</p>
163
+ </li><li>
164
+ <p>Use <tt><a
165
+ href="RegexpHelper.html#method-i-rewrite_links">rewrite_links</a></tt> to
166
+ get a chance to rewrite all org-mode links with suitable markup for the
167
+ output.</p>
168
+ </li><li>
169
+ <p>Use <tt><a
170
+ href="RegexpHelper.html#method-i-rewrite_images">rewrite_images</a></tt> to
171
+ rewrite all inline image links with suitable markup for the output.</p>
172
+ </li></ul>
173
+
174
+ </div><!-- description -->
175
+
176
+
177
+ <div id="5Buntitled-5D" class="documentation-section">
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ <!-- Attributes -->
186
+ <div id="attribute-method-details" class="method-section section">
187
+ <h3 class="section-header">Attributes</h3>
188
+
189
+
190
+ <div id="body_regexp-attribute-method" class="method-detail">
191
+ <a name="body_regexp"></a>
192
+
193
+ <div class="method-heading attribute-method-heading">
194
+ <span class="method-name">body_regexp</span><span
195
+ class="attribute-access-type">[R]</span>
196
+ </div>
197
+
198
+ <div class="method-description">
199
+
200
+
201
+
202
+ </div>
203
+ </div>
204
+
205
+ <div id="border_forbidden-attribute-method" class="method-detail">
206
+ <a name="border_forbidden"></a>
207
+
208
+ <div class="method-heading attribute-method-heading">
209
+ <span class="method-name">border_forbidden</span><span
210
+ class="attribute-access-type">[R]</span>
211
+ </div>
212
+
213
+ <div class="method-description">
214
+
215
+
216
+
217
+ </div>
218
+ </div>
219
+
220
+ <div id="markers-attribute-method" class="method-detail">
221
+ <a name="markers"></a>
222
+
223
+ <div class="method-heading attribute-method-heading">
224
+ <span class="method-name">markers</span><span
225
+ class="attribute-access-type">[R]</span>
226
+ </div>
227
+
228
+ <div class="method-description">
229
+
230
+
231
+
232
+ </div>
233
+ </div>
234
+
235
+ <div id="org_emphasis_regexp-attribute-method" class="method-detail">
236
+ <a name="org_emphasis_regexp"></a>
237
+
238
+ <div class="method-heading attribute-method-heading">
239
+ <span class="method-name">org_emphasis_regexp</span><span
240
+ class="attribute-access-type">[R]</span>
241
+ </div>
242
+
243
+ <div class="method-description">
244
+
245
+
246
+
247
+ </div>
248
+ </div>
249
+
250
+ <div id="post_emphasis-attribute-method" class="method-detail">
251
+ <a name="post_emphasis"></a>
252
+
253
+ <div class="method-heading attribute-method-heading">
254
+ <span class="method-name">post_emphasis</span><span
255
+ class="attribute-access-type">[R]</span>
256
+ </div>
257
+
258
+ <div class="method-description">
259
+
260
+
261
+
262
+ </div>
263
+ </div>
264
+
265
+ <div id="pre_emphasis-attribute-method" class="method-detail">
266
+ <a name="pre_emphasis"></a>
267
+
268
+ <div class="method-heading attribute-method-heading">
269
+ <span class="method-name">pre_emphasis</span><span
270
+ class="attribute-access-type">[R]</span>
271
+ </div>
272
+
273
+ <div class="method-description">
274
+
275
+ <p>EMPHASIS</p>
276
+
277
+ <p>I figure it’s best to stick as closely to the elisp implementation as
278
+ possible for emphasis. org.el defines the regular expression that is used
279
+ to apply “emphasis” (in my terminology, inline formatting instead of
280
+ block formatting). Here’s the documentation from org.el.</p>
281
+
282
+ <p>Terminology: In an emphasis string like “ *strong word* ”, we call the
283
+ initial space PREMATCH, the final space POSTMATCH, the stars MARKERS,
284
+ “s” and “d” are BORDER characters and “trong wor” is the body.
285
+ The different components in this variable specify what is allowed/forbidden
286
+ in each part:</p>
287
+
288
+ <p>pre Chars allowed as prematch. <a href="Line.html">Line</a>
289
+ beginning allowed, too. post Chars allowed as postmatch. <a
290
+ href="Line.html">Line</a> end will be allowed too. border The chars
291
+ <b>forbidden</b> as border characters. body-regexp A regexp like "." to
292
+ match a body character. Don’t use</p>
293
+
294
+ <pre>non-shy groups here, and don't allow newline here.</pre>
295
+
296
+ <p>newline The maximum number of newlines allowed in an emphasis exp.</p>
297
+
298
+ <p>I currently don’t use <tt>newline</tt> because I’ve thrown this
299
+ information away by this point in the code. TODO – revisit?</p>
300
+
301
+ </div>
302
+ </div>
303
+
304
+ </div><!-- attribute-method-details -->
305
+
306
+
307
+ <!-- Methods -->
308
+
309
+ <div id="public-class-method-details" class="method-section section">
310
+ <h3 class="section-header">Public Class Methods</h3>
311
+
312
+
313
+ <div id="new-method" class="method-detail ">
314
+ <a name="method-c-new"></a>
315
+
316
+
317
+ <div class="method-heading">
318
+ <span class="method-name">new</span><span
319
+ class="method-args">()</span>
320
+ <span class="method-click-advice">click to toggle source</span>
321
+ </div>
322
+
323
+
324
+ <div class="method-description">
325
+
326
+
327
+
328
+
329
+
330
+ <div class="method-source-code" id="new-source">
331
+ <pre>
332
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 53</span>
333
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
334
+ <span class="ruby-comment"># Set up the emphasis regular expression.</span>
335
+ <span class="ruby-ivar">@pre_emphasis</span> = <span class="ruby-string">&quot; \t\\('\&quot;&quot;</span>
336
+ <span class="ruby-ivar">@post_emphasis</span> = <span class="ruby-string">&quot;- \t.,:!?;'\&quot;\\)&quot;</span>
337
+ <span class="ruby-ivar">@border_forbidden</span> = <span class="ruby-string">&quot; \t\r\n,\&quot;'&quot;</span>
338
+ <span class="ruby-ivar">@body_regexp</span> = <span class="ruby-string">&quot;.*?&quot;</span>
339
+ <span class="ruby-ivar">@markers</span> = <span class="ruby-string">&quot;*/_=~+&quot;</span>
340
+ <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDERR</span>)
341
+ <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">WARN</span>
342
+ <span class="ruby-identifier">build_org_emphasis_regexp</span>
343
+ <span class="ruby-identifier">build_org_link_regexp</span>
344
+ <span class="ruby-ivar">@org_subp_regexp</span> = <span class="ruby-regexp">/([_^])\{(.*?)\}/</span>
345
+ <span class="ruby-ivar">@org_footnote_regexp</span> = <span class="ruby-regexp">/\[fn:(.+?)(:(.*?))?\]/</span>
346
+ <span class="ruby-keyword">end</span></pre>
347
+ </div><!-- new-source -->
348
+
349
+ </div>
350
+
351
+
352
+
353
+
354
+ </div><!-- new-method -->
355
+
356
+
357
+ </div><!-- public-class-method-details -->
358
+
359
+ <div id="public-instance-method-details" class="method-section section">
360
+ <h3 class="section-header">Public Instance Methods</h3>
361
+
362
+
363
+ <div id="match_all-method" class="method-detail ">
364
+ <a name="method-i-match_all"></a>
365
+
366
+
367
+ <div class="method-heading">
368
+ <span class="method-name">match_all</span><span
369
+ class="method-args">(str)</span>
370
+ <span class="method-click-advice">click to toggle source</span>
371
+ </div>
372
+
373
+
374
+ <div class="method-description">
375
+
376
+ <p>Finds all emphasis matches in a string. Supply a block that will get the
377
+ marker and body as parameters.</p>
378
+
379
+
380
+
381
+ <div class="method-source-code" id="match_all-source">
382
+ <pre>
383
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 70</span>
384
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">match_all</span>(<span class="ruby-identifier">str</span>)
385
+ <span class="ruby-identifier">str</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@org_emphasis_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
386
+ <span class="ruby-keyword">yield</span> <span class="ruby-node">$2</span>, <span class="ruby-node">$3</span>
387
+ <span class="ruby-keyword">end</span>
388
+ <span class="ruby-keyword">end</span></pre>
389
+ </div><!-- match_all-source -->
390
+
391
+ </div>
392
+
393
+
394
+
395
+
396
+ </div><!-- match_all-method -->
397
+
398
+
399
+ <div id="rewrite_emphasis-method" class="method-detail ">
400
+ <a name="method-i-rewrite_emphasis"></a>
401
+
402
+
403
+ <div class="method-heading">
404
+ <span class="method-name">rewrite_emphasis</span><span
405
+ class="method-args">(str)</span>
406
+ <span class="method-click-advice">click to toggle source</span>
407
+ </div>
408
+
409
+
410
+ <div class="method-description">
411
+
412
+ <p>Compute replacements for all matching emphasized phrases. Supply a block
413
+ that will get the marker and body as parameters; return the replacement
414
+ string from your block.</p>
415
+
416
+ <h1>Example</h1>
417
+
418
+ <pre>re = RegexpHelper.new
419
+ result = re.rewrite_emphasis(&quot;*bold*, /italic/, =code=&quot;) do |marker, body|
420
+ &quot;&lt;#{map[marker]}&gt;#{body}&lt;/#{map[marker]}&gt;&quot;
421
+ end</pre>
422
+
423
+ <p>In this example, the block body will get called three times:</p>
424
+ <ol><li>
425
+ <p>Marker: “*”, body: “bold”</p>
426
+ </li><li>
427
+ <p>Marker: “/”, body: “italic”</p>
428
+ </li><li>
429
+ <p>Marker: “=”, body: “code”</p>
430
+ </li></ol>
431
+
432
+ <p>The return from this block is a string that will be used to replace
433
+ “<b>bold</b>”, “/italic/”, and “=code=”, respectively. (Clearly
434
+ this sample string will use HTML-like syntax, assuming <tt>map</tt> is
435
+ defined appropriately.)</p>
436
+
437
+
438
+
439
+ <div class="method-source-code" id="rewrite_emphasis-source">
440
+ <pre>
441
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 97</span>
442
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">rewrite_emphasis</span>(<span class="ruby-identifier">str</span>)
443
+ <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-ivar">@org_emphasis_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
444
+ <span class="ruby-identifier">inner</span> = <span class="ruby-keyword">yield</span> <span class="ruby-node">$2</span>, <span class="ruby-node">$3</span>
445
+ <span class="ruby-node">&quot;#{$1}#{inner}#{$4}&quot;</span>
446
+ <span class="ruby-keyword">end</span>
447
+ <span class="ruby-keyword">end</span></pre>
448
+ </div><!-- rewrite_emphasis-source -->
449
+
450
+ </div>
451
+
452
+
453
+
454
+
455
+ </div><!-- rewrite_emphasis-method -->
456
+
457
+
458
+ <div id="rewrite_footnote-method" class="method-detail ">
459
+ <a name="method-i-rewrite_footnote"></a>
460
+
461
+
462
+ <div class="method-heading">
463
+ <span class="method-name">rewrite_footnote</span><span
464
+ class="method-args">(str)</span>
465
+ <span class="method-click-advice">click to toggle source</span>
466
+ </div>
467
+
468
+
469
+ <div class="method-description">
470
+
471
+ <p>rewrite footnotes</p>
472
+
473
+
474
+
475
+ <div class="method-source-code" id="rewrite_footnote-source">
476
+ <pre>
477
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 112</span>
478
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">rewrite_footnote</span>(<span class="ruby-identifier">str</span>) <span class="ruby-comment"># :yields: name, definition or nil</span>
479
+ <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-ivar">@org_footnote_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
480
+ <span class="ruby-keyword">yield</span> <span class="ruby-node">$1</span>, <span class="ruby-node">$3</span>
481
+ <span class="ruby-keyword">end</span>
482
+ <span class="ruby-keyword">end</span></pre>
483
+ </div><!-- rewrite_footnote-source -->
484
+
485
+ </div>
486
+
487
+
488
+
489
+
490
+ </div><!-- rewrite_footnote-method -->
491
+
492
+
493
+ <div id="rewrite_images-method" class="method-detail ">
494
+ <a name="method-i-rewrite_images"></a>
495
+
496
+
497
+ <div class="method-heading">
498
+ <span class="method-name">rewrite_images</span><span
499
+ class="method-args">(str)</span>
500
+ <span class="method-click-advice">click to toggle source</span>
501
+ </div>
502
+
503
+
504
+ <div class="method-description">
505
+
506
+ <p>Rewrites all of the inline image tags.</p>
507
+
508
+
509
+
510
+ <div class="method-source-code" id="rewrite_images-source">
511
+ <pre>
512
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 153</span>
513
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">rewrite_images</span>(<span class="ruby-identifier">str</span>) <span class="ruby-comment"># :yields: image_link</span>
514
+ <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-ivar">@org_img_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
515
+ <span class="ruby-keyword">yield</span> <span class="ruby-node">$1</span>
516
+ <span class="ruby-keyword">end</span>
517
+ <span class="ruby-keyword">end</span></pre>
518
+ </div><!-- rewrite_images-source -->
519
+
520
+ </div>
521
+
522
+
523
+
524
+
525
+ </div><!-- rewrite_images-method -->
526
+
527
+
528
+ <div id="rewrite_links-method" class="method-detail ">
529
+ <a name="method-i-rewrite_links"></a>
530
+
531
+
532
+ <div class="method-heading">
533
+ <span class="method-name">rewrite_links</span><span
534
+ class="method-args">(str)</span>
535
+ <span class="method-click-advice">click to toggle source</span>
536
+ </div>
537
+
538
+
539
+ <div class="method-description">
540
+
541
+ <h1>Summary</h1>
542
+
543
+ <p>Rewrite org-mode links in a string to markup suitable to the output format.</p>
544
+
545
+ <h1>Usage</h1>
546
+
547
+ <p>Give this a block that expect the link and optional friendly text. Return
548
+ how that link should get formatted.</p>
549
+
550
+ <h1>Example</h1>
551
+
552
+ <pre>re = RegexpHelper.new
553
+ result = re.rewrite_links(&quot;[[http://www.bing.com]] and [[http://www.hotmail.com][Hotmail]]&quot;) do |link, text}
554
+ text ||= link
555
+ &quot;&lt;a href=\&quot;#{link}\&quot;&gt;#{text}&lt;/a&gt;&quot;
556
+ end</pre>
557
+
558
+ <p>In this example, the block body will get called two times. In the first
559
+ instance, <tt>text</tt> will be nil (the org-mode markup gives no friendly
560
+ text for the link +<a href="http://www.bing.com">www.bing.com</a>+. In the
561
+ second instance, the block will get text of <b>Hotmail</b> and the link +<a
562
+ href="http://www.hotmail.com">www.hotmail.com</a>+. In both cases, the
563
+ block returns an HTML-style link, and that is how things will get recorded
564
+ in <tt>result</tt>.</p>
565
+
566
+
567
+
568
+ <div class="method-source-code" id="rewrite_links-source">
569
+ <pre>
570
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 143</span>
571
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">rewrite_links</span>(<span class="ruby-identifier">str</span>) <span class="ruby-comment"># :yields: link, text</span>
572
+ <span class="ruby-identifier">i</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-ivar">@org_link_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
573
+ <span class="ruby-keyword">yield</span> <span class="ruby-node">$1</span>, <span class="ruby-keyword">nil</span>
574
+ <span class="ruby-keyword">end</span>
575
+ <span class="ruby-identifier">i</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-ivar">@org_link_text_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
576
+ <span class="ruby-keyword">yield</span> <span class="ruby-node">$1</span>, <span class="ruby-node">$2</span>
577
+ <span class="ruby-keyword">end</span>
578
+ <span class="ruby-keyword">end</span></pre>
579
+ </div><!-- rewrite_links-source -->
580
+
581
+ </div>
582
+
583
+
584
+
585
+
586
+ </div><!-- rewrite_links-method -->
587
+
588
+
589
+ <div id="rewrite_subp-method" class="method-detail ">
590
+ <a name="method-i-rewrite_subp"></a>
591
+
592
+
593
+ <div class="method-heading">
594
+ <span class="method-name">rewrite_subp</span><span
595
+ class="method-args">(str)</span>
596
+ <span class="method-click-advice">click to toggle source</span>
597
+ </div>
598
+
599
+
600
+ <div class="method-description">
601
+
602
+ <p>rewrite subscript and superscript (_{foo} and ^{bar})</p>
603
+
604
+
605
+
606
+ <div class="method-source-code" id="rewrite_subp-source">
607
+ <pre>
608
+ <span class="ruby-comment"># File lib/org-ruby/regexp_helper.rb, line 105</span>
609
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">rewrite_subp</span>(<span class="ruby-identifier">str</span>) <span class="ruby-comment"># :yields: type (&quot;_&quot; for subscript and &quot;^&quot; for superscript), text</span>
610
+ <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-ivar">@org_subp_regexp</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
611
+ <span class="ruby-keyword">yield</span> <span class="ruby-node">$1</span>, <span class="ruby-node">$2</span>
612
+ <span class="ruby-keyword">end</span>
613
+ <span class="ruby-keyword">end</span></pre>
614
+ </div><!-- rewrite_subp-source -->
615
+
616
+ </div>
617
+
618
+
619
+
620
+
621
+ </div><!-- rewrite_subp-method -->
622
+
623
+
624
+ </div><!-- public-instance-method-details -->
625
+
626
+ </div><!-- 5Buntitled-5D -->
627
+
628
+
629
+ </div><!-- documentation -->
630
+
631
+ <div id="validator-badges">
632
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
633
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
634
+ Rdoc Generator</a> 2</small>.</p>
635
+ </div>
636
+
637
+ </body>
638
+ </html>
639
+