asciidoctor 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- data/README.asciidoc +163 -41
- data/Rakefile +3 -1
- data/asciidoctor.gemspec +13 -5
- data/bin/asciidoctor +6 -3
- data/bin/asciidoctor-safe +13 -0
- data/lib/asciidoctor.rb +237 -26
- data/lib/asciidoctor/abstract_node.rb +27 -17
- data/lib/asciidoctor/attribute_list.rb +6 -0
- data/lib/asciidoctor/backends/base_template.rb +3 -4
- data/lib/asciidoctor/backends/docbook45.rb +114 -55
- data/lib/asciidoctor/backends/html5.rb +173 -104
- data/lib/asciidoctor/cli/invoker.rb +105 -0
- data/lib/asciidoctor/cli/options.rb +146 -0
- data/lib/asciidoctor/document.rb +135 -35
- data/lib/asciidoctor/lexer.rb +86 -33
- data/lib/asciidoctor/list_item.rb +2 -2
- data/lib/asciidoctor/reader.rb +6 -7
- data/lib/asciidoctor/section.rb +17 -5
- data/lib/asciidoctor/substituters.rb +216 -97
- data/lib/asciidoctor/table.rb +9 -2
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +212 -0
- data/man/asciidoctor.ad +156 -0
- data/test/attributes_test.rb +108 -5
- data/test/blocks_test.rb +102 -15
- data/test/document_test.rb +214 -3
- data/test/fixtures/encoding.asciidoc +4 -0
- data/test/fixtures/sample.asciidoc +26 -0
- data/test/invoker_test.rb +254 -0
- data/test/lexer_test.rb +53 -0
- data/test/links_test.rb +30 -0
- data/test/lists_test.rb +648 -9
- data/test/options_test.rb +68 -0
- data/test/paragraphs_test.rb +65 -1
- data/test/reader_test.rb +18 -4
- data/test/{headers_test.rb → sections_test.rb} +237 -0
- data/test/substitutions_test.rb +247 -5
- data/test/tables_test.rb +22 -4
- data/test/test_helper.rb +47 -3
- data/test/text_test.rb +20 -4
- metadata +34 -6
- data/noof.rb +0 -16
@@ -1,9 +1,18 @@
|
|
1
1
|
class Asciidoctor::BaseTemplate
|
2
2
|
|
3
3
|
# create template matter to insert a style class from the role attribute if specified
|
4
|
-
def
|
4
|
+
def role_class
|
5
5
|
attrvalue(:role)
|
6
6
|
end
|
7
|
+
|
8
|
+
# create template matter to insert a style class from the style attribute if specified
|
9
|
+
def style_class(sibling = true)
|
10
|
+
attrvalue(:style, sibling)
|
11
|
+
end
|
12
|
+
|
13
|
+
def title_div(opts = {})
|
14
|
+
%(<% if title? %><div class="title">#{opts.has_key?(:caption) ? '<% unless @caption.nil? %><%= @caption %><% end %>' : ''}<%= title %></div><% end %>)
|
15
|
+
end
|
7
16
|
end
|
8
17
|
|
9
18
|
module Asciidoctor::HTML5
|
@@ -13,17 +22,27 @@ class DocumentTemplate < ::Asciidoctor::BaseTemplate
|
|
13
22
|
sections = node.sections
|
14
23
|
unless sections.empty?
|
15
24
|
toc_level, indent = ''
|
25
|
+
nested = true
|
16
26
|
unless node.is_a?(::Asciidoctor::Document)
|
17
|
-
|
27
|
+
if node.document.doctype == 'book'
|
28
|
+
indent = ' ' * node.level unless node.level == 0
|
29
|
+
nested = node.level > 0
|
30
|
+
else
|
31
|
+
indent = ' ' * node.level
|
32
|
+
end
|
18
33
|
end
|
19
|
-
toc_level << "#{indent}<ol>\n"
|
34
|
+
toc_level << "#{indent}<ol>\n" if nested
|
20
35
|
sections.each do |section|
|
21
|
-
toc_level << "#{indent} <li><a href=\"##{section.id}\">#{section.sectnum} #{section.title}</a></li>\n"
|
36
|
+
toc_level << "#{indent} <li><a href=\"##{section.id}\">#{!section.special && section.level > 0 ? "#{section.sectnum} " : ''}#{section.attr('caption')}#{section.title}</a></li>\n"
|
22
37
|
if section.level < to_depth && (child_toc_level = render_outline(section, to_depth))
|
23
|
-
|
38
|
+
if section.document.doctype != 'book' || section.level > 0
|
39
|
+
toc_level << "#{indent} <li>\n#{child_toc_level}\n#{indent} </li>\n"
|
40
|
+
else
|
41
|
+
toc_level << "#{indent}#{child_toc_level}\n"
|
42
|
+
end
|
24
43
|
end
|
25
44
|
end
|
26
|
-
toc_level << "#{indent}</ol>"
|
45
|
+
toc_level << "#{indent}</ol>" if nested
|
27
46
|
end
|
28
47
|
toc_level
|
29
48
|
end
|
@@ -38,8 +57,7 @@ class DocumentTemplate < ::Asciidoctor::BaseTemplate
|
|
38
57
|
|
39
58
|
def template
|
40
59
|
@template ||= @eruby.new <<-EOS
|
41
|
-
<%#encoding:UTF-8
|
42
|
-
<!DOCTYPE html>
|
60
|
+
<%#encoding:UTF-8%><!DOCTYPE html>
|
43
61
|
<html lang="en">
|
44
62
|
<head>
|
45
63
|
<meta http-equiv="Content-Type" content="text/html; charset=<%= attr :encoding %>">
|
@@ -100,9 +118,20 @@ pre code { background-color: #F8F8F8; padding: 0; }
|
|
100
118
|
<div id="content">
|
101
119
|
<%= content %>
|
102
120
|
</div>
|
121
|
+
<% if !@references[:footnotes].empty? %>
|
122
|
+
<div id="footnotes">
|
123
|
+
<hr>
|
124
|
+
<% @references[:footnotes].each do |fn| %>
|
125
|
+
<div class="footnote" id="_footnote_<%= fn.index %>">
|
126
|
+
<a href="#_footnoteref_<%= fn.index %>"><%= fn.index %></a>. <%= fn.text %>
|
127
|
+
</div>
|
128
|
+
<% end %>
|
129
|
+
</div>
|
130
|
+
<% end %>
|
103
131
|
<div id="footer">
|
104
132
|
<div id="footer-text">
|
105
|
-
|
133
|
+
<% if attr? :revnumber %>Version <%= attr :revnumber %><br><% end %>
|
134
|
+
Last updated <%= attr :docdatetime %>
|
106
135
|
</div>
|
107
136
|
</div>
|
108
137
|
</body>
|
@@ -114,8 +143,7 @@ end
|
|
114
143
|
class EmbeddedTemplate < ::Asciidoctor::BaseTemplate
|
115
144
|
def template
|
116
145
|
@template ||= @eruby.new <<-EOS
|
117
|
-
<%#encoding:UTF-8%>
|
118
|
-
<%= content %>
|
146
|
+
<%#encoding:UTF-8%><%= content %>
|
119
147
|
EOS
|
120
148
|
end
|
121
149
|
end
|
@@ -123,8 +151,7 @@ end
|
|
123
151
|
class BlockPreambleTemplate < ::Asciidoctor::BaseTemplate
|
124
152
|
def template
|
125
153
|
@template ||= @eruby.new <<-EOS
|
126
|
-
<%#encoding:UTF-8
|
127
|
-
<div id="preamble">
|
154
|
+
<%#encoding:UTF-8%><div id="preamble">
|
128
155
|
<div class="sectionbody">
|
129
156
|
<%= content %>
|
130
157
|
</div>
|
@@ -136,13 +163,13 @@ end
|
|
136
163
|
class SectionTemplate < ::Asciidoctor::BaseTemplate
|
137
164
|
def template
|
138
165
|
@template ||= @eruby.new <<-EOS
|
139
|
-
<%#encoding:UTF-8
|
140
|
-
|
166
|
+
<%#encoding:UTF-8%><%
|
167
|
+
if @level == 0 %>
|
141
168
|
<h1#{id}><%= title %></h1>
|
142
169
|
<%= content %>
|
143
170
|
<% else %>
|
144
|
-
<div class="sect<%= @level %>#{
|
145
|
-
<h<%= @level + 1 %>#{id}><% if attr? :numbered %><%= sectnum %> <% end %><%= title %></h<%= @level + 1 %>>
|
171
|
+
<div class="sect<%= @level %>#{role_class}">
|
172
|
+
<h<%= @level + 1 %>#{id}><% if !@special && (attr? :numbered) %><%= sectnum %> <% end %><%= attr :caption %><%= title %></h<%= @level + 1 %>>
|
146
173
|
<% if @level == 1 %>
|
147
174
|
<div class="sectionbody">
|
148
175
|
<%= content %>
|
@@ -156,17 +183,65 @@ class SectionTemplate < ::Asciidoctor::BaseTemplate
|
|
156
183
|
end
|
157
184
|
end
|
158
185
|
|
186
|
+
class BlockFloatingTitleTemplate < ::Asciidoctor::BaseTemplate
|
187
|
+
def template
|
188
|
+
@template ||= @eruby.new <<-EOS
|
189
|
+
<%#encoding:UTF-8%><h<%= @level + 1 %>#{id} class="#{style_class false}#{role_class}"><%= title %></h<%= @level + 1 %>>
|
190
|
+
EOS
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
159
194
|
class BlockDlistTemplate < ::Asciidoctor::BaseTemplate
|
160
195
|
def template
|
161
196
|
@template ||= @eruby.new <<-EOS
|
162
|
-
<%#encoding:UTF-8
|
163
|
-
|
164
|
-
|
165
|
-
|
197
|
+
<%#encoding:UTF-8%><%
|
198
|
+
if (attr :style) == 'qanda' %>
|
199
|
+
<div#{id} class="qlist#{style_class}#{role_class}">
|
200
|
+
#{title_div}
|
201
|
+
<ol>
|
202
|
+
<% content.each do |dt, dd| %>
|
203
|
+
<li>
|
204
|
+
<p><em><%= dt.text %></em></p>
|
205
|
+
<% unless dd.nil? %>
|
206
|
+
<% if dd.text? %>
|
207
|
+
<p><%= dd.text %></p>
|
208
|
+
<% end %>
|
209
|
+
<% if dd.blocks? %>
|
210
|
+
<%= dd.content %>
|
211
|
+
<% end %>
|
212
|
+
<% end %>
|
213
|
+
</li>
|
166
214
|
<% end %>
|
215
|
+
</ol>
|
216
|
+
</div>
|
217
|
+
<% elsif (attr :style) == 'horizontal' %>
|
218
|
+
<div#{id} class="hdlist#{role_class}">
|
219
|
+
#{title_div}
|
220
|
+
<table>
|
221
|
+
<colgroup>
|
222
|
+
<col<% if attr? :labelwidth %> style="width: <%= attr :labelwidth %>%;"<% end %>>
|
223
|
+
<col<% if attr? :itemwidth %> style="width: <%= attr :itemwidth %>%;"<% end %>>
|
224
|
+
</colgroup>
|
225
|
+
<% content.each do |dt, dd| %>
|
226
|
+
<tr>
|
227
|
+
<td class="hdlist1<% if attr? 'strong-option' %> strong<% end %>">
|
228
|
+
<%= dt.text %>
|
229
|
+
<br>
|
230
|
+
</td>
|
231
|
+
<td class="hdlist2"><% unless dd.nil? %><% if dd.text? %>
|
232
|
+
<p style="margin-top: 0"><%= dd.text %></p><% end %><% if dd.blocks? %>
|
233
|
+
<%= dd.content %><% end %><% end %>
|
234
|
+
</td>
|
235
|
+
</tr>
|
236
|
+
<% end %>
|
237
|
+
</table>
|
238
|
+
</div>
|
239
|
+
<% else %>
|
240
|
+
<div#{id} class="dlist#{style_class}#{role_class}">
|
241
|
+
#{title_div}
|
167
242
|
<dl>
|
168
243
|
<% content.each do |dt, dd| %>
|
169
|
-
<dt class="hdlist1"
|
244
|
+
<dt<% if !(attr? :style) %> class="hdlist1"<% end %>>
|
170
245
|
<%= dt.text %>
|
171
246
|
</dt>
|
172
247
|
<% unless dd.nil? %>
|
@@ -182,6 +257,7 @@ class BlockDlistTemplate < ::Asciidoctor::BaseTemplate
|
|
182
257
|
<% end %>
|
183
258
|
</dl>
|
184
259
|
</div>
|
260
|
+
<% end %>
|
185
261
|
EOS
|
186
262
|
end
|
187
263
|
end
|
@@ -189,11 +265,8 @@ end
|
|
189
265
|
class BlockListingTemplate < ::Asciidoctor::BaseTemplate
|
190
266
|
def template
|
191
267
|
@template ||= @eruby.new <<-EOS
|
192
|
-
<%#encoding:UTF-8
|
193
|
-
|
194
|
-
<% if title %>
|
195
|
-
<div class="title"><%= title %></div>
|
196
|
-
<% end %>
|
268
|
+
<%#encoding:UTF-8%><div#{id} class="listingblock#{role_class}">
|
269
|
+
#{title_div}
|
197
270
|
<div class="content monospaced">
|
198
271
|
<% if (attr :style) == 'source' %>
|
199
272
|
<pre class="highlight<% if attr('source-highlighter') == 'coderay' %> CodeRay<% end %>"><code#{attribute('class', :language)}><%= template.preserve_endlines(content, self) %></code></pre>
|
@@ -209,11 +282,8 @@ end
|
|
209
282
|
class BlockLiteralTemplate < ::Asciidoctor::BaseTemplate
|
210
283
|
def template
|
211
284
|
@template ||= @eruby.new <<-EOS
|
212
|
-
<%#encoding:UTF-8
|
213
|
-
|
214
|
-
<% if title %>
|
215
|
-
<div class="title"><%= title %></div>
|
216
|
-
<% end %>
|
285
|
+
<%#encoding:UTF-8%><div#{id} class="literalblock#{role_class}">
|
286
|
+
#{title_div}
|
217
287
|
<div class="content monospaced">
|
218
288
|
<pre><%= template.preserve_endlines(content, self) %></pre>
|
219
289
|
</div>
|
@@ -225,8 +295,7 @@ end
|
|
225
295
|
class BlockAdmonitionTemplate < ::Asciidoctor::BaseTemplate
|
226
296
|
def template
|
227
297
|
@template ||= @eruby.new <<-EOS
|
228
|
-
<%#encoding:UTF-8
|
229
|
-
<div#{id} class="admonitionblock#{style_class}">
|
298
|
+
<%#encoding:UTF-8%><div#{id} class="admonitionblock#{role_class}">
|
230
299
|
<table>
|
231
300
|
<tr>
|
232
301
|
<td class="icon">
|
@@ -237,9 +306,7 @@ class BlockAdmonitionTemplate < ::Asciidoctor::BaseTemplate
|
|
237
306
|
<% end %>
|
238
307
|
</td>
|
239
308
|
<td class="content">
|
240
|
-
|
241
|
-
<div class="title"><%= title %></div>
|
242
|
-
<% end %>
|
309
|
+
#{title_div}
|
243
310
|
<%= content %>
|
244
311
|
</td>
|
245
312
|
</tr>
|
@@ -252,11 +319,8 @@ end
|
|
252
319
|
class BlockParagraphTemplate < ::Asciidoctor::BaseTemplate
|
253
320
|
def template
|
254
321
|
@template ||= @eruby.new <<-EOS
|
255
|
-
<%#encoding:UTF-8
|
256
|
-
|
257
|
-
<% unless title.nil? %>
|
258
|
-
<div class="title"><%= title %></div>
|
259
|
-
<% end %>
|
322
|
+
<%#encoding:UTF-8%><div#{id} class="paragraph#{role_class}">
|
323
|
+
#{title_div}
|
260
324
|
<p><%= content %></p>
|
261
325
|
</div>
|
262
326
|
EOS
|
@@ -266,12 +330,9 @@ end
|
|
266
330
|
class BlockSidebarTemplate < ::Asciidoctor::BaseTemplate
|
267
331
|
def template
|
268
332
|
@template ||= @eruby.new <<-EOS
|
269
|
-
<%#encoding:UTF-8
|
270
|
-
<div#{id} class="sidebarblock#{style_class}">
|
333
|
+
<%#encoding:UTF-8%><div#{id} class="sidebarblock#{role_class}">
|
271
334
|
<div class="content">
|
272
|
-
|
273
|
-
<div class="title"><%= title %></div>
|
274
|
-
<% end %>
|
335
|
+
#{title_div}
|
275
336
|
<%= content %>
|
276
337
|
</div>
|
277
338
|
</div>
|
@@ -282,12 +343,9 @@ end
|
|
282
343
|
class BlockExampleTemplate < ::Asciidoctor::BaseTemplate
|
283
344
|
def template
|
284
345
|
@template ||= @eruby.new <<-EOS
|
285
|
-
<%#encoding:UTF-8
|
286
|
-
|
346
|
+
<%#encoding:UTF-8%><div#{id} class="exampleblock#{role_class}">
|
347
|
+
#{title_div :caption => true}
|
287
348
|
<div class="content">
|
288
|
-
<% unless title.nil? %>
|
289
|
-
<div class="title"><%= title %></div>
|
290
|
-
<% end %>
|
291
349
|
<%= content %>
|
292
350
|
</div>
|
293
351
|
</div>
|
@@ -298,11 +356,8 @@ end
|
|
298
356
|
class BlockOpenTemplate < ::Asciidoctor::BaseTemplate
|
299
357
|
def template
|
300
358
|
@template ||= @eruby.new <<-EOS
|
301
|
-
<%#encoding:UTF-8
|
302
|
-
|
303
|
-
<% unless title.nil? %>
|
304
|
-
<div class="title"><%= title %></div>
|
305
|
-
<% end %>
|
359
|
+
<%#encoding:UTF-8%><div#{id} class="openblock#{role_class}">
|
360
|
+
#{title_div}
|
306
361
|
<div class="content">
|
307
362
|
<%= content %>
|
308
363
|
</div>
|
@@ -314,8 +369,7 @@ end
|
|
314
369
|
class BlockPassTemplate < ::Asciidoctor::BaseTemplate
|
315
370
|
def template
|
316
371
|
@template ||= @eruby.new <<-EOS
|
317
|
-
<%#encoding:UTF-8%>
|
318
|
-
<%= content %>
|
372
|
+
<%#encoding:UTF-8%><%= content %>
|
319
373
|
EOS
|
320
374
|
end
|
321
375
|
end
|
@@ -323,17 +377,14 @@ end
|
|
323
377
|
class BlockQuoteTemplate < ::Asciidoctor::BaseTemplate
|
324
378
|
def template
|
325
379
|
@template ||= @eruby.new <<-EOS
|
326
|
-
<%#encoding:UTF-8
|
327
|
-
|
328
|
-
|
329
|
-
<div class="title"><%= title %></div>
|
330
|
-
<% end %>
|
331
|
-
<div class="content">
|
380
|
+
<%#encoding:UTF-8%><div#{id} class="quoteblock#{role_class}">
|
381
|
+
#{title_div}
|
382
|
+
<blockquote>
|
332
383
|
<%= content %>
|
333
|
-
</
|
384
|
+
</blockquote>
|
334
385
|
<div class="attribution">
|
335
386
|
<% if attr? :citetitle %>
|
336
|
-
<
|
387
|
+
<cite><%= attr :citetitle %></cite>
|
337
388
|
<% end %>
|
338
389
|
<% if attr? :attribution %>
|
339
390
|
<% if attr? :citetitle %>
|
@@ -350,15 +401,12 @@ end
|
|
350
401
|
class BlockVerseTemplate < ::Asciidoctor::BaseTemplate
|
351
402
|
def template
|
352
403
|
@template ||= @eruby.new <<-EOS
|
353
|
-
<%#encoding:UTF-8
|
354
|
-
|
355
|
-
<% unless title.nil? %>
|
356
|
-
<div class="title"><%= title %></div>
|
357
|
-
<% end %>
|
404
|
+
<%#encoding:UTF-8%><div#{id} class="verseblock#{role_class}">
|
405
|
+
#{title_div}
|
358
406
|
<pre class="content"><%= template.preserve_endlines(content, self) %></pre>
|
359
407
|
<div class="attribution">
|
360
408
|
<% if attr? :citetitle %>
|
361
|
-
<
|
409
|
+
<cite><%= attr :citetitle %></cite>
|
362
410
|
<% end %>
|
363
411
|
<% if attr? :attribution %>
|
364
412
|
<% if attr? :citetitle %>
|
@@ -375,11 +423,8 @@ end
|
|
375
423
|
class BlockUlistTemplate < ::Asciidoctor::BaseTemplate
|
376
424
|
def template
|
377
425
|
@template ||= @eruby.new <<-EOS
|
378
|
-
<%#encoding:UTF-8
|
379
|
-
|
380
|
-
<% unless title.nil? %>
|
381
|
-
<div class="title"><%= title %></div>
|
382
|
-
<% end %>
|
426
|
+
<%#encoding:UTF-8%><div#{id} class="ulist#{style_class}#{role_class}">
|
427
|
+
#{title_div}
|
383
428
|
<ul>
|
384
429
|
<% content.each do |li| %>
|
385
430
|
<li>
|
@@ -398,11 +443,8 @@ end
|
|
398
443
|
class BlockOlistTemplate < ::Asciidoctor::BaseTemplate
|
399
444
|
def template
|
400
445
|
@template ||= @eruby.new <<-EOS
|
401
|
-
<%#encoding:UTF-8
|
402
|
-
|
403
|
-
<% unless title.nil? %>
|
404
|
-
<div class="title"><%= title %></div>
|
405
|
-
<% end %>
|
446
|
+
<%#encoding:UTF-8%><div#{id} class="olist#{style_class}#{role_class}">
|
447
|
+
#{title_div}
|
406
448
|
<ol class="<%= attr :style %>"#{attribute('start', :start)}>
|
407
449
|
<% content.each do |li| %>
|
408
450
|
<li>
|
@@ -421,11 +463,18 @@ end
|
|
421
463
|
class BlockColistTemplate < ::Asciidoctor::BaseTemplate
|
422
464
|
def template
|
423
465
|
@template ||= @eruby.new <<-EOS
|
424
|
-
<%#encoding:UTF-8
|
425
|
-
|
426
|
-
<%
|
427
|
-
<
|
428
|
-
|
466
|
+
<%#encoding:UTF-8%><div#{id} class="colist#{style_class}#{role_class}">
|
467
|
+
#{title_div}
|
468
|
+
<% if attr? :icons %>
|
469
|
+
<table>
|
470
|
+
<% content.each_with_index do |li, i| %>
|
471
|
+
<tr>
|
472
|
+
<td><img src="<%= icon_uri("callouts/\#{i + 1}") %>" alt="<%= i + 1 %>"></td>
|
473
|
+
<td><%= li.text %></td>
|
474
|
+
</tr>
|
475
|
+
<% end %>
|
476
|
+
</table>
|
477
|
+
<% else %>
|
429
478
|
<ol>
|
430
479
|
<% content.each do |li| %>
|
431
480
|
<li>
|
@@ -433,6 +482,7 @@ class BlockColistTemplate < ::Asciidoctor::BaseTemplate
|
|
433
482
|
</li>
|
434
483
|
<% end %>
|
435
484
|
</ol>
|
485
|
+
<% end %>
|
436
486
|
</div>
|
437
487
|
EOS
|
438
488
|
end
|
@@ -441,12 +491,11 @@ end
|
|
441
491
|
class BlockTableTemplate < ::Asciidoctor::BaseTemplate
|
442
492
|
def template
|
443
493
|
@template ||= @eruby.new <<-EOS
|
444
|
-
<%#encoding:UTF-8%>
|
445
|
-
<table#{id} class="tableblock frame-<%= attr :frame, 'all' %> grid-<%= attr :grid, 'all'%>#{style_class}" style="<%
|
494
|
+
<%#encoding:UTF-8%><table#{id} class="tableblock frame-<%= attr :frame, 'all' %> grid-<%= attr :grid, 'all'%>#{role_class}" style="<%
|
446
495
|
if !(attr? 'autowidth-option') %>width: <%= attr :tablepcwidth %>%; <% end %><%
|
447
496
|
if attr? :float %>float: <%= attr :float %>; <% end %>">
|
448
497
|
<% if title? %>
|
449
|
-
<caption class="title"
|
498
|
+
<caption class="title"><% unless @caption.nil? %><%= @caption %><% end %><%= title %></caption>
|
450
499
|
<% end %>
|
451
500
|
<% if (attr :rowcount) >= 0 %>
|
452
501
|
<colgroup>
|
@@ -488,8 +537,7 @@ end
|
|
488
537
|
class BlockImageTemplate < ::Asciidoctor::BaseTemplate
|
489
538
|
def template
|
490
539
|
@template ||= @eruby.new <<-EOS
|
491
|
-
<%#encoding:UTF-8
|
492
|
-
<div#{id} class="imageblock#{style_class}">
|
540
|
+
<%#encoding:UTF-8%><div#{id} class="imageblock#{role_class}">
|
493
541
|
<div class="content">
|
494
542
|
<% if attr :link %>
|
495
543
|
<a class="image" href="<%= attr :link %>"><img src="<%= image_uri(attr :target) %>" alt="<%= attr :alt %>"#{attribute('width', :width)}#{attribute('height', :height)}></a>
|
@@ -497,9 +545,7 @@ class BlockImageTemplate < ::Asciidoctor::BaseTemplate
|
|
497
545
|
<img src="<%= image_uri(attr :target) %>" alt="<%= attr :alt %>"#{attribute('width', :width)}#{attribute('height', :height)}>
|
498
546
|
<% end %>
|
499
547
|
</div>
|
500
|
-
|
501
|
-
<div class="title"><%= title %></div>
|
502
|
-
<% end %>
|
548
|
+
#{title_div :caption => true}
|
503
549
|
</div>
|
504
550
|
EOS
|
505
551
|
end
|
@@ -508,7 +554,7 @@ end
|
|
508
554
|
class BlockRulerTemplate < ::Asciidoctor::BaseTemplate
|
509
555
|
def template
|
510
556
|
@template ||= @eruby.new <<-EOS
|
511
|
-
|
557
|
+
<%#encoding:UTF-8%><hr>
|
512
558
|
EOS
|
513
559
|
end
|
514
560
|
end
|
@@ -516,7 +562,7 @@ end
|
|
516
562
|
class InlineBreakTemplate < ::Asciidoctor::BaseTemplate
|
517
563
|
def template
|
518
564
|
@template ||= @eruby.new <<-EOS
|
519
|
-
|
565
|
+
<%#encoding:UTF-8%><%= text %><br>
|
520
566
|
EOS
|
521
567
|
end
|
522
568
|
end
|
@@ -524,7 +570,7 @@ end
|
|
524
570
|
class InlineCalloutTemplate < ::Asciidoctor::BaseTemplate
|
525
571
|
def template
|
526
572
|
@template ||= @eruby.new <<-EOS
|
527
|
-
|
573
|
+
<%#encoding:UTF-8%><% if attr? :icons %><img src="<%= icon_uri("callouts/\#@text") %>" alt="<%= @text %>"><% else %><b><<%= @text %>></b><% end %>
|
528
574
|
EOS
|
529
575
|
end
|
530
576
|
end
|
@@ -543,7 +589,7 @@ class InlineQuotedTemplate < ::Asciidoctor::BaseTemplate
|
|
543
589
|
|
544
590
|
def template
|
545
591
|
@template ||= @eruby.new <<-EOS
|
546
|
-
|
592
|
+
<%#encoding:UTF-8%><% tags = template.class::QUOTED_TAGS[@type] %><%= tags.first %><%
|
547
593
|
if attr? :role %><span#{attribute('class', :role)}><%
|
548
594
|
end %><%= @text %><%
|
549
595
|
if attr? :role %></span><%
|
@@ -555,15 +601,16 @@ end
|
|
555
601
|
class InlineAnchorTemplate < ::Asciidoctor::BaseTemplate
|
556
602
|
def template
|
557
603
|
@template ||= @eruby.new <<-EOS
|
558
|
-
|
604
|
+
<%#encoding:UTF-8%><%
|
559
605
|
if type == :xref
|
560
606
|
%><a href="#<%= @target %>"><%= @text || @document.references[:ids].fetch(@target, '[' + @target + ']') %></a><%
|
561
607
|
elsif @type == :ref
|
562
608
|
%><a id="<%= @target %>"></a><%
|
609
|
+
elsif @type == :bibref
|
610
|
+
%><a id="<%= @target %>"></a>[<%= @target %>]<%
|
563
611
|
else
|
564
612
|
%><a href="<%= @target %>"><%= @text %></a><%
|
565
|
-
end
|
566
|
-
%>
|
613
|
+
end %>
|
567
614
|
EOS
|
568
615
|
end
|
569
616
|
end
|
@@ -572,7 +619,7 @@ class InlineImageTemplate < ::Asciidoctor::BaseTemplate
|
|
572
619
|
def template
|
573
620
|
# care is taken here to avoid a space inside the optional <a> tag
|
574
621
|
@template ||= @eruby.new <<-EOS
|
575
|
-
|
622
|
+
<%#encoding:UTF-8%><span class="image#{role_class}">
|
576
623
|
<%
|
577
624
|
if attr :link %><a class="image" href="<%= attr :link %>"><%
|
578
625
|
end %><img src="<%= image_uri(target) %>" alt="<%= attr :alt %>"#{attribute('width', :width)}#{attribute('height', :height)}#{attribute('title', :title)}><%
|
@@ -582,4 +629,26 @@ class InlineImageTemplate < ::Asciidoctor::BaseTemplate
|
|
582
629
|
EOS
|
583
630
|
end
|
584
631
|
end
|
632
|
+
|
633
|
+
class InlineFootnoteTemplate < ::Asciidoctor::BaseTemplate
|
634
|
+
def template
|
635
|
+
@template ||= @eruby.new <<-EOS
|
636
|
+
<%#encoding:UTF-8%><%
|
637
|
+
if type == :xref
|
638
|
+
%><span class="footnoteref">[<a href="#_footnote_<%= attr :index %>" title="View footnote." class="footnote"><%= attr :index %></a>]</span><%
|
639
|
+
else
|
640
|
+
%><span class="footnote"<% if @id %> id="_footnote_<%= @id %>"<% end %>>[<a id="_footnoteref_<%= attr :index %>" href="#_footnote_<%= attr :index %>" title="View footnote." class="footnote"><%= attr :index %></a>]</span><%
|
641
|
+
end %>
|
642
|
+
EOS
|
643
|
+
end
|
644
|
+
end
|
645
|
+
|
646
|
+
class InlineIndextermTemplate < ::Asciidoctor::BaseTemplate
|
647
|
+
def template
|
648
|
+
@template ||= @eruby.new <<-EOS
|
649
|
+
<%#encoding:UTF-8%><% if type == :visible %><%= @text %><% end %>
|
650
|
+
EOS
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
585
654
|
end
|