lib/asciidoctor/block.rb in asciidoctor-2.0.15 vs lib/asciidoctor/block.rb in asciidoctor-2.0.16
- old
+ new
@@ -52,25 +52,25 @@
@content_model = opts[:content_model] || DEFAULT_CONTENT_MODEL[context]
if opts.key? :subs
# FIXME feels funky; we have to be defensive to get commit_subs to honor override
# FIXME does not resolve substitution groups inside Array (e.g., [:normal])
if (subs = opts[:subs])
- # e.g., subs: :defult
+ case subs
+ # e.g., subs: :default
# subs attribute is honored; falls back to opts[:default_subs], then built-in defaults based on context
- if subs == :default
+ when :default
@default_subs = opts[:default_subs]
# e.g., subs: [:quotes]
# subs attribute is not honored
- elsif ::Array === subs
+ when ::Array
@default_subs = subs.drop 0
@attributes.delete 'subs'
# e.g., subs: :normal or subs: 'normal'
# subs attribute is not honored
else
@default_subs = nil
- # interpolation is the fastest way to dup subs as a string
- @attributes['subs'] = %(#{subs})
+ @attributes['subs'] = subs.to_s
end
# resolve the subs eagerly only if subs option is specified
# QUESTION should we skip subsequent calls to commit_subs?
commit_subs
# e.g., subs: nil
@@ -121,10 +121,10 @@
result.shift while (first = result[0]) && first.rstrip.empty?
result.pop while (last = result[-1]) && last.rstrip.empty?
result.join LF
end
else
- logger.warn %(Unknown content model '#{@content_model}' for block: #{to_s}) unless @content_model == :empty
+ logger.warn %(Unknown content model '#{@content_model}' for block: #{self}) unless @content_model == :empty
nil
end
end
# Public: Returns the preprocessed source of this block