asciidoctor 2.0.15 → 2.0.16
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 +38 -2
- data/LICENSE +1 -1
- data/README-de.adoc +3 -3
- data/README-fr.adoc +3 -3
- data/README-jp.adoc +3 -3
- data/README-zh_CN.adoc +3 -3
- data/README.adoc +2 -2
- data/asciidoctor.gemspec +1 -8
- data/data/locale/attributes-th.adoc +23 -0
- data/data/locale/attributes-vi.adoc +23 -0
- data/data/stylesheets/asciidoctor-default.css +50 -48
- data/lib/asciidoctor.rb +7 -7
- data/lib/asciidoctor/abstract_block.rb +4 -4
- data/lib/asciidoctor/abstract_node.rb +9 -8
- data/lib/asciidoctor/block.rb +6 -6
- data/lib/asciidoctor/cli/invoker.rb +0 -1
- data/lib/asciidoctor/cli/options.rb +22 -22
- data/lib/asciidoctor/convert.rb +1 -0
- data/lib/asciidoctor/converter.rb +5 -3
- data/lib/asciidoctor/converter/docbook5.rb +20 -22
- data/lib/asciidoctor/converter/html5.rb +70 -60
- data/lib/asciidoctor/converter/manpage.rb +61 -52
- data/lib/asciidoctor/converter/template.rb +11 -12
- data/lib/asciidoctor/document.rb +22 -37
- data/lib/asciidoctor/extensions.rb +10 -10
- 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 +122 -141
- data/lib/asciidoctor/path_resolver.rb +3 -3
- data/lib/asciidoctor/reader.rb +67 -68
- data/lib/asciidoctor/rx.rb +2 -1
- data/lib/asciidoctor/substitutors.rb +97 -99
- data/lib/asciidoctor/syntax_highlighter.rb +8 -11
- 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 +2 -1
- data/lib/asciidoctor/syntax_highlighter/rouge.rb +2 -1
- data/lib/asciidoctor/table.rb +17 -19
- data/lib/asciidoctor/timings.rb +3 -3
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +8 -9
- data/man/asciidoctor.adoc +7 -6
- metadata +7 -61
@@ -23,7 +23,7 @@ class Converter::ManPageConverter < Converter::Base
|
|
23
23
|
LeadingPeriodRx = /^\./
|
24
24
|
EscapedMacroRx = /^(?:#{ESC}\\c\n)?#{ESC}\.((?:URL|MTO) "#{CC_ANY}*?" "#{CC_ANY}*?" )( |[^\s]*)(#{CC_ANY}*?)(?: *#{ESC}\\c)?$/
|
25
25
|
MalformedEscapedMacroRx = /(#{ESC}\\c) (#{ESC}\.(?:URL|MTO) )/
|
26
|
-
MockMacroRx =
|
26
|
+
MockMacroRx = %r(</?(#{ESC}\\[^>]+)>)
|
27
27
|
EmDashCharRefRx = /—(?:​)?/
|
28
28
|
EllipsisCharRefRx = /…(?:​)?/
|
29
29
|
WrappedIndentRx = /#{CG_BLANK}*#{LF}#{CG_BLANK}*/
|
@@ -419,15 +419,7 @@ allbox tab(:);'
|
|
419
419
|
end
|
420
420
|
row_text[row_index] << %(T{#{LF}.sp#{LF})
|
421
421
|
cell_halign = (cell.attr 'halign', 'left').chr
|
422
|
-
if tsec == :
|
423
|
-
if row_header[row_index].empty? || row_header[row_index][cell_index].empty?
|
424
|
-
row_header[row_index][cell_index] << %(#{cell_halign}tB)
|
425
|
-
else
|
426
|
-
row_header[row_index][cell_index + 1] ||= []
|
427
|
-
row_header[row_index][cell_index + 1] << %(#{cell_halign}tB)
|
428
|
-
end
|
429
|
-
row_text[row_index] << %(#{manify cell.text, whitespace: :normalize}#{LF})
|
430
|
-
elsif tsec == :body
|
422
|
+
if tsec == :body
|
431
423
|
if row_header[row_index].empty? || row_header[row_index][cell_index].empty?
|
432
424
|
row_header[row_index][cell_index] << %(#{cell_halign}t)
|
433
425
|
else
|
@@ -443,7 +435,7 @@ allbox tab(:);'
|
|
443
435
|
cell_content = manify cell.content.join, whitespace: :normalize
|
444
436
|
end
|
445
437
|
row_text[row_index] << %(#{cell_content}#{LF})
|
446
|
-
|
438
|
+
else # tsec == :head || tsec == :foot
|
447
439
|
if row_header[row_index].empty? || row_header[row_index][cell_index].empty?
|
448
440
|
row_header[row_index][cell_index] << %(#{cell_halign}tB)
|
449
441
|
else
|
@@ -587,8 +579,16 @@ allbox tab(:);'
|
|
587
579
|
%(#{ESC_BS}c#{LF}#{ESC_FS}#{macro} "#{target}" "#{text}" )
|
588
580
|
when :xref
|
589
581
|
unless (text = node.text)
|
590
|
-
refid = node.attributes['refid']
|
591
|
-
|
582
|
+
if AbstractNode === (ref = (@refs ||= node.document.catalog[:refs])[refid = node.attributes['refid']] || (refid.nil_or_empty? ? (top = get_root_document node) : nil))
|
583
|
+
if (@resolving_xref ||= (outer = true)) && outer && (text = ref.xreftext node.attr 'xrefstyle', nil, true)
|
584
|
+
text = uppercase_pcdata text if ref.context === :section && ref.level < 2 && text == ref.title
|
585
|
+
else
|
586
|
+
text = top ? '[^top]' : %([#{refid}])
|
587
|
+
end
|
588
|
+
@resolving_xref = nil if outer
|
589
|
+
else
|
590
|
+
text = %([#{refid}])
|
591
|
+
end
|
592
592
|
end
|
593
593
|
text
|
594
594
|
when :ref, :bibref
|
@@ -664,13 +664,12 @@ allbox tab(:);'
|
|
664
664
|
end
|
665
665
|
|
666
666
|
def self.write_alternate_pages mannames, manvolnum, target
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
end
|
667
|
+
return unless mannames && mannames.size > 1
|
668
|
+
mannames.shift
|
669
|
+
manvolext = %(.#{manvolnum})
|
670
|
+
dir, basename = ::File.split target
|
671
|
+
mannames.each do |manname|
|
672
|
+
::File.write ::File.join(dir, %(#{manname}#{manvolext})), %(.so #{basename}), mode: FILE_WRITE_MODE
|
674
673
|
end
|
675
674
|
end
|
676
675
|
|
@@ -679,7 +678,7 @@ allbox tab(:);'
|
|
679
678
|
def append_footnotes result, node
|
680
679
|
if node.footnotes? && !(node.attr? 'nofootnotes')
|
681
680
|
result << '.SH "NOTES"'
|
682
|
-
node.footnotes.
|
681
|
+
node.footnotes.each do |fn|
|
683
682
|
result << %(.IP [#{fn.index}])
|
684
683
|
# NOTE restore newline in escaped macro that gets removed by normalize_text in substitutor
|
685
684
|
if (text = fn.text).include? %(#{ESC}\\c #{ESC}.)
|
@@ -713,37 +712,40 @@ allbox tab(:);'
|
|
713
712
|
else
|
714
713
|
str = str.tr_s WHITESPACE, ' '
|
715
714
|
end
|
716
|
-
str = str
|
717
|
-
gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' }
|
718
|
-
gsub(EllipsisCharRefRx, '...')
|
719
|
-
gsub(LeadingPeriodRx, '\\\&.')
|
720
|
-
# drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line
|
721
|
-
|
722
|
-
|
723
|
-
gsub('
|
724
|
-
gsub('&
|
725
|
-
gsub('
|
726
|
-
gsub('&#
|
727
|
-
gsub('&#
|
728
|
-
gsub('&#
|
729
|
-
gsub('&#
|
730
|
-
gsub('&#
|
731
|
-
gsub(
|
732
|
-
gsub('&#
|
733
|
-
gsub('&#
|
734
|
-
gsub(
|
735
|
-
gsub('&#
|
736
|
-
gsub('&#
|
737
|
-
gsub('&#
|
738
|
-
gsub('&#
|
739
|
-
gsub('&#
|
740
|
-
gsub('&#
|
741
|
-
gsub('
|
742
|
-
gsub('
|
743
|
-
gsub(
|
744
|
-
gsub(
|
745
|
-
gsub(
|
746
|
-
|
715
|
+
str = str
|
716
|
+
.gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' } # literal backslash (not a troff escape sequence)
|
717
|
+
.gsub(EllipsisCharRefRx, '...') # horizontal ellipsis
|
718
|
+
.gsub(LeadingPeriodRx, '\\\&.') # leading . is used in troff for macro call or other formatting; replace with \&.
|
719
|
+
.gsub(EscapedMacroRx) do # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line
|
720
|
+
(rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest})
|
721
|
+
end
|
722
|
+
.gsub('-', '\-')
|
723
|
+
.gsub('<', '<')
|
724
|
+
.gsub('>', '>')
|
725
|
+
.gsub('+', '+') # plus sign; alternately could use \c(pl
|
726
|
+
.gsub(' ', '\~') # non-breaking space
|
727
|
+
.gsub('©', '\(co') # copyright sign
|
728
|
+
.gsub('®', '\(rg') # registered sign
|
729
|
+
.gsub('™', '\(tm') # trademark sign
|
730
|
+
.gsub('°', '\(de') # degree sign
|
731
|
+
.gsub(' ', ' ') # thin space
|
732
|
+
.gsub('–', '\(en') # en dash
|
733
|
+
.gsub(EmDashCharRefRx, '\(em') # em dash
|
734
|
+
.gsub('‘', '\(oq') # left single quotation mark
|
735
|
+
.gsub('’', '\(cq') # right single quotation mark
|
736
|
+
.gsub('“', '\(lq') # left double quotation mark
|
737
|
+
.gsub('”', '\(rq') # right double quotation mark
|
738
|
+
.gsub('←', '\(<-') # leftwards arrow
|
739
|
+
.gsub('→', '\(->') # rightwards arrow
|
740
|
+
.gsub('⇐', '\(lA') # leftwards double arrow
|
741
|
+
.gsub('⇒', '\(rA') # rightwards double arrow
|
742
|
+
.gsub('​', '\:') # zero width space
|
743
|
+
.gsub('&', '&') # literal ampersand (NOTE must take place after any other replacement that includes &)
|
744
|
+
.gsub('\'', '\*(Aq') # apostrophe / neutral single quote
|
745
|
+
.gsub(MockMacroRx, '\1') # mock boundary
|
746
|
+
.gsub(ESC_BS, '\\') # unescape troff backslash (NOTE update if more escapes are added)
|
747
|
+
.gsub(ESC_FS, '.') # unescape full stop in troff commands (NOTE must take place after gsub(LeadingPeriodRx))
|
748
|
+
.rstrip # strip trailing space
|
747
749
|
opts[:append_newline] ? %(#{str}#{LF}) : str
|
748
750
|
end
|
749
751
|
|
@@ -754,5 +756,12 @@ allbox tab(:);'
|
|
754
756
|
def enclose_content node
|
755
757
|
node.content_model == :compound ? node.content : %(.sp#{LF}#{manify node.content, whitespace: :normalize})
|
756
758
|
end
|
759
|
+
|
760
|
+
def get_root_document node
|
761
|
+
while (node = node.document).nested?
|
762
|
+
node = node.parent_document
|
763
|
+
end
|
764
|
+
node
|
765
|
+
end
|
757
766
|
end
|
758
767
|
end
|
@@ -40,13 +40,13 @@ class Converter::TemplateConverter < Converter::Base
|
|
40
40
|
@caches = { scans: {}, templates: {} }
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
43
|
+
class << self
|
44
|
+
attr_reader :caches
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
def clear_caches
|
47
|
+
@caches[:scans].clear
|
48
|
+
@caches[:templates].clear
|
49
|
+
end
|
50
50
|
end
|
51
51
|
|
52
52
|
def initialize backend, template_dirs, opts = {}
|
@@ -134,12 +134,10 @@ class Converter::TemplateConverter < Converter::Base
|
|
134
134
|
#
|
135
135
|
# Returns the Tilt template object
|
136
136
|
def register name, template
|
137
|
-
|
137
|
+
if (template_cache = @caches[:templates])
|
138
138
|
template_cache[template.file] = template
|
139
|
-
else
|
140
|
-
template
|
141
139
|
end
|
142
|
-
|
140
|
+
@templates[name] = template
|
143
141
|
end
|
144
142
|
|
145
143
|
private
|
@@ -155,6 +153,7 @@ class Converter::TemplateConverter < Converter::Base
|
|
155
153
|
engine = @engine
|
156
154
|
@template_dirs.each do |template_dir|
|
157
155
|
# FIXME need to think about safe mode restrictions here
|
156
|
+
# Ruby 2.3 requires the extra brackets around the path_resolver.system_path method call
|
158
157
|
next unless ::File.directory?(template_dir = (path_resolver.system_path template_dir))
|
159
158
|
|
160
159
|
if engine
|
@@ -186,8 +185,8 @@ class Converter::TemplateConverter < Converter::Base
|
|
186
185
|
else
|
187
186
|
@templates.update scan_dir(template_dir, pattern, @caches[:templates])
|
188
187
|
end
|
189
|
-
nil
|
190
188
|
end
|
189
|
+
nil
|
191
190
|
end
|
192
191
|
|
193
192
|
# Internal: Scan the specified directory for template files matching pattern and instantiate
|
@@ -262,7 +261,7 @@ class Converter::TemplateConverter < Converter::Base
|
|
262
261
|
[::Tilt::ErubiTemplate, {}]
|
263
262
|
elsif name == 'erubis'
|
264
263
|
Helpers.require_library 'erubis' unless defined? ::Erubis::FastEruby
|
265
|
-
[::Tilt::ErubisTemplate,
|
264
|
+
[::Tilt::ErubisTemplate, engine_class: ::Erubis::FastEruby]
|
266
265
|
else
|
267
266
|
raise ::ArgumentError, %(Unknown ERB implementation: #{name})
|
268
267
|
end
|
data/lib/asciidoctor/document.rb
CHANGED
@@ -286,7 +286,6 @@ class Document < AbstractBlock
|
|
286
286
|
footnotes: [],
|
287
287
|
links: [],
|
288
288
|
images: [],
|
289
|
-
#indexterms: [],
|
290
289
|
callouts: Callouts.new,
|
291
290
|
includes: {},
|
292
291
|
}
|
@@ -311,7 +310,7 @@ class Document < AbstractBlock
|
|
311
310
|
end
|
312
311
|
attr_overrides[key.downcase] = val
|
313
312
|
end
|
314
|
-
if (to_file = options[:to_file])
|
313
|
+
if ::String === (to_file = options[:to_file])
|
315
314
|
attr_overrides['outfilesuffix'] = Helpers.extname to_file
|
316
315
|
end
|
317
316
|
# safely resolve the safe mode from const, int or string
|
@@ -360,9 +359,9 @@ class Document < AbstractBlock
|
|
360
359
|
# sync embedded attribute with :standalone option value
|
361
360
|
attr_overrides['embedded'] = ''
|
362
361
|
if (attr_overrides.key? 'showtitle') && (attr_overrides.keys & %w(notitle showtitle))[-1] == 'showtitle'
|
363
|
-
attr_overrides['notitle'] = { nil => '', false => '@', '@' => false}[attr_overrides['showtitle']]
|
362
|
+
attr_overrides['notitle'] = { nil => '', false => '@', '@' => false }[attr_overrides['showtitle']]
|
364
363
|
elsif attr_overrides.key? 'notitle'
|
365
|
-
attr_overrides['showtitle'] = { nil => '', false => '@', '@' => false}[attr_overrides['notitle']]
|
364
|
+
attr_overrides['showtitle'] = { nil => '', false => '@', '@' => false }[attr_overrides['notitle']]
|
366
365
|
else
|
367
366
|
attrs['notitle'] = ''
|
368
367
|
end
|
@@ -399,11 +398,11 @@ class Document < AbstractBlock
|
|
399
398
|
|
400
399
|
# allow common attributes backend and doctype to be set using options hash, coerce values to string
|
401
400
|
if (backend_val = options[:backend])
|
402
|
-
attr_overrides['backend'] =
|
401
|
+
attr_overrides['backend'] = backend_val.to_s
|
403
402
|
end
|
404
403
|
|
405
404
|
if (doctype_val = options[:doctype])
|
406
|
-
attr_overrides['doctype'] =
|
405
|
+
attr_overrides['doctype'] = doctype_val.to_s
|
407
406
|
end
|
408
407
|
|
409
408
|
if @safe >= SafeMode::SERVER
|
@@ -566,9 +565,7 @@ class Document < AbstractBlock
|
|
566
565
|
# returns the next number in the sequence for the specified counter
|
567
566
|
def counter name, seed = nil
|
568
567
|
return @parent_document.counter name, seed if @parent_document
|
569
|
-
if (locked = attribute_locked? name) && (curr_val = @counters[name])
|
570
|
-
next_val = @counters[name] = Helpers.nextval curr_val
|
571
|
-
elsif !(curr_val = @attributes[name]).nil_or_empty?
|
568
|
+
if ((locked = attribute_locked? name) && (curr_val = @counters[name])) || !(curr_val = @attributes[name]).nil_or_empty?
|
572
569
|
next_val = @counters[name] = Helpers.nextval curr_val
|
573
570
|
elsif seed
|
574
571
|
next_val = @counters[name] = seed == seed.to_i.to_s ? seed.to_i : seed
|
@@ -618,10 +615,17 @@ class Document < AbstractBlock
|
|
618
615
|
# @reftexts is set eagerly to prevent nested lazy init
|
619
616
|
(@reftexts = {}).tap {|accum| @catalog[:refs].each {|id, ref| accum[ref.xreftext] ||= id } }[text]
|
620
617
|
else
|
621
|
-
# @reftexts is set eagerly to prevent nested lazy init
|
622
618
|
resolved_id = nil
|
623
|
-
#
|
624
|
-
|
619
|
+
# @reftexts is set eagerly to prevent nested lazy init
|
620
|
+
@reftexts = accum = {}
|
621
|
+
@catalog[:refs].each do |id, ref|
|
622
|
+
# NOTE short-circuit early since we're throwing away this table anyway
|
623
|
+
if (xreftext = ref.xreftext) == text
|
624
|
+
resolved_id = id
|
625
|
+
break
|
626
|
+
end
|
627
|
+
accum[xreftext] ||= id
|
628
|
+
end
|
625
629
|
@reftexts = nil
|
626
630
|
resolved_id
|
627
631
|
end
|
@@ -679,7 +683,7 @@ class Document < AbstractBlock
|
|
679
683
|
#
|
680
684
|
# title - the String title to assign as the title of the document header
|
681
685
|
#
|
682
|
-
# Returns the
|
686
|
+
# Returns the specified [String] title
|
683
687
|
def title= title
|
684
688
|
unless (sect = @header)
|
685
689
|
(sect = (@header = Section.new self, 0)).sectname = 'header'
|
@@ -988,25 +992,6 @@ class Document < AbstractBlock
|
|
988
992
|
nil
|
989
993
|
end
|
990
994
|
|
991
|
-
=begin
|
992
|
-
def convert_to target, opts = {}
|
993
|
-
start = ::Time.now.to_f if (monitor = opts[:monitor])
|
994
|
-
output = (r = converter opts).convert
|
995
|
-
monitor[:convert] = ::Time.now.to_f - start if monitor
|
996
|
-
|
997
|
-
unless target.respond_to? :write
|
998
|
-
@attributes['outfile'] = target = ::File.expand_path target
|
999
|
-
@attributes['outdir'] = ::File.dirname target
|
1000
|
-
end
|
1001
|
-
|
1002
|
-
start = ::Time.now.to_f if monitor
|
1003
|
-
r.write output, target
|
1004
|
-
monitor[:write] = ::Time.now.to_f - start if monitor
|
1005
|
-
|
1006
|
-
output
|
1007
|
-
end
|
1008
|
-
=end
|
1009
|
-
|
1010
995
|
def content
|
1011
996
|
# NOTE per AsciiDoc-spec, remove the title before converting the body
|
1012
997
|
@attributes.delete('title')
|
@@ -1028,7 +1013,7 @@ class Document < AbstractBlock
|
|
1028
1013
|
def docinfo location = :head, suffix = nil
|
1029
1014
|
if safe < SafeMode::SECURE
|
1030
1015
|
qualifier = %(-#{location}) unless location == :head
|
1031
|
-
suffix
|
1016
|
+
suffix ||= @outfilesuffix
|
1032
1017
|
|
1033
1018
|
if (docinfo = @attributes['docinfo']).nil_or_empty?
|
1034
1019
|
if @attributes.key? 'docinfo2'
|
@@ -1085,7 +1070,7 @@ class Document < AbstractBlock
|
|
1085
1070
|
end
|
1086
1071
|
|
1087
1072
|
def to_s
|
1088
|
-
%(#<#{self.class}@#{object_id} {doctype: #{doctype.inspect}, doctitle: #{(@header
|
1073
|
+
%(#<#{self.class}@#{object_id} {doctype: #{doctype.inspect}, doctitle: #{(@header && @header.title).inspect}, blocks: #{@blocks.size}}>)
|
1089
1074
|
end
|
1090
1075
|
|
1091
1076
|
private
|
@@ -1214,8 +1199,8 @@ class Document < AbstractBlock
|
|
1214
1199
|
end
|
1215
1200
|
end
|
1216
1201
|
|
1217
|
-
if (@compat_mode = attrs.key? 'compat-mode')
|
1218
|
-
attrs['source-language'] = attrs['language']
|
1202
|
+
if (@compat_mode = attrs.key? 'compat-mode') && (attrs.key? 'language')
|
1203
|
+
attrs['source-language'] = attrs['language']
|
1219
1204
|
end
|
1220
1205
|
|
1221
1206
|
unless @parent_document
|
@@ -1388,7 +1373,7 @@ class Document < AbstractBlock
|
|
1388
1373
|
attrs[%(basebackend-#{current_basebackend}-doctype-#{new_doctype})] = '' if current_basebackend
|
1389
1374
|
end
|
1390
1375
|
attrs[%(doctype-#{new_doctype})] = ''
|
1391
|
-
|
1376
|
+
@doctype = attrs['doctype'] = new_doctype
|
1392
1377
|
end
|
1393
1378
|
end
|
1394
1379
|
end
|
@@ -134,14 +134,14 @@ module Extensions
|
|
134
134
|
if opts.fetch :numbered, (style == 'appendix')
|
135
135
|
sect.numbered = true
|
136
136
|
elsif !(opts.key? :numbered) && (doc.attr? 'sectnums', 'all')
|
137
|
-
sect.numbered = book && level == 1 ? :chapter : true
|
137
|
+
sect.numbered = (book && level == 1 ? :chapter : true)
|
138
138
|
end
|
139
139
|
elsif level > 0
|
140
140
|
if opts.fetch :numbered, (doc.attr? 'sectnums')
|
141
141
|
sect.numbered = sect.special ? parent.numbered && true : true
|
142
142
|
end
|
143
|
-
|
144
|
-
sect.numbered = true
|
143
|
+
elsif opts.fetch :numbered, (book && (doc.attr? 'partnums'))
|
144
|
+
sect.numbered = true
|
145
145
|
end
|
146
146
|
if (id = attrs['id']) == false
|
147
147
|
attrs.delete 'id'
|
@@ -229,7 +229,7 @@ module Extensions
|
|
229
229
|
def parse_attributes block, attrlist, opts = {}
|
230
230
|
return {} if attrlist ? attrlist.empty? : true
|
231
231
|
attrlist = block.sub_attributes attrlist if opts[:sub_attributes] && (attrlist.include? ATTR_REF_HEAD)
|
232
|
-
(AttributeList.new attrlist).parse
|
232
|
+
(AttributeList.new attrlist).parse opts[:positional_attributes] || []
|
233
233
|
end
|
234
234
|
|
235
235
|
# TODO fill out remaining methods
|
@@ -1199,7 +1199,7 @@ module Extensions
|
|
1199
1199
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
1200
1200
|
#
|
1201
1201
|
# Returns the [Extension] object stored in the registry that proxies the
|
1202
|
-
#
|
1202
|
+
# corresponding BlockMacroProcessor or nil if a match is not found.
|
1203
1203
|
def find_block_macro_extension name
|
1204
1204
|
@block_macro_extensions[name.to_sym]
|
1205
1205
|
end
|
@@ -1286,7 +1286,7 @@ module Extensions
|
|
1286
1286
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
1287
1287
|
#
|
1288
1288
|
# Returns the [Extension] object stored in the registry that proxies the
|
1289
|
-
#
|
1289
|
+
# corresponding InlineMacroProcessor or nil if a match is not found.
|
1290
1290
|
def find_inline_macro_extension name
|
1291
1291
|
@inline_macro_extensions[name.to_sym]
|
1292
1292
|
end
|
@@ -1328,7 +1328,7 @@ module Extensions
|
|
1328
1328
|
kind_java_class = (defined? ::AsciidoctorJ) ? (::AsciidoctorJ::Extensions.const_get kind_class_symbol, false) : nil
|
1329
1329
|
kind_store = instance_variable_get(%(@#{kind}_extensions).to_sym) || instance_variable_set(%(@#{kind}_extensions).to_sym, [])
|
1330
1330
|
# style 1: specified as block
|
1331
|
-
|
1331
|
+
if block_given?
|
1332
1332
|
config = resolve_args args, 1
|
1333
1333
|
(processor = kind_class.new config).singleton_class.enable_dsl
|
1334
1334
|
if block.arity == 0
|
@@ -1340,7 +1340,7 @@ module Extensions
|
|
1340
1340
|
raise ::ArgumentError, %(No block specified to process #{kind_name} extension at #{block.source_location})
|
1341
1341
|
end
|
1342
1342
|
processor.freeze
|
1343
|
-
ProcessorExtension.new kind, processor
|
1343
|
+
extension = ProcessorExtension.new kind, processor
|
1344
1344
|
else
|
1345
1345
|
processor, config = resolve_args args, 2
|
1346
1346
|
# style 2: specified as Class or String class name
|
@@ -1350,12 +1350,12 @@ module Extensions
|
|
1350
1350
|
end
|
1351
1351
|
processor_instance = processor_class.new config
|
1352
1352
|
processor_instance.freeze
|
1353
|
-
ProcessorExtension.new kind, processor_instance
|
1353
|
+
extension = ProcessorExtension.new kind, processor_instance
|
1354
1354
|
# style 3: specified as instance
|
1355
1355
|
elsif kind_class === processor || (kind_java_class && kind_java_class === processor)
|
1356
1356
|
processor.update_config config
|
1357
1357
|
processor.freeze
|
1358
|
-
ProcessorExtension.new kind, processor
|
1358
|
+
extension = ProcessorExtension.new kind, processor
|
1359
1359
|
else
|
1360
1360
|
raise ::ArgumentError, %(Invalid arguments specified for registering #{kind_name} extension: #{args})
|
1361
1361
|
end
|
data/lib/asciidoctor/list.rb
CHANGED
@@ -80,12 +80,8 @@ class ListItem < AbstractBlock
|
|
80
80
|
@text && (apply_subs @text, @subs)
|
81
81
|
end
|
82
82
|
|
83
|
-
# Public: Set the String text
|
84
|
-
|
85
|
-
# Returns the new String text assigned to this ListItem
|
86
|
-
def text= val
|
87
|
-
@text = val
|
88
|
-
end
|
83
|
+
# Public: Set the String text assigned to this ListItem
|
84
|
+
attr_writer :text
|
89
85
|
|
90
86
|
# Check whether this list item has simple content (no nested blocks aside from a single outline list).
|
91
87
|
# Primarily relevant for outline lists.
|