asciidoctor 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +86 -11
- data/LICENSE +1 -1
- data/README-de.adoc +9 -12
- data/README-fr.adoc +9 -12
- data/README-jp.adoc +10 -13
- data/README-zh_CN.adoc +9 -12
- data/README.adoc +33 -18
- data/asciidoctor.gemspec +2 -9
- data/data/locale/attributes-fr.adoc +2 -2
- data/data/locale/attributes-th.adoc +23 -0
- data/data/locale/attributes-vi.adoc +23 -0
- data/data/stylesheets/asciidoctor-default.css +54 -53
- data/data/stylesheets/coderay-asciidoctor.css +9 -9
- data/lib/asciidoctor/abstract_block.rb +11 -9
- data/lib/asciidoctor/abstract_node.rb +9 -8
- data/lib/asciidoctor/block.rb +6 -6
- data/lib/asciidoctor/cli/invoker.rb +1 -2
- data/lib/asciidoctor/cli/options.rb +25 -25
- data/lib/asciidoctor/convert.rb +1 -0
- data/lib/asciidoctor/converter/docbook5.rb +20 -22
- data/lib/asciidoctor/converter/html5.rb +112 -94
- data/lib/asciidoctor/converter/manpage.rb +61 -52
- data/lib/asciidoctor/converter/template.rb +12 -13
- data/lib/asciidoctor/converter.rb +6 -4
- data/lib/asciidoctor/core_ext/hash/merge.rb +1 -1
- data/lib/asciidoctor/document.rb +39 -41
- data/lib/asciidoctor/extensions.rb +20 -12
- data/lib/asciidoctor/list.rb +2 -6
- data/lib/asciidoctor/load.rb +10 -9
- data/lib/asciidoctor/logging.rb +10 -8
- data/lib/asciidoctor/parser.rb +172 -189
- data/lib/asciidoctor/path_resolver.rb +3 -3
- data/lib/asciidoctor/reader.rb +71 -72
- data/lib/asciidoctor/rx.rb +3 -2
- data/lib/asciidoctor/section.rb +7 -0
- data/lib/asciidoctor/substitutors.rb +101 -103
- data/lib/asciidoctor/syntax_highlighter/coderay.rb +2 -1
- data/lib/asciidoctor/syntax_highlighter/highlightjs.rb +1 -1
- data/lib/asciidoctor/syntax_highlighter/pygments.rb +14 -5
- data/lib/asciidoctor/syntax_highlighter/rouge.rb +2 -1
- data/lib/asciidoctor/syntax_highlighter.rb +8 -11
- data/lib/asciidoctor/table.rb +18 -20
- data/lib/asciidoctor/timings.rb +3 -3
- data/lib/asciidoctor/version.rb +1 -1
- data/lib/asciidoctor.rb +7 -7
- data/man/asciidoctor.1 +26 -28
- data/man/asciidoctor.adoc +33 -27
- metadata +8 -62
@@ -11,7 +11,7 @@ class AbstractBlock < AbstractNode
|
|
11
11
|
# * :compound - this block contains other blocks
|
12
12
|
# * :simple - this block holds a paragraph of prose that receives normal substitutions
|
13
13
|
# * :verbatim - this block holds verbatim text (displayed "as is") that receives verbatim substitutions
|
14
|
-
# * :raw - this block holds unprocessed content passed directly to the output with no
|
14
|
+
# * :raw - this block holds unprocessed content passed directly to the output with no substitutions applied
|
15
15
|
# * :empty - this block has no content
|
16
16
|
attr_accessor :content_model
|
17
17
|
|
@@ -90,7 +90,7 @@ class AbstractBlock < AbstractNode
|
|
90
90
|
#
|
91
91
|
# context - the context Symbol context to assign to this block
|
92
92
|
#
|
93
|
-
# Returns the
|
93
|
+
# Returns the specified Symbol context
|
94
94
|
def context= context
|
95
95
|
@node_name = (@context = context).to_s
|
96
96
|
end
|
@@ -129,11 +129,13 @@ class AbstractBlock < AbstractNode
|
|
129
129
|
|
130
130
|
# Public: Check whether this block has any child Section objects.
|
131
131
|
#
|
132
|
-
#
|
132
|
+
# Acts an an abstract method that always returns false unless this block is an
|
133
|
+
# instance of Document or Section.
|
134
|
+
# Both Document and Section provide overrides for this method.
|
133
135
|
#
|
134
|
-
# Returns
|
136
|
+
# Returns false
|
135
137
|
def sections?
|
136
|
-
|
138
|
+
false
|
137
139
|
end
|
138
140
|
|
139
141
|
# Deprecated: Legacy property to get the String or Integer numeral of this section.
|
@@ -269,7 +271,7 @@ class AbstractBlock < AbstractNode
|
|
269
271
|
ORDERED_LIST_KEYWORDS[list_type || @style]
|
270
272
|
end
|
271
273
|
|
272
|
-
# Public: Get the String title of this Block with title
|
274
|
+
# Public: Get the String title of this Block with title substitutions applied
|
273
275
|
#
|
274
276
|
# The following substitutions are applied to block and section titles:
|
275
277
|
#
|
@@ -296,7 +298,7 @@ class AbstractBlock < AbstractNode
|
|
296
298
|
|
297
299
|
# Public: Set the String block title.
|
298
300
|
#
|
299
|
-
# Returns the
|
301
|
+
# Returns the specified String title
|
300
302
|
def title= val
|
301
303
|
@converted_title = nil
|
302
304
|
@title = val
|
@@ -480,7 +482,7 @@ class AbstractBlock < AbstractNode
|
|
480
482
|
@header.find_by_internal selector, result, &block
|
481
483
|
end
|
482
484
|
@blocks.each do |b|
|
483
|
-
next if
|
485
|
+
next if context_selector == :section && b.context != :section # optimization
|
484
486
|
b.find_by_internal selector, result, &block
|
485
487
|
end
|
486
488
|
end
|
@@ -505,7 +507,7 @@ class AbstractBlock < AbstractNode
|
|
505
507
|
end
|
506
508
|
else
|
507
509
|
@blocks.each do |b|
|
508
|
-
next if
|
510
|
+
next if context_selector == :section && b.context != :section # optimization
|
509
511
|
b.find_by_internal selector, result, &block
|
510
512
|
end
|
511
513
|
end
|
@@ -4,7 +4,8 @@ module Asciidoctor
|
|
4
4
|
# node of AsciiDoc content. The state and methods on this class are common to
|
5
5
|
# all content segments in an AsciiDoc document.
|
6
6
|
class AbstractNode
|
7
|
-
include
|
7
|
+
include Logging
|
8
|
+
include Substitutors
|
8
9
|
|
9
10
|
# Public: Get the Hash of attributes for this node
|
10
11
|
attr_reader :attributes
|
@@ -65,7 +66,7 @@ class AbstractNode
|
|
65
66
|
#
|
66
67
|
# parent - The Block to set as the parent of this Block
|
67
68
|
#
|
68
|
-
# Returns the
|
69
|
+
# Returns the the specified Block parent
|
69
70
|
def parent= parent
|
70
71
|
@parent, @document = parent, parent.document
|
71
72
|
end
|
@@ -155,7 +156,7 @@ class AbstractNode
|
|
155
156
|
#
|
156
157
|
# name - the String name of the option
|
157
158
|
#
|
158
|
-
# Returns
|
159
|
+
# Returns nothing
|
159
160
|
def set_option name
|
160
161
|
@attributes[%(#{name}-option)] = ''
|
161
162
|
nil
|
@@ -220,7 +221,7 @@ class AbstractNode
|
|
220
221
|
#
|
221
222
|
# names - A single role name, a space-separated String of role names, or an Array of role names
|
222
223
|
#
|
223
|
-
# Returns the
|
224
|
+
# Returns the specified String role name or Array of role names
|
224
225
|
def role= names
|
225
226
|
@attributes['role'] = (::Array === names) ? (names.join ' ') : names
|
226
227
|
end
|
@@ -462,8 +463,8 @@ class AbstractNode
|
|
462
463
|
start = doc.base_dir
|
463
464
|
end
|
464
465
|
else
|
465
|
-
start
|
466
|
-
jail
|
466
|
+
start ||= doc.base_dir
|
467
|
+
jail ||= doc.base_dir
|
467
468
|
end
|
468
469
|
doc.path_resolver.system_path target, start, jail, opts
|
469
470
|
end
|
@@ -542,8 +543,8 @@ class AbstractNode
|
|
542
543
|
rescue
|
543
544
|
logger.warn %(could not retrieve contents of #{opts[:label] || 'asset'} at URI: #{target}) if opts.fetch :warn_on_failure, true
|
544
545
|
end
|
545
|
-
|
546
|
-
logger.warn %(cannot retrieve contents of #{opts[:label] || 'asset'} at URI: #{target} (allow-uri-read attribute not enabled))
|
546
|
+
elsif opts.fetch :warn_on_failure, true
|
547
|
+
logger.warn %(cannot retrieve contents of #{opts[:label] || 'asset'} at URI: #{target} (allow-uri-read attribute not enabled))
|
547
548
|
end
|
548
549
|
else
|
549
550
|
target = normalize_system_path target, opts[:start], nil, target_name: (opts[:label] || 'asset')
|
data/lib/asciidoctor/block.rb
CHANGED
@@ -54,21 +54,21 @@ class Block < AbstractBlock
|
|
54
54
|
# FIXME feels funky; we have to be defensive to get commit_subs to honor override
|
55
55
|
# FIXME does not resolve substitution groups inside Array (e.g., [:normal])
|
56
56
|
if (subs = opts[:subs])
|
57
|
-
|
57
|
+
case subs
|
58
|
+
# e.g., subs: :default
|
58
59
|
# subs attribute is honored; falls back to opts[:default_subs], then built-in defaults based on context
|
59
|
-
|
60
|
+
when :default
|
60
61
|
@default_subs = opts[:default_subs]
|
61
62
|
# e.g., subs: [:quotes]
|
62
63
|
# subs attribute is not honored
|
63
|
-
|
64
|
+
when ::Array
|
64
65
|
@default_subs = subs.drop 0
|
65
66
|
@attributes.delete 'subs'
|
66
67
|
# e.g., subs: :normal or subs: 'normal'
|
67
68
|
# subs attribute is not honored
|
68
69
|
else
|
69
70
|
@default_subs = nil
|
70
|
-
|
71
|
-
@attributes['subs'] = %(#{subs})
|
71
|
+
@attributes['subs'] = subs.to_s
|
72
72
|
end
|
73
73
|
# resolve the subs eagerly only if subs option is specified
|
74
74
|
# QUESTION should we skip subsequent calls to commit_subs?
|
@@ -123,7 +123,7 @@ class Block < AbstractBlock
|
|
123
123
|
result.join LF
|
124
124
|
end
|
125
125
|
else
|
126
|
-
logger.warn %(Unknown content model '#{@content_model}' for block: #{
|
126
|
+
logger.warn %(Unknown content model '#{@content_model}' for block: #{self}) unless @content_model == :empty
|
127
127
|
nil
|
128
128
|
end
|
129
129
|
end
|
@@ -88,7 +88,6 @@ module Asciidoctor
|
|
88
88
|
end
|
89
89
|
|
90
90
|
if outfile == '-'
|
91
|
-
# NOTE set_encoding returns nil on JRuby 9.1
|
92
91
|
(tofile = @out) || ((tofile = $stdout).set_encoding UTF_8)
|
93
92
|
elsif outfile
|
94
93
|
opts[:mkdirs] = true
|
@@ -143,7 +142,7 @@ module Asciidoctor
|
|
143
142
|
raise e
|
144
143
|
else
|
145
144
|
err.puts ::RuntimeError === e ? %(#{e.message} (#{e.class})) : e.message
|
146
|
-
err.puts ' Use --trace
|
145
|
+
err.puts ' Use --trace to show backtrace'
|
147
146
|
end
|
148
147
|
end
|
149
148
|
nil
|
@@ -47,12 +47,12 @@ module Asciidoctor
|
|
47
47
|
EOS
|
48
48
|
|
49
49
|
opts.on('-b', '--backend BACKEND', 'set backend output format: [html5, xhtml5, docbook5, manpage] (default: html5)',
|
50
|
-
|
50
|
+
'additional backends are supported via extended converters (e.g., pdf, epub3)') do |backend|
|
51
51
|
self[:attributes]['backend'] = backend
|
52
52
|
end
|
53
53
|
opts.on('-d', '--doctype DOCTYPE', ['article', 'book', 'manpage', 'inline'],
|
54
|
-
|
55
|
-
self[:attributes]['doctype'] =
|
54
|
+
'document type to use when converting document: [article, book, manpage, inline] (default: article)') do |doctype|
|
55
|
+
self[:attributes]['doctype'] = doctype
|
56
56
|
end
|
57
57
|
opts.on('-e', '--embedded', 'suppress enclosing document structure and output an embedded document (default: false)') do
|
58
58
|
self[:standalone] = false
|
@@ -61,14 +61,14 @@ module Asciidoctor
|
|
61
61
|
self[:output_file] = output_file
|
62
62
|
end
|
63
63
|
opts.on('--safe',
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
'set safe mode level to safe (default: unsafe)',
|
65
|
+
'enables include directives, but prevents access to ancestor paths of source file',
|
66
|
+
'provided for compatibility with the asciidoc command') do
|
67
67
|
self[:safe] = SafeMode::SAFE
|
68
68
|
end
|
69
69
|
opts.on('-S', '--safe-mode SAFE_MODE', (safe_mode_names = SafeMode.names),
|
70
|
-
|
71
|
-
|
70
|
+
%(set safe mode level explicitly: [#{safe_mode_names.join ', '}] (default: unsafe)),
|
71
|
+
'disables potentially dangerous macros in source files, such as include::[]') do |name|
|
72
72
|
self[:safe] = SafeMode.value_for_name name
|
73
73
|
end
|
74
74
|
opts.on('-s', '--no-header-footer', 'suppress enclosing document structure and output an embedded document (default: false)') do
|
@@ -78,19 +78,19 @@ module Asciidoctor
|
|
78
78
|
self[:attributes]['sectnums'] = ''
|
79
79
|
end
|
80
80
|
opts.on('--eruby ERUBY', ['erb', 'erubi', 'erubis'],
|
81
|
-
|
81
|
+
'specify eRuby implementation to use when rendering custom ERB templates: [erb, erubi, erubis] (default: erb)') do |eruby|
|
82
82
|
self[:eruby] = eruby
|
83
83
|
end
|
84
84
|
opts.on('-a', '--attribute name[=value]', 'a document attribute to set in the form of name, name!, or name=value pair',
|
85
|
-
|
86
|
-
|
85
|
+
'this attribute takes precedence over the same attribute defined in the source document',
|
86
|
+
'unless either the name or value ends in @ (i.e., name@=value or name=value@)') do |attr|
|
87
87
|
next if (attr = attr.rstrip).empty? || attr == '='
|
88
88
|
attr = attr.encode UTF_8 unless attr.encoding == UTF_8
|
89
89
|
name, _, val = attr.partition '='
|
90
90
|
self[:attributes][name] = val
|
91
91
|
end
|
92
92
|
opts.on('-T', '--template-dir DIR', 'a directory containing custom converter templates that override the built-in converter (requires tilt gem)',
|
93
|
-
|
93
|
+
'may be specified multiple times') do |template_dir|
|
94
94
|
if self[:template_dirs].nil?
|
95
95
|
self[:template_dirs] = [template_dir]
|
96
96
|
elsif ::Array === self[:template_dirs]
|
@@ -119,23 +119,23 @@ module Asciidoctor
|
|
119
119
|
'may be specified more than once') do |path|
|
120
120
|
(self[:requires] ||= []).concat(path.split ',')
|
121
121
|
end
|
122
|
-
opts.on('--failure-level LEVEL', %w(warning WARNING error ERROR
|
122
|
+
opts.on('--failure-level LEVEL', %w(info INFO warning WARNING error ERROR fatal FATAL), 'set minimum log level that yields a non-zero exit code: [INFO, WARN, ERROR, FATAL] (default: FATAL)') do |level|
|
123
123
|
level = 'WARN' if (level = level.upcase) == 'WARNING'
|
124
|
-
self[:failure_level] = ::Logger::Severity.const_get level
|
124
|
+
self[:failure_level] = ::Logger::Severity.const_get level
|
125
125
|
end
|
126
|
-
opts.on('-q', '--quiet', 'silence application log messages and script warnings (default: false)') do
|
126
|
+
opts.on('-q', '--quiet', 'silence application log messages and script warnings (default: false)') do
|
127
127
|
self[:verbose] = 0
|
128
128
|
end
|
129
|
-
opts.on('--trace', 'include backtrace information when reporting errors (default: false)') do
|
129
|
+
opts.on('--trace', 'include backtrace information when reporting errors (default: false)') do
|
130
130
|
self[:trace] = true
|
131
131
|
end
|
132
|
-
opts.on('-v', '--verbose', 'directs application messages logged at DEBUG or INFO level to STDERR (default: false)') do
|
132
|
+
opts.on('-v', '--verbose', 'directs application messages logged at DEBUG or INFO level to STDERR (default: false)') do
|
133
133
|
self[:verbose] = 2
|
134
134
|
end
|
135
|
-
opts.on('-w', '--warnings', 'turn on script warnings (default: false)') do
|
135
|
+
opts.on('-w', '--warnings', 'turn on script warnings (default: false)') do
|
136
136
|
self[:warnings] = true
|
137
137
|
end
|
138
|
-
opts.on('-t', '--timings', 'print timings report (default: false)') do
|
138
|
+
opts.on('-t', '--timings', 'print timings report (default: false)') do
|
139
139
|
self[:timings] = true
|
140
140
|
end
|
141
141
|
opts.on_tail('-h', '--help [TOPIC]', 'print a help message',
|
@@ -161,7 +161,7 @@ module Asciidoctor
|
|
161
161
|
elsif ::File.exist? (manpage_path = (::File.join ROOT_DIR, 'man', 'asciidoctor.1'))
|
162
162
|
$stdout.puts ::File.read manpage_path
|
163
163
|
else
|
164
|
-
manpage_path =
|
164
|
+
manpage_path = %x(man -w asciidoctor).chop rescue ''
|
165
165
|
if manpage_path.empty?
|
166
166
|
$stderr.puts 'asciidoctor: FAILED: manual page not found; try `man asciidoctor`'
|
167
167
|
return 1
|
@@ -249,7 +249,7 @@ module Asciidoctor
|
|
249
249
|
|
250
250
|
self[:input_files] = infiles
|
251
251
|
|
252
|
-
|
252
|
+
delete :attributes if self[:attributes].empty?
|
253
253
|
|
254
254
|
if self[:template_dirs]
|
255
255
|
begin
|
@@ -258,7 +258,7 @@ module Asciidoctor
|
|
258
258
|
raise $! if self[:trace]
|
259
259
|
$stderr.puts 'asciidoctor: FAILED: \'tilt\' could not be loaded'
|
260
260
|
$stderr.puts ' You must have the tilt gem installed (gem install tilt) to use custom backend templates'
|
261
|
-
$stderr.puts ' Use --trace
|
261
|
+
$stderr.puts ' Use --trace to show backtrace'
|
262
262
|
return 1
|
263
263
|
rescue ::SystemExit
|
264
264
|
# not permitted here
|
@@ -278,7 +278,7 @@ module Asciidoctor
|
|
278
278
|
rescue ::LoadError
|
279
279
|
raise $! if self[:trace]
|
280
280
|
$stderr.puts %(asciidoctor: FAILED: '#{path}' could not be loaded)
|
281
|
-
$stderr.puts ' Use --trace
|
281
|
+
$stderr.puts ' Use --trace to show backtrace'
|
282
282
|
return 1
|
283
283
|
rescue ::SystemExit
|
284
284
|
# not permitted here
|
@@ -290,11 +290,11 @@ module Asciidoctor
|
|
290
290
|
rescue ::OptionParser::MissingArgument
|
291
291
|
$stderr.puts %(asciidoctor: option #{$!.message})
|
292
292
|
$stdout.puts opts_parser
|
293
|
-
|
293
|
+
1
|
294
294
|
rescue ::OptionParser::InvalidOption, ::OptionParser::InvalidArgument
|
295
295
|
$stderr.puts %(asciidoctor: #{$!.message})
|
296
296
|
$stdout.puts opts_parser
|
297
|
-
|
297
|
+
1
|
298
298
|
ensure
|
299
299
|
$VERBOSE = old_verbose
|
300
300
|
end
|
data/lib/asciidoctor/convert.rb
CHANGED
@@ -7,9 +7,9 @@ class Converter::DocBook5Converter < Converter::Base
|
|
7
7
|
|
8
8
|
# default represents variablelist
|
9
9
|
(DLIST_TAGS = {
|
10
|
-
'qanda' => { list:
|
11
|
-
'glossary' => { list:
|
12
|
-
}).default = { list:
|
10
|
+
'qanda' => { list: 'qandaset', entry: 'qandaentry', label: 'question', term: 'simpara', item: 'answer' },
|
11
|
+
'glossary' => { list: nil, entry: 'glossentry', term: 'glossterm', item: 'glossdef' },
|
12
|
+
}).default = { list: 'variablelist', entry: 'varlistentry', term: 'term', item: 'listitem' }
|
13
13
|
|
14
14
|
(QUOTE_TAGS = {
|
15
15
|
monospaced: ['<literal>', '</literal>'],
|
@@ -25,7 +25,7 @@ class Converter::DocBook5Converter < Converter::Base
|
|
25
25
|
MANPAGE_SECTION_TAGS = { 'section' => 'refsection', 'synopsis' => 'refsynopsisdiv' }
|
26
26
|
TABLE_PI_NAMES = ['dbhtml', 'dbfo', 'dblatex']
|
27
27
|
|
28
|
-
CopyrightRx = /^(#{CC_ANY}+?)(?: ((?:\d{4}
|
28
|
+
CopyrightRx = /^(#{CC_ANY}+?)(?: ((?:\d{4}-)?\d{4}))?$/
|
29
29
|
ImageMacroRx = /^image::?(\S|\S#{CC_ANY}*?\S)\[(#{CC_ANY}+)?\]$/
|
30
30
|
|
31
31
|
def initialize backend, opts = {}
|
@@ -302,13 +302,13 @@ class Converter::DocBook5Converter < Converter::Base
|
|
302
302
|
</abstract>)
|
303
303
|
end
|
304
304
|
when 'partintro'
|
305
|
-
|
306
|
-
logger.error 'partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content.'
|
307
|
-
''
|
308
|
-
else
|
305
|
+
if node.level == 0 && node.parent.context == :section && node.document.doctype == 'book'
|
309
306
|
%(<partintro#{common_attributes node.id, node.role, node.reftext}>
|
310
307
|
#{title_tag node}#{enclose_content node}
|
311
308
|
</partintro>)
|
309
|
+
else
|
310
|
+
logger.error 'partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content.'
|
311
|
+
''
|
312
312
|
end
|
313
313
|
else
|
314
314
|
reftext = node.reftext if (id = node.id)
|
@@ -378,19 +378,19 @@ class Converter::DocBook5Converter < Converter::Base
|
|
378
378
|
frame = 'topbot' if (frame = node.attr 'frame', 'all', 'table-frame') == 'ends'
|
379
379
|
grid = node.attr 'grid', nil, 'table-grid'
|
380
380
|
result << %(<#{tag_name = node.title? ? 'table' : 'informaltable'}#{common_attributes node.id, node.role, node.reftext}#{pgwide_attribute} frame="#{frame}" rowsep="#{['none', 'cols'].include?(grid) ? 0 : 1}" colsep="#{['none', 'rows'].include?(grid) ? 0 : 1}"#{(node.attr? 'orientation', 'landscape', 'table-orientation') ? ' orient="land"' : ''}>)
|
381
|
-
if
|
381
|
+
if node.option? 'unbreakable'
|
382
382
|
result << '<?dbfo keep-together="always"?>'
|
383
|
-
elsif
|
383
|
+
elsif node.option? 'breakable'
|
384
384
|
result << '<?dbfo keep-together="auto"?>'
|
385
385
|
end
|
386
386
|
result << %(<title>#{node.title}</title>) if tag_name == 'table'
|
387
|
-
|
387
|
+
if (width = (node.attr? 'width') ? (node.attr 'width') : nil)
|
388
388
|
TABLE_PI_NAMES.each do |pi_name|
|
389
389
|
result << %(<?#{pi_name} table-width="#{width}"?>)
|
390
390
|
end
|
391
|
-
'colabswidth'
|
391
|
+
col_width_key = 'colabswidth'
|
392
392
|
else
|
393
|
-
'colpcwidth'
|
393
|
+
col_width_key = 'colpcwidth'
|
394
394
|
end
|
395
395
|
result << %(<tgroup cols="#{node.attr 'colcount'}">)
|
396
396
|
node.columns.each do |col|
|
@@ -543,9 +543,8 @@ class Converter::DocBook5Converter < Converter::Base
|
|
543
543
|
%(<indexterm>
|
544
544
|
<primary>#{node.text}</primary>#{rel}
|
545
545
|
</indexterm>#{node.text})
|
546
|
-
|
547
|
-
|
548
|
-
%(<indexterm>
|
546
|
+
elsif (numterms = (terms = node.attr 'terms').size) > 2
|
547
|
+
%(<indexterm>
|
549
548
|
<primary>#{terms[0]}</primary><secondary>#{terms[1]}</secondary><tertiary>#{terms[2]}</tertiary>#{rel}
|
550
549
|
</indexterm>#{(node.document.option? 'indexterm-promotion') ? %[
|
551
550
|
<indexterm>
|
@@ -554,18 +553,17 @@ class Converter::DocBook5Converter < Converter::Base
|
|
554
553
|
<indexterm>
|
555
554
|
<primary>#{terms[2]}</primary>
|
556
555
|
</indexterm>] : ''})
|
557
|
-
|
558
|
-
|
556
|
+
elsif numterms > 1
|
557
|
+
%(<indexterm>
|
559
558
|
<primary>#{terms[0]}</primary><secondary>#{terms[1]}</secondary>#{rel}
|
560
|
-
</indexterm>#{(node.document.option?
|
559
|
+
</indexterm>#{(node.document.option? 'indexterm-promotion') ? %[
|
561
560
|
<indexterm>
|
562
561
|
<primary>#{terms[1]}</primary>
|
563
562
|
</indexterm>] : ''})
|
564
|
-
|
565
|
-
|
563
|
+
else
|
564
|
+
%(<indexterm>
|
566
565
|
<primary>#{terms[0]}</primary>#{rel}
|
567
566
|
</indexterm>)
|
568
|
-
end
|
569
567
|
end
|
570
568
|
end
|
571
569
|
|