asciidoctor 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/Gemfile +10 -0
- data/Guardfile +18 -0
- data/LICENSE +1 -1
- data/README.adoc +65 -21
- data/Rakefile +10 -0
- data/asciidoctor.gemspec +17 -35
- data/compat/asciidoc.conf +130 -13
- data/lib/asciidoctor.rb +107 -87
- data/lib/asciidoctor/abstract_block.rb +6 -2
- data/lib/asciidoctor/abstract_node.rb +21 -13
- data/lib/asciidoctor/attribute_list.rb +2 -5
- data/{stylesheets/asciidoctor.css → lib/asciidoctor/backends/_stylesheets.rb} +96 -46
- data/lib/asciidoctor/backends/base_template.rb +9 -4
- data/lib/asciidoctor/backends/docbook45.rb +246 -138
- data/lib/asciidoctor/backends/html5.rb +580 -381
- data/lib/asciidoctor/block.rb +2 -50
- data/lib/asciidoctor/cli/options.rb +9 -8
- data/lib/asciidoctor/document.rb +35 -45
- data/lib/asciidoctor/helpers.rb +10 -0
- data/lib/asciidoctor/lexer.rb +456 -148
- data/lib/asciidoctor/list_item.rb +0 -21
- data/lib/asciidoctor/path_resolver.rb +18 -12
- data/lib/asciidoctor/reader.rb +71 -26
- data/lib/asciidoctor/renderer.rb +2 -19
- data/lib/asciidoctor/section.rb +0 -1
- data/lib/asciidoctor/substituters.rb +150 -36
- data/lib/asciidoctor/table.rb +30 -24
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +22 -16
- data/man/asciidoctor.ad +24 -16
- data/test/attributes_test.rb +50 -0
- data/test/blocks_test.rb +660 -9
- data/test/document_test.rb +191 -14
- data/test/fixtures/encoding.asciidoc +8 -0
- data/test/invoker_test.rb +47 -0
- data/test/lexer_test.rb +172 -0
- data/test/links_test.rb +28 -0
- data/test/lists_test.rb +172 -13
- data/test/options_test.rb +29 -2
- data/test/paragraphs_test.rb +105 -47
- data/test/paths_test.rb +3 -3
- data/test/reader_test.rb +46 -0
- data/test/sections_test.rb +365 -12
- data/test/substitutions_test.rb +127 -11
- data/test/tables_test.rb +81 -14
- data/test/test_helper.rb +18 -7
- data/test/text_test.rb +17 -5
- metadata +9 -36
@@ -45,9 +45,6 @@ class AttributeList
|
|
45
45
|
# TODO named attributes cannot contain dash characters
|
46
46
|
NAME_PATTERN = /[A-Za-z:_][A-Za-z:_\-\.]*/
|
47
47
|
|
48
|
-
# Public: A regular expression for splitting a comma-separated string
|
49
|
-
CSV_SPLIT_PATTERN = /[ \t]*,[ \t]*/
|
50
|
-
|
51
48
|
def initialize(source, block = nil, quotes = ['\'', '"'], delimiter = ',', escape_char = '\\')
|
52
49
|
@scanner = ::StringScanner.new source
|
53
50
|
@block = block
|
@@ -170,8 +167,8 @@ class AttributeList
|
|
170
167
|
# opts is an alias for options
|
171
168
|
if name == 'options' || name == 'opts'
|
172
169
|
name = 'options'
|
173
|
-
resolved_value.split(
|
174
|
-
@attributes[o + '-option'] = ''
|
170
|
+
resolved_value.split(',').each do |o|
|
171
|
+
@attributes[o.strip + '-option'] = ''
|
175
172
|
end
|
176
173
|
elsif single_quoted_value && !@block.nil?
|
177
174
|
resolved_value = @block.apply_normal_subs(value)
|
@@ -1,3 +1,18 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module HTML5
|
3
|
+
# Internal: Generate the default stylesheet for CodeRay
|
4
|
+
#
|
5
|
+
# returns the default CodeRay stylesheet as a String
|
6
|
+
def self.default_coderay_stylesheet
|
7
|
+
::Asciidoctor::Helpers.require_library 'coderay'
|
8
|
+
::CodeRay::Encoders[:html]::CSS.new(:default).stylesheet
|
9
|
+
end
|
10
|
+
|
11
|
+
# Internal: Generate the default stylesheet for Asciidoctor
|
12
|
+
#
|
13
|
+
# returns the default Asciidoctor stylesheet as a String
|
14
|
+
def self.default_asciidoctor_stylesheet
|
15
|
+
<<'DEFAULT_ASCIIDOCTOR_STYLESHEET'
|
1
16
|
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
|
2
17
|
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; }
|
3
18
|
audio, canvas, video { display: inline-block; }
|
@@ -55,7 +70,7 @@ img { -ms-interpolation-mode: bicubic; }
|
|
55
70
|
img { display: inline-block; }
|
56
71
|
textarea { height: auto; min-height: 50px; }
|
57
72
|
select { width: 100%; }
|
58
|
-
p.lead, #preamble > .sectionbody > .paragraph:first-of-type p { font-size: 1.21875em; line-height: 1.6; }
|
73
|
+
p.lead, .paragraph.lead > p, #preamble > .sectionbody > .paragraph:first-of-type p { font-size: 1.21875em; line-height: 1.6; }
|
59
74
|
.subheader, .admonitionblock td.content > .title, .exampleblock > .title, .imageblock > .title, .listingblock > .title, .literalblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, .sidebarblock > .title, .tableblock > .title, .verseblock > .title, .ulist > .title, .olist > .title, .dlist > .title, .qlist > .title, .tableblock > caption { line-height: 1.4; color: #7a2518; font-weight: 300; margin-top: 0.2em; margin-bottom: 0.5em; }
|
60
75
|
div, dl, dt, dd, ul, ol, li, h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6, pre, form, p, blockquote, th, td { margin: 0; padding: 0; direction: ltr; }
|
61
76
|
a { color: #005498; text-decoration: underline; line-height: inherit; }
|
@@ -63,7 +78,7 @@ a:hover, a:focus { color: #00467f; }
|
|
63
78
|
a img { border: none; }
|
64
79
|
p { font-family: inherit; font-weight: normal; font-size: 1em; line-height: 1.6; margin-bottom: 1.25em; text-rendering: optimizeLegibility; }
|
65
80
|
p aside { font-size: 0.875em; line-height: 1.35; font-style: italic; }
|
66
|
-
h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6 { font-family:
|
81
|
+
h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6 { font-family: Georgia, "URW Bookman L", Helvetica, Arial, sans-serif; font-weight: normal; font-style: normal; color: #ba3925; text-rendering: optimizeLegibility; margin-top: 1em; margin-bottom: 0.5em; line-height: 1.2125em; }
|
67
82
|
h1 small, h2 small, h3 small, #toctitle small, .sidebarblock > .content > .title small, h4 small, h5 small, h6 small { font-size: 60%; color: #e99b8f; line-height: 0; }
|
68
83
|
h1 { font-size: 2.125em; }
|
69
84
|
h2 { font-size: 1.6875em; }
|
@@ -128,6 +143,11 @@ table tr.even, table tr.alt, table tr:nth-of-type(even) { background: #f9f9f9; }
|
|
128
143
|
table thead tr th, table tfoot tr th, table tbody tr td, table tr td, table tfoot tr td { display: table-cell; line-height: 1.6; }
|
129
144
|
pre > code, pre > tt { color: #222222; }
|
130
145
|
tt { font-size: 0.9375em; padding: 1px 3px 0; white-space: nowrap; background-color: #f2f2f2; border: 1px solid #cccccc; -webkit-border-radius: 4px; border-radius: 4px; text-shadow: none; }
|
146
|
+
kbd.keyseq { color: #555555; }
|
147
|
+
kbd:not(.keyseq) { display: inline-block; color: #222222; font-size: 0.75em; line-height: 1.4; background-color: #F7F7F7; border: 1px solid #ccc; -webkit-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; margin: -0.15em 0.15em 0 0.15em; padding: 0.2em 0.6em 0.2em 0.5em; vertical-align: middle; white-space: nowrap; }
|
148
|
+
kbd kbd:first-child { margin-left: 0; }
|
149
|
+
kbd kbd:last-child { margin-right: 0; }
|
150
|
+
.menuseq, .menu { color: #090909; }
|
131
151
|
p a > tt { text-decoration: underline; }
|
132
152
|
p a > tt:hover { color: #561309; }
|
133
153
|
#header, #content, #footnotes, #footer { width: 100%; margin-left: auto; margin-right: auto; margin-top: 0; margin-bottom: 0; max-width: 62.5em; *zoom: 1; position: relative; padding-left: 0.9375em; padding-right: 0.9375em; }
|
@@ -142,12 +162,25 @@ p a > tt:hover { color: #561309; }
|
|
142
162
|
#header br + span:before { content: "\2013 \0020"; }
|
143
163
|
#toc { border-bottom: 3px double #ebebeb; padding-bottom: 1.25em; }
|
144
164
|
#toc > ol { margin-left: 0.25em; }
|
165
|
+
#toc ol.sectlevel0 > li > a { font-style: italic; }
|
166
|
+
#toc ol.sectlevel0 ol.sectlevel1 { margin-left: 0; margin-top: 0.5em; margin-bottom: 0.5em; }
|
145
167
|
#toc ol { list-style-type: none; }
|
146
168
|
#toctitle { color: #7a2518; }
|
169
|
+
@media only screen and (min-width: 80em) { body.toc2 { padding-left: 20em; }
|
170
|
+
#toc.toc2 { position: fixed; width: 20em; left: 0; top: 0; border-right: 1px solid #ebebeb; border-bottom: 0; z-index: 1000; padding: 1em; height: 100%; overflow: auto; }
|
171
|
+
#toc.toc2 #toctitle { margin-top: 0; }
|
172
|
+
#toc.toc2 > ol { font-size: .95em; }
|
173
|
+
#toc.toc2 ol ol { margin-left: 0; padding-left: 1em; }
|
174
|
+
#toc.toc2 ol.sectlevel0 ol.sectlevel1 { padding-left: 0; margin-top: 0.5em; margin-bottom: 0.5em; } }
|
147
175
|
#footer { max-width: 100%; background-color: #222222; padding: 1.25em; }
|
148
176
|
#footer-text { color: #dddddd; line-height: 1.44; }
|
149
177
|
.sect1 { border-bottom: 3px double #ebebeb; padding-bottom: 1.25em; }
|
150
178
|
.sect1:last-of-type { border-bottom: 0; }
|
179
|
+
#content h1 > a.anchor, h2 > a.anchor, h3 > a.anchor, #toctitle > a.anchor, .sidebarblock > .content > .title > a.anchor, h4 > a.anchor, h5 > a.anchor, h6 > a.anchor { position: absolute; width: 1em; margin-left: -1em; display: block; text-decoration: none; visibility: hidden; text-align: center; font-weight: normal; }
|
180
|
+
#content h1 > a.anchor:before, h2 > a.anchor:before, h3 > a.anchor:before, #toctitle > a.anchor:before, .sidebarblock > .content > .title > a.anchor:before, h4 > a.anchor:before, h5 > a.anchor:before, h6 > a.anchor:before { content: '\00A7'; font-size: .85em; vertical-align: text-top; display: block; margin-top: 0.05em; }
|
181
|
+
#content h1:hover > a.anchor, #content h1 > a.anchor:hover, h2:hover > a.anchor, h2 > a.anchor:hover, h3:hover > a.anchor, #toctitle:hover > a.anchor, .sidebarblock > .content > .title:hover > a.anchor, h3 > a.anchor:hover, #toctitle > a.anchor:hover, .sidebarblock > .content > .title > a.anchor:hover, h4:hover > a.anchor, h4 > a.anchor:hover, h5:hover > a.anchor, h5 > a.anchor:hover, h6:hover > a.anchor, h6 > a.anchor:hover { visibility: visible; }
|
182
|
+
#content h1 > a.link, h2 > a.link, h3 > a.link, #toctitle > a.link, .sidebarblock > .content > .title > a.link, h4 > a.link, h5 > a.link, h6 > a.link { color: #ba3925; text-decoration: none; }
|
183
|
+
#content h1 > a.link:hover, h2 > a.link:hover, h3 > a.link:hover, #toctitle > a.link:hover, .sidebarblock > .content > .title > a.link:hover, h4 > a.link:hover, h5 > a.link:hover, h6 > a.link:hover { color: #a53221; }
|
151
184
|
.admonitionblock td.content > .title, .exampleblock > .title, .imageblock > .title, .listingblock > .title, .literalblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, .sidebarblock > .title, .tableblock > .title, .verseblock > .title, .ulist > .title, .olist > .title, .dlist > .title, .qlist > .title { text-align: left; font-weight: bold; }
|
152
185
|
.tableblock > caption { text-align: left; font-weight: bold; white-space: nowrap; overflow: visible; max-width: 0; }
|
153
186
|
table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-size: inherit; }
|
@@ -163,7 +196,7 @@ table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-si
|
|
163
196
|
.exampleblock > .content > :last-child { margin-bottom: 0; }
|
164
197
|
.exampleblock > .content h1, .exampleblock > .content h2, .exampleblock > .content h3, .exampleblock > .content #toctitle, .sidebarblock.exampleblock > .content > .title, .exampleblock > .content h4, .exampleblock > .content h5, .exampleblock > .content h6 { line-height: 1; margin-bottom: 0.625em; }
|
165
198
|
.exampleblock > .content h1.subheader, .exampleblock > .content h2.subheader, .exampleblock > .content h3.subheader, .exampleblock > .content .subheader#toctitle, .sidebarblock.exampleblock > .content > .subheader.title, .exampleblock > .content h4.subheader, .exampleblock > .content h5.subheader, .exampleblock > .content h6.subheader { line-height: 1.4; }
|
166
|
-
.exampleblock > .content > :last-child > :last-child, .exampleblock > .content .olist > ol > li:last-child > :last-child, .exampleblock > .content .ulist > ul > li:last-child > :last-child { margin-bottom: 0; }
|
199
|
+
.exampleblock > .content > :last-child > :last-child, .exampleblock > .content .olist > ol > li:last-child > :last-child, .exampleblock > .content .ulist > ul > li:last-child > :last-child, .exampleblock > .content .qlist > ol > li:last-child > :last-child { margin-bottom: 0; }
|
167
200
|
.exampleblock.result > .content { -webkit-box-shadow: 0 1px 8px #d9d9d9; box-shadow: 0 1px 8px #d9d9d9; }
|
168
201
|
.imageblock { margin-bottom: 1.25em; }
|
169
202
|
.sidebarblock { border-style: solid; border-width: 1px; border-color: #d9d9d9; margin-bottom: 1.25em; padding: 1.25em; background: #f2f2f2; -webkit-border-radius: 4px; border-radius: 4px; }
|
@@ -174,6 +207,8 @@ table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-si
|
|
174
207
|
.sidebarblock h1.subheader, .sidebarblock h2.subheader, .sidebarblock h3.subheader, .sidebarblock .subheader#toctitle, .sidebarblock > .content > .subheader.title, .sidebarblock h4.subheader, .sidebarblock h5.subheader, .sidebarblock h6.subheader { line-height: 1.4; }
|
175
208
|
.sidebarblock > .content > .title { color: #7a2518; margin-top: 0; line-height: 1.6; }
|
176
209
|
.sidebarblock > .content > .paragraph:last-child p { margin-bottom: 0; }
|
210
|
+
pre { color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; overflow-x: auto; line-height: 1.6; }
|
211
|
+
.verseblock { margin-bottom: 1.25em; }
|
177
212
|
.literalblock, .listingblock { margin-bottom: 1.25em; }
|
178
213
|
.literalblock > .content > pre, .listingblock > .content > pre { background: none; color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; border-width: 1px 0; border-style: dotted; border-color: #bfbfbf; -webkit-border-radius: 4px; border-radius: 4px; padding: 0.75em 0.75em 0.5em 0.75em; white-space: pre; overflow-x: auto; line-height: 1.6; }
|
179
214
|
.literalblock > .content > pre > code, .literalblock > .content > pre > tt, .listingblock > .content > pre > code, .listingblock > .content > pre > tt { color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; padding: 0; background: none; font-weight: normal; }
|
@@ -185,12 +220,13 @@ table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-si
|
|
185
220
|
.listingblock:hover .ruby:before { content: "ruby"; text-transform: uppercase; float: right; font-size: 0.9em; color: #999; }
|
186
221
|
.listingblock:hover .asciidoc:before { content: "asciidoc"; text-transform: uppercase; float: right; font-size: 0.9em; color: #999; }
|
187
222
|
.listingblock:hover .java:before { content: "java"; text-transform: uppercase; float: right; font-size: 0.9em; color: #999; }
|
223
|
+
.listingblock:hover .javascript:before { content: "javascript"; text-transform: uppercase; float: right; font-size: 0.9em; color: #999; }
|
188
224
|
.listingblock:hover .css:before { content: "css"; text-transform: uppercase; float: right; font-size: 0.9em; color: #999; }
|
189
225
|
.listingblock:hover .scss:before { content: "scss"; text-transform: uppercase; float: right; font-size: 0.9em; color: #999; }
|
190
226
|
.quoteblock { margin: 0 0 1.25em; padding: 0.5625em 1.25em 0 1.1875em; border-left: 1px solid #dddddd; }
|
191
|
-
.quoteblock blockquote { margin: 0 0 1.25em 0; padding: 0; border: 0; }
|
227
|
+
.quoteblock blockquote { margin: 0 0 1.25em 0; padding: 0 0 0.5625em 0; border: 0; }
|
192
228
|
.quoteblock blockquote > .paragraph:last-child p { margin-bottom: 0; }
|
193
|
-
.quoteblock .attribution { padding-bottom: 0.5625em; font-size: inherit; color: #555555; }
|
229
|
+
.quoteblock .attribution { margin-top: -.25em; padding-bottom: 0.5625em; font-size: inherit; color: #555555; }
|
194
230
|
.quoteblock .attribution br { display: none; }
|
195
231
|
.quoteblock .attribution cite { display: block; margin-bottom: 0.625em; }
|
196
232
|
table thead th, table tfoot th { font-weight: bold; }
|
@@ -222,53 +258,67 @@ ol.upperroman { list-style-type: upper-roman; }
|
|
222
258
|
.literalblock + .colist, .listingblock + .colist { margin-top: -0.5em; }
|
223
259
|
.colist > table tr > td:first-of-type { padding: 0 .8em; line-height: 1; }
|
224
260
|
.colist > table tr > td:last-of-type { padding: 0.25em 0; }
|
225
|
-
td.hdlist1 { vertical-align: top; padding-right: .8em; }
|
261
|
+
td.hdlist1 { vertical-align: top; padding-right: .8em; font-weight: bold; }
|
226
262
|
.qanda > ol > li > p:first-child { color: #00467f; }
|
227
263
|
span.footnote, span.footnoteref { vertical-align: super; font-size: 0.875em; }
|
228
264
|
span.footnote a, span.footnoteref a { text-decoration: none; }
|
229
|
-
#footnotes { padding: 0.75em 0.375em; margin-bottom: 1.25em; border-top: 1px solid #dddddd; }
|
230
|
-
#footnotes hr {
|
265
|
+
#footnotes { padding: 0.75em 0.375em; margin-bottom: 1.25em; #border-top: 1px solid #dddddd; }
|
266
|
+
#footnotes hr { width: 20%; min-width: 6.25em; margin: -.25em 0 .75em 0; border-width: 1px 0 0 0; }
|
231
267
|
#footnotes .footnote { line-height: 1.3; font-size: 0.875em; margin-left: 1.2em; text-indent: -1.2em; margin-bottom: .2em; }
|
232
268
|
#footnotes .footnote a { font-weight: bold; text-decoration: none; }
|
233
269
|
#footnotes .footnote:last-of-type { margin-bottom: 0; }
|
234
270
|
.gist .file-data > table { border: none; background: #fff; width: 100%; margin-bottom: 0; }
|
235
271
|
.gist .file-data > table td.line-data { width: 99%; }
|
236
|
-
.unbreakable { page-break-inside: avoid; }
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
272
|
+
div.unbreakable { page-break-inside: avoid; }
|
273
|
+
.big { font-size: larger; }
|
274
|
+
.small { font-size: smaller; }
|
275
|
+
.underline { text-decoration: underline; }
|
276
|
+
.overline { text-decoration: overline; }
|
277
|
+
.line-through { text-decoration: line-through; }
|
278
|
+
.aqua { color: #00bfbf; }
|
279
|
+
.aqua-background { background-color: #00fafa; }
|
280
|
+
.black { color: black; }
|
281
|
+
.black-background { background-color: black; }
|
282
|
+
.blue { color: #0000bf; }
|
283
|
+
.blue-background { background-color: #0000fa; }
|
284
|
+
.fuchsia { color: #bf00bf; }
|
285
|
+
.fuchsia-background { background-color: #fa00fa; }
|
286
|
+
.gray { color: #606060; }
|
287
|
+
.gray-background { background-color: #7d7d7d; }
|
288
|
+
.green { color: #006000; }
|
289
|
+
.green-background { background-color: #007d00; }
|
290
|
+
.lime { color: #00bf00; }
|
291
|
+
.lime-background { background-color: #00fa00; }
|
292
|
+
.maroon { color: #600000; }
|
293
|
+
.maroon-background { background-color: #7d0000; }
|
294
|
+
.navy { color: #000060; }
|
295
|
+
.navy-background { background-color: #00007d; }
|
296
|
+
.olive { color: #606000; }
|
297
|
+
.olive-background { background-color: #7d7d00; }
|
298
|
+
.purple { color: #600060; }
|
299
|
+
.purple-background { background-color: #7d007d; }
|
300
|
+
.red { color: #bf0000; }
|
301
|
+
.red-background { background-color: #fa0000; }
|
302
|
+
.silver { color: #909090; }
|
303
|
+
.silver-background { background-color: #bcbcbc; }
|
304
|
+
.teal { color: #006060; }
|
305
|
+
.teal-background { background-color: #007d7d; }
|
306
|
+
.white { color: #bfbfbf; }
|
307
|
+
.white-background { background-color: #fafafa; }
|
308
|
+
.yellow { color: #bfbf00; }
|
309
|
+
.yellow-background { background-color: #fafa00; }
|
310
|
+
.admonitionblock td.icon [class^="icon-"]:before { font-size: 2.5em; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); cursor: default; }
|
311
|
+
.admonitionblock td.icon .icon-note:before { content: "\f05a"; color: #005498; color: #003f72; }
|
312
|
+
.admonitionblock td.icon .icon-tip:before { content: "\f0eb"; text-shadow: 1px 1px 2px rgba(155, 155, 0, 0.8); color: #111; }
|
313
|
+
.admonitionblock td.icon .icon-warning:before { content: "\f071"; color: #bf6900; }
|
314
|
+
.admonitionblock td.icon .icon-caution:before { content: "\f06d"; color: #bf3400; }
|
315
|
+
.admonitionblock td.icon .icon-important:before { content: "\f06a"; color: #bf0000; }
|
316
|
+
.conum { display: inline-block; color: white !important; background-color: #222222; -webkit-border-radius: 100px; border-radius: 100px; text-align: center; width: 20px; height: 20px; font-size: 12px; font-weight: bold; line-height: 20px; font-family: Arial, sans-serif; font-style: normal; position: relative; top: -2px; letter-spacing: -1px; }
|
317
|
+
.conum * { color: white !important; }
|
318
|
+
.conum:empty { display: none; }
|
319
|
+
pre .comment .conum { left: -20px; }
|
274
320
|
.literalblock > .content > pre, .listingblock > .content > pre { -webkit-border-radius: 0; border-radius: 0; }
|
321
|
+
DEFAULT_ASCIIDOCTOR_STYLESHEET
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
@@ -65,7 +65,7 @@ class BaseTemplate
|
|
65
65
|
# returns the text with blank lines removed and HTML line feed entities
|
66
66
|
# converted to an endline character.
|
67
67
|
def compact(str)
|
68
|
-
str.gsub(
|
68
|
+
str.gsub(BLANK_LINE_PATTERN, '').gsub(LINE_FEED_ENTITY, "\n")
|
69
69
|
end
|
70
70
|
|
71
71
|
# Public: Preserve endlines by replacing them with the HTML line feed entity.
|
@@ -96,10 +96,15 @@ class BaseTemplate
|
|
96
96
|
end
|
97
97
|
|
98
98
|
# create template matter to insert a style class if the variable has a value
|
99
|
-
def attrvalue(key, sibling = true)
|
99
|
+
def attrvalue(key, sibling = true, inherit = true)
|
100
100
|
delimiter = sibling ? ' ' : ''
|
101
|
-
|
102
|
-
|
101
|
+
if inherit
|
102
|
+
# example: <% if attr? 'foo' %><%= attr 'foo' %><% end %>
|
103
|
+
%(<% if attr? '#{key}' %>#{delimiter}<%= attr '#{key}' %><% end %>)
|
104
|
+
else
|
105
|
+
# example: <% if attr? 'foo', nil, false %><%= attr 'foo', nil, false %><% end %>
|
106
|
+
%(<% if attr? '#{key}', nil, false %>#{delimiter}<%= attr '#{key}', nil, false %><% end %>)
|
107
|
+
end
|
103
108
|
end
|
104
109
|
|
105
110
|
# create template matter to insert an id if one is specified for the block
|
@@ -15,9 +15,9 @@ module Asciidoctor
|
|
15
15
|
|
16
16
|
def title_tag(optional = true)
|
17
17
|
if optional
|
18
|
-
%
|
18
|
+
%(<%= title? ? "\n<title>\#{title}</title>" : nil %>)
|
19
19
|
else
|
20
|
-
%
|
20
|
+
%(\n<title><%= title %></title>)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -26,7 +26,15 @@ module Asciidoctor
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def common_attrs_erb
|
29
|
-
%q
|
29
|
+
%q(<%= template.common_attrs(@id, (attr 'role'), (attr 'reftext')) %>)
|
30
|
+
end
|
31
|
+
|
32
|
+
def content(node)
|
33
|
+
node.blocks? ? node.content.chomp : "<simpara>#{node.content.chomp}</simpara>"
|
34
|
+
end
|
35
|
+
|
36
|
+
def content_erb
|
37
|
+
%q(<%= blocks? ? content.chomp : "<simpara>#{content.chomp}</simpara>" %>)
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
@@ -54,7 +62,7 @@ class DocumentTemplate < BaseTemplate
|
|
54
62
|
<% end %>
|
55
63
|
<% if has_header? %>
|
56
64
|
<% if attr? :author %>
|
57
|
-
<% if attr
|
65
|
+
<% if (attr :authorcount).to_i < 2 %>
|
58
66
|
<author>
|
59
67
|
#{tag 'firstname', :firstname}
|
60
68
|
#{tag 'othername', :middlename}
|
@@ -64,7 +72,7 @@ class DocumentTemplate < BaseTemplate
|
|
64
72
|
#{tag 'authorinitials', :authorinitials}
|
65
73
|
<% else %>
|
66
74
|
<authorgroup>
|
67
|
-
<% (1..(attr
|
75
|
+
<% (1..((attr :authorcount).to_i)).each do |idx| %>
|
68
76
|
<author>
|
69
77
|
#{tag 'firstname', :"firstname_\#{idx}", true}
|
70
78
|
#{tag 'othername', :"middlename_\#{idx}", true}
|
@@ -102,14 +110,14 @@ class DocumentTemplate < BaseTemplate
|
|
102
110
|
<bookinfo>
|
103
111
|
#{docinfo}
|
104
112
|
</bookinfo>
|
105
|
-
<%= content %>
|
113
|
+
<%= content.chomp %>
|
106
114
|
</book>
|
107
115
|
<% else %>
|
108
116
|
<article<% unless attr? :nolang %> lang="<%= attr :lang, 'en' %>"<% end %>>
|
109
117
|
<articleinfo>
|
110
118
|
#{docinfo}
|
111
119
|
</articleinfo>
|
112
|
-
<%= content %>
|
120
|
+
<%= content.chomp %>
|
113
121
|
</article>
|
114
122
|
<% end %>
|
115
123
|
EOF
|
@@ -135,14 +143,13 @@ end
|
|
135
143
|
class BlockPreambleTemplate < BaseTemplate
|
136
144
|
def template
|
137
145
|
@template ||= @eruby.new <<-EOF
|
138
|
-
<%#encoding:UTF-8%><%
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<% end %>
|
146
|
+
<%#encoding:UTF-8%><%
|
147
|
+
if @document.doctype == 'book' %><preface#{common_attrs_erb}>#{title_tag false}
|
148
|
+
<%= content.chomp %>
|
149
|
+
</preface><%
|
150
|
+
else %>
|
151
|
+
<%= content.chomp %><%
|
152
|
+
end %>
|
146
153
|
EOF
|
147
154
|
end
|
148
155
|
end
|
@@ -155,9 +162,9 @@ class SectionTemplate < BaseTemplate
|
|
155
162
|
tag = sec.document.doctype == 'book' && sec.level <= 1 ? (sec.level == 0 ? 'part' : 'chapter') : 'section'
|
156
163
|
end
|
157
164
|
%(<#{tag}#{common_attrs(sec.id, (sec.attr 'role'), (sec.attr 'reftext'))}>
|
158
|
-
|
159
|
-
|
160
|
-
</#{tag}
|
165
|
+
#{sec.title? ? "<title>#{sec.title}</title>" : nil}
|
166
|
+
#{sec.content.chomp}
|
167
|
+
</#{tag}>\n)
|
161
168
|
end
|
162
169
|
|
163
170
|
def template
|
@@ -175,32 +182,18 @@ end
|
|
175
182
|
|
176
183
|
class BlockParagraphTemplate < BaseTemplate
|
177
184
|
def paragraph(id, style, role, reftext, title, content)
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
<simpara>#{content}</simpara>
|
184
|
-
</partintro>)
|
185
|
-
else
|
186
|
-
%(<partintro#{common_attrs(id, role, reftext)}>
|
187
|
-
<simpara>#{content}</simpara>
|
188
|
-
</partintro>)
|
189
|
-
end
|
185
|
+
if !title.nil?
|
186
|
+
%(<formalpara#{common_attrs(id, role, reftext)}>
|
187
|
+
<title>#{title}</title>
|
188
|
+
<para>#{content}</para>
|
189
|
+
</formalpara>\n)
|
190
190
|
else
|
191
|
-
|
192
|
-
%(<formalpara#{common_attrs(id, role, reftext)}>
|
193
|
-
<title>#{title}</title>
|
194
|
-
<para>#{content}</para>
|
195
|
-
</formalpara>)
|
196
|
-
else
|
197
|
-
%(<simpara#{common_attrs(id, role, reftext)}>#{content}</simpara>)
|
198
|
-
end
|
191
|
+
%(<simpara#{common_attrs(id, role, reftext)}>#{content}</simpara>\n)
|
199
192
|
end
|
200
193
|
end
|
201
194
|
|
202
195
|
def result(node)
|
203
|
-
paragraph(node.id, node.attr
|
196
|
+
paragraph(node.id, (node.attr 'style', nil, false), (node.attr 'role'), (node.attr 'reftext'), (node.title? ? node.title : nil), node.content)
|
204
197
|
end
|
205
198
|
|
206
199
|
def template
|
@@ -211,13 +204,8 @@ end
|
|
211
204
|
class BlockAdmonitionTemplate < BaseTemplate
|
212
205
|
def template
|
213
206
|
@template ||= @eruby.new <<-EOF
|
214
|
-
<%#encoding:UTF-8%><<%= attr :name %>#{common_attrs_erb}
|
215
|
-
|
216
|
-
<% if blocks? %>
|
217
|
-
<%= content %>
|
218
|
-
<% else %>
|
219
|
-
<simpara><%= content.chomp %></simpara>
|
220
|
-
<% end %>
|
207
|
+
<%#encoding:UTF-8%><<%= attr :name %>#{common_attrs_erb}>#{title_tag}
|
208
|
+
#{content_erb}
|
221
209
|
</<%= attr :name %>>
|
222
210
|
EOF
|
223
211
|
end
|
@@ -227,8 +215,7 @@ class BlockUlistTemplate < BaseTemplate
|
|
227
215
|
def template
|
228
216
|
@template ||= @eruby.new <<-EOF
|
229
217
|
<%#encoding:UTF-8%><% if attr? :style, 'bibliography' %>
|
230
|
-
<bibliodiv#{common_attrs_erb}
|
231
|
-
#{title_tag}
|
218
|
+
<bibliodiv#{common_attrs_erb}>#{title_tag}
|
232
219
|
<% content.each do |li| %>
|
233
220
|
<bibliomixed>
|
234
221
|
<bibliomisc><%= li.text %></bibliomisc>
|
@@ -239,8 +226,7 @@ class BlockUlistTemplate < BaseTemplate
|
|
239
226
|
<% end %>
|
240
227
|
</bibliodiv>
|
241
228
|
<% else %>
|
242
|
-
<itemizedlist#{common_attrs_erb}
|
243
|
-
#{title_tag}
|
229
|
+
<itemizedlist#{common_attrs_erb}>#{title_tag}
|
244
230
|
<% content.each do |li| %>
|
245
231
|
<listitem>
|
246
232
|
<simpara><%= li.text %></simpara>
|
@@ -258,8 +244,7 @@ end
|
|
258
244
|
class BlockOlistTemplate < BaseTemplate
|
259
245
|
def template
|
260
246
|
@template ||= @eruby.new <<-EOF
|
261
|
-
<%#encoding:UTF-8%><orderedlist#{common_attrs_erb}#{attribute('numeration', :style)}
|
262
|
-
#{title_tag}
|
247
|
+
<%#encoding:UTF-8%><orderedlist#{common_attrs_erb}#{attribute('numeration', :style)}>#{title_tag}
|
263
248
|
<% content.each do |li| %>
|
264
249
|
<listitem>
|
265
250
|
<simpara><%= li.text %></simpara>
|
@@ -276,8 +261,7 @@ end
|
|
276
261
|
class BlockColistTemplate < BaseTemplate
|
277
262
|
def template
|
278
263
|
@template ||= @eruby.new <<-EOF
|
279
|
-
<%#encoding:UTF-8%><calloutlist#{common_attrs_erb}
|
280
|
-
#{title_tag}
|
264
|
+
<%#encoding:UTF-8%><calloutlist#{common_attrs_erb}>#{title_tag}
|
281
265
|
<% content.each do |li| %>
|
282
266
|
<callout arearefs="<%= li.attr :coids %>">
|
283
267
|
<para><%= li.text %></para>
|
@@ -315,67 +299,154 @@ class BlockDlistTemplate < BaseTemplate
|
|
315
299
|
}
|
316
300
|
|
317
301
|
def template
|
302
|
+
# TODO may want to refactor ListItem content to hold multiple terms
|
303
|
+
# that change would drastically simplify this template
|
318
304
|
@template ||= @eruby.new <<-EOF
|
319
|
-
<%#encoding:UTF-8%><%
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
305
|
+
<%#encoding:UTF-8%><%
|
306
|
+
continuing = false;
|
307
|
+
entries = content
|
308
|
+
last_index = entries.length - 1
|
309
|
+
if attr? :style, 'horizontal'
|
310
|
+
%><<%= (tag = title? ? 'table' : 'informaltable') %>#{common_attrs_erb} tabstyle="horizontal" frame="none" colsep="0" rowsep="0">#{title_tag}
|
311
|
+
<tgroup cols="2">
|
312
|
+
<colspec colwidth="<%= attr :labelwidth, 15 %>*"/>
|
313
|
+
<colspec colwidth="<%= attr :labelwidth, 85 %>*"/>
|
314
|
+
<tbody valign="top"><%
|
315
|
+
entries.each_with_index do |(dt, dd), index|
|
316
|
+
last = (index == last_index)
|
317
|
+
unless continuing %>
|
318
|
+
<row>
|
319
|
+
<entry><%
|
320
|
+
end %>
|
321
|
+
<simpara><%= dt.text %></simpara><%
|
322
|
+
if !last && dd.nil?
|
323
|
+
continuing = true
|
324
|
+
next
|
325
|
+
else
|
326
|
+
continuing = false
|
327
|
+
end %>
|
328
|
+
</entry>
|
329
|
+
<entry><%
|
330
|
+
unless dd.nil?
|
331
|
+
if dd.text? %>
|
332
|
+
<simpara><%= dd.text %></simpara><%
|
333
|
+
end
|
334
|
+
if dd.blocks? %>
|
335
|
+
<%= dd.content.chomp %><%
|
336
|
+
end
|
337
|
+
end %>
|
338
|
+
</entry><%
|
339
|
+
if last || !dd.nil? %>
|
340
|
+
</row><%
|
341
|
+
end %><%
|
342
|
+
end %>
|
343
|
+
</tbody>
|
344
|
+
</tgroup>
|
345
|
+
</<%= tag %>><%
|
346
|
+
else
|
347
|
+
tags = (template.class::LIST_TAGS[attr :style] || template.class::LIST_TAGS['labeled'])
|
348
|
+
if tags[:list]
|
349
|
+
%><<%= tags[:list] %>#{common_attrs_erb}>#{title_tag}<%
|
350
|
+
end
|
351
|
+
entries.each_with_index do |(dt, dd), index|
|
352
|
+
last = (index == last_index)
|
353
|
+
unless continuing %>
|
354
|
+
<<%= tags[:entry] %>><%
|
355
|
+
end
|
356
|
+
if tags.has_key?(:label)
|
357
|
+
unless continuing %>
|
358
|
+
<<%= tags[:label] %>><%
|
359
|
+
end %>
|
360
|
+
<<%= tags[:term] %>><%= dt.text %></<%= tags[:term] %>><%
|
361
|
+
if last || !dd.nil? %>
|
362
|
+
</<%= tags[:label] %>><%
|
363
|
+
end
|
364
|
+
else %>
|
365
|
+
<<%= tags[:term] %>><%= dt.text %></<%= tags[:term] %>><%
|
366
|
+
end
|
367
|
+
if !last && dd.nil?
|
368
|
+
continuing = true
|
369
|
+
next
|
370
|
+
else
|
371
|
+
continuing = false
|
372
|
+
end %>
|
373
|
+
<<%= tags[:item] %>><%
|
374
|
+
unless dd.nil?
|
375
|
+
if dd.text? %>
|
376
|
+
<simpara><%= dd.text %></simpara><%
|
377
|
+
end
|
378
|
+
if dd.blocks? %>
|
379
|
+
<%= dd.content %><%
|
380
|
+
end
|
381
|
+
end %>
|
382
|
+
</<%= tags[:item] %>>
|
383
|
+
</<%= tags[:entry] %>><%
|
384
|
+
end
|
385
|
+
if tags[:list] %>
|
386
|
+
</<%= tags[:list] %>><%
|
387
|
+
end
|
388
|
+
end %>
|
348
389
|
EOF
|
349
390
|
end
|
350
391
|
end
|
351
392
|
|
352
393
|
class BlockOpenTemplate < BaseTemplate
|
394
|
+
def result(node)
|
395
|
+
open_block(node, node.id, (node.attr 'style', nil, false),
|
396
|
+
(node.attr 'role'), (node.attr 'reftext'), node.title? ? node.title : nil)
|
397
|
+
end
|
398
|
+
|
399
|
+
def open_block(node, id, style, role, reftext, title)
|
400
|
+
case style
|
401
|
+
when 'abstract'
|
402
|
+
if node.parent == node.document && node.document.attr?('doctype', 'book')
|
403
|
+
puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.'
|
404
|
+
''
|
405
|
+
else
|
406
|
+
%(<abstract>#{title && "\n<title>#{title}</title>"}
|
407
|
+
#{content node}
|
408
|
+
</abstract>\n)
|
409
|
+
end
|
410
|
+
when 'partintro'
|
411
|
+
unless node.document.attr?('doctype', 'book') && node.parent.is_a?(Asciidoctor::Section) && node.level == 0
|
412
|
+
puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and it\'s a child of a part section. Excluding block content.'
|
413
|
+
''
|
414
|
+
else
|
415
|
+
%(<partintro#{common_attrs id, role, reftext}>#{title && "\n<title>#{title}</title>"}
|
416
|
+
#{content node}
|
417
|
+
</partintro>\n)
|
418
|
+
end
|
419
|
+
else
|
420
|
+
node.content
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
353
424
|
def template
|
354
|
-
:
|
425
|
+
:invoke_result
|
355
426
|
end
|
356
427
|
end
|
357
428
|
|
358
429
|
class BlockListingTemplate < BaseTemplate
|
359
430
|
def template
|
360
431
|
@template ||= @eruby.new <<-EOF
|
361
|
-
<%#encoding:UTF-8%><%
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
</formalpara
|
378
|
-
|
432
|
+
<%#encoding:UTF-8%><%
|
433
|
+
if !title?
|
434
|
+
if (attr? 'style', 'source') && (attr? 'language')
|
435
|
+
%><programlisting#{common_attrs_erb}#{attribute('language', :language)} linenumbering="<%= (attr? :linenums) ? 'numbered' : 'unnumbered' %>"><%= template.preserve_endlines(content, self) %></programlisting><%
|
436
|
+
else
|
437
|
+
%><screen#{common_attrs_erb}><%= template.preserve_endlines(content, self) %></screen><%
|
438
|
+
end
|
439
|
+
else
|
440
|
+
%><formalpara#{common_attrs_erb}>#{title_tag false}
|
441
|
+
<para><%
|
442
|
+
if (attr? 'style', 'source') && (attr? 'language') %>
|
443
|
+
<programlisting language="<%= attr 'language' %>" linenumbering="<%= (attr? :linenums) ? 'numbered' : 'unnumbered' %>"><%= template.preserve_endlines(content, self) %></programlisting><%
|
444
|
+
else %>
|
445
|
+
<screen><%= template.preserve_endlines(content, self) %></screen><%
|
446
|
+
end %>
|
447
|
+
</para>
|
448
|
+
</formalpara><%
|
449
|
+
end %>
|
379
450
|
EOF
|
380
451
|
end
|
381
452
|
end
|
@@ -386,8 +457,7 @@ class BlockLiteralTemplate < BaseTemplate
|
|
386
457
|
<%#encoding:UTF-8%><% if !title? %>
|
387
458
|
<literallayout#{common_attrs_erb} class="monospaced"><%= template.preserve_endlines(content, self) %></literallayout>
|
388
459
|
<% else %>
|
389
|
-
<formalpara#{common_attrs_erb}
|
390
|
-
#{title_tag false}
|
460
|
+
<formalpara#{common_attrs_erb}>#{title_tag false}
|
391
461
|
<para>
|
392
462
|
<literallayout class="monospaced"><%= template.preserve_endlines(content, self) %></literallayout>
|
393
463
|
</para>
|
@@ -400,10 +470,9 @@ end
|
|
400
470
|
class BlockExampleTemplate < BaseTemplate
|
401
471
|
def template
|
402
472
|
@template ||= @eruby.new <<-EOF
|
403
|
-
<%#encoding:UTF-8
|
404
|
-
|
405
|
-
|
406
|
-
</example>
|
473
|
+
<%#encoding:UTF-8%><<%= (tag_name = title? ? 'example' : 'informalexample') %>#{common_attrs_erb}>#{title_tag}
|
474
|
+
#{content_erb}
|
475
|
+
</<%= tag_name %>>
|
407
476
|
EOF
|
408
477
|
end
|
409
478
|
end
|
@@ -411,9 +480,8 @@ end
|
|
411
480
|
class BlockSidebarTemplate < BaseTemplate
|
412
481
|
def template
|
413
482
|
@template ||= @eruby.new <<-EOF
|
414
|
-
<%#encoding:UTF-8%><sidebar#{common_attrs_erb}
|
415
|
-
|
416
|
-
<%= content %>
|
483
|
+
<%#encoding:UTF-8%><sidebar#{common_attrs_erb}>#{title_tag}
|
484
|
+
#{content_erb}
|
417
485
|
</sidebar>
|
418
486
|
EOF
|
419
487
|
end
|
@@ -422,21 +490,16 @@ end
|
|
422
490
|
class BlockQuoteTemplate < BaseTemplate
|
423
491
|
def template
|
424
492
|
@template ||= @eruby.new <<-EOF
|
425
|
-
<%#encoding:UTF-8%><blockquote#{common_attrs_erb}
|
426
|
-
#{title_tag}
|
493
|
+
<%#encoding:UTF-8%><blockquote#{common_attrs_erb}>#{title_tag}
|
427
494
|
<% if (attr? :attribution) || (attr? :citetitle) %>
|
428
495
|
<attribution>
|
429
496
|
<% if attr? :attribution %>
|
430
|
-
<%= attr
|
497
|
+
<%= (attr :attribution) %>
|
431
498
|
<% end %>
|
432
499
|
#{tag 'citetitle', :citetitle}
|
433
500
|
</attribution>
|
434
501
|
<% end %>
|
435
|
-
|
436
|
-
<simpara><%= content %></simpara>
|
437
|
-
<% else %>
|
438
|
-
<%= content %>
|
439
|
-
<% end %>
|
502
|
+
#{content_erb}
|
440
503
|
</blockquote>
|
441
504
|
EOF
|
442
505
|
end
|
@@ -445,12 +508,11 @@ end
|
|
445
508
|
class BlockVerseTemplate < BaseTemplate
|
446
509
|
def template
|
447
510
|
@template ||= @eruby.new <<-EOF
|
448
|
-
<%#encoding:UTF-8%><blockquote#{common_attrs_erb}
|
449
|
-
#{title_tag}
|
511
|
+
<%#encoding:UTF-8%><blockquote#{common_attrs_erb}>#{title_tag}
|
450
512
|
<% if (attr? :attribution) || (attr? :citetitle) %>
|
451
513
|
<attribution>
|
452
514
|
<% if attr? :attribution %>
|
453
|
-
<%= attr
|
515
|
+
<%= (attr :attribution) %>
|
454
516
|
<% end %>
|
455
517
|
#{tag 'citetitle', :citetitle}
|
456
518
|
</attribution>
|
@@ -470,9 +532,8 @@ end
|
|
470
532
|
class BlockTableTemplate < BaseTemplate
|
471
533
|
def template
|
472
534
|
@template ||= @eruby.new <<-EOS
|
473
|
-
<%#encoding:UTF-8%><<%= title? ? 'table' : 'informaltable'%>#{common_attrs_erb} frame="<%= attr :frame, 'all'%>"
|
474
|
-
rowsep="<%= ['none', 'cols'].include?(attr :grid) ? 0 : 1 %>" colsep="<%= ['none', 'rows'].include?(attr :grid) ? 0 : 1 %>"
|
475
|
-
#{title_tag}
|
535
|
+
<%#encoding:UTF-8%><<%= (tag_name = title? ? 'table' : 'informaltable') %>#{common_attrs_erb} frame="<%= attr :frame, 'all'%>"
|
536
|
+
rowsep="<%= ['none', 'cols'].include?(attr :grid) ? 0 : 1 %>" colsep="<%= ['none', 'rows'].include?(attr :grid) ? 0 : 1 %>">#{title_tag}
|
476
537
|
<% if attr? :width %>
|
477
538
|
<?dbhtml table-width="<%= attr :width %>"?>
|
478
539
|
<?dbfo table-width="<%= attr :width %>"?>
|
@@ -480,7 +541,7 @@ class BlockTableTemplate < BaseTemplate
|
|
480
541
|
<% end %>
|
481
542
|
<tgroup cols="<%= attr :colcount %>">
|
482
543
|
<% @columns.each do |col| %>
|
483
|
-
<colspec colname="col_<%= col.attr :colnumber %>" colwidth="<%= col.attr(
|
544
|
+
<colspec colname="col_<%= col.attr :colnumber %>" colwidth="<%= (col.attr (attr? :width) ? :colabswidth : :colpcwidth) %>*"/>
|
484
545
|
<% end %>
|
485
546
|
<% [:head, :foot, :body].select {|tblsec| !rows[tblsec].empty? }.each do |tblsec| %>
|
486
547
|
<t<%= tblsec %>>
|
@@ -490,22 +551,23 @@ class BlockTableTemplate < BaseTemplate
|
|
490
551
|
<entry#{attribute('align', 'cell.attr :halign')}#{attribute('valign', 'cell.attr :valign')}<%
|
491
552
|
if cell.colspan %> namest="col_<%= cell.column.attr :colnumber %>" nameend="col_<%= (cell.column.attr :colnumber) + cell.colspan - 1 %>"<%
|
492
553
|
end %><% if cell.rowspan %> morerows="<%= cell.rowspan - 1 %>"<% end %>><%
|
493
|
-
|
554
|
+
cell_content = ''
|
555
|
+
if tblsec == :head %><% cell_content = cell.text %><%
|
494
556
|
else %><%
|
495
|
-
case cell.attr
|
496
|
-
when :asciidoc
|
497
|
-
when :verse
|
498
|
-
when :literal
|
499
|
-
when :header %><% cell.content.each do |text|
|
500
|
-
else %><% cell.content.each do |text|
|
501
|
-
%><% end %><% end %></entry>
|
557
|
+
case (cell.attr :style)
|
558
|
+
when :asciidoc %><% cell_content = cell.content %><%
|
559
|
+
when :verse %><% cell_content = %(<literallayout>\#{template.preserve_endlines(cell.text, self)}</literallayout>) %><%
|
560
|
+
when :literal %><% cell_content = %(<literallayout class="monospaced">\#{template.preserve_endlines(cell.text, self)}</literallayout>) %><%
|
561
|
+
when :header %><% cell.content.each do |text| %><% cell_content = %(\#{cell_content\}<simpara><emphasis role="strong">\#{text}</emphasis></simpara>) %><% end %><%
|
562
|
+
else %><% cell.content.each do |text| %><% cell_content = %(\#{cell_content}<simpara>\#{text}</simpara>) %><% end %><%
|
563
|
+
%><% end %><% end %><%= (@document.attr? 'cellbgcolor') ? %(<?dbfo bgcolor="\#{@document.attr 'cellbgcolor'}"?>) : nil %><%= cell_content %></entry>
|
502
564
|
<% end %>
|
503
565
|
</row>
|
504
566
|
<% end %>
|
505
567
|
</t<%= tblsec %>>
|
506
568
|
<% end %>
|
507
569
|
</tgroup>
|
508
|
-
</<%=
|
570
|
+
</<%= tag_name %>>
|
509
571
|
EOS
|
510
572
|
end
|
511
573
|
end
|
@@ -513,8 +575,7 @@ end
|
|
513
575
|
class BlockImageTemplate < BaseTemplate
|
514
576
|
def template
|
515
577
|
@template ||= @eruby.new <<-EOF
|
516
|
-
<%#encoding:UTF-8%><%#encoding:UTF-8%><figure#{common_attrs_erb}
|
517
|
-
#{title_tag}
|
578
|
+
<%#encoding:UTF-8%><%#encoding:UTF-8%><figure#{common_attrs_erb}>#{title_tag}
|
518
579
|
<mediaobject>
|
519
580
|
<imageobject>
|
520
581
|
<imagedata fileref="<%= image_uri(attr :target) %>"#{attribute('contentwidth', :width)}#{attribute('contentdepth', :height)}/>
|
@@ -581,7 +642,54 @@ class InlineQuotedTemplate < BaseTemplate
|
|
581
642
|
end
|
582
643
|
|
583
644
|
def result(node)
|
584
|
-
quote_text(node.text, node.type, node.attr
|
645
|
+
quote_text(node.text, node.type, (node.attr 'role'))
|
646
|
+
end
|
647
|
+
|
648
|
+
def template
|
649
|
+
:invoke_result
|
650
|
+
end
|
651
|
+
end
|
652
|
+
|
653
|
+
class InlineButtonTemplate < BaseTemplate
|
654
|
+
def result(node)
|
655
|
+
%(<guibutton>#{node.text}</guibutton>)
|
656
|
+
end
|
657
|
+
|
658
|
+
def template
|
659
|
+
:invoke_result
|
660
|
+
end
|
661
|
+
end
|
662
|
+
|
663
|
+
class InlineKbdTemplate < BaseTemplate
|
664
|
+
def result(node)
|
665
|
+
keys = node.attr 'keys'
|
666
|
+
if keys.size == 1
|
667
|
+
%(<keycap>#{keys.first}</keycap>)
|
668
|
+
else
|
669
|
+
key_combo = keys.map{|key| %(<keycap>#{key}</keycap>) }.join
|
670
|
+
%(<keycombo>#{key_combo}</keycombo>)
|
671
|
+
end
|
672
|
+
end
|
673
|
+
|
674
|
+
def template
|
675
|
+
:invoke_result
|
676
|
+
end
|
677
|
+
end
|
678
|
+
|
679
|
+
class InlineMenuTemplate < BaseTemplate
|
680
|
+
def menu(menu, submenus, menuitem)
|
681
|
+
if !submenus.empty?
|
682
|
+
submenu_path = submenus.map{|submenu| %(<guisubmenu>#{submenu}</guisubmenu> ) }.join.chop
|
683
|
+
%(<menuchoice><guimenu>#{menu}</guimenu> #{submenu_path} <guimenuitem>#{menuitem}</guimenuitem></menuchoice>)
|
684
|
+
elsif !menuitem.nil?
|
685
|
+
%(<menuchoice><guimenu>#{menu}</guimenu> <guimenuitem>#{menuitem}</guimenuitem></menuchoice>)
|
686
|
+
else
|
687
|
+
%(<guimenu>#{menu}</guimenu>)
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
def result(node)
|
692
|
+
menu(node.attr('menu'), node.attr('submenus'), node.attr('menuitem'))
|
585
693
|
end
|
586
694
|
|
587
695
|
def template
|