lib/asciidoctor/block.rb in asciidoctor-1.5.5 vs lib/asciidoctor/block.rb in asciidoctor-1.5.6
- old
+ new
@@ -22,11 +22,11 @@
:thematic_break => :empty,
:video => :empty
}).default = :simple
# Public: Create alias for context to be consistent w/ AsciiDoc
- alias :blockname :context
+ alias blockname context
# Public: Get/Set the original Array content for this block, if applicable
attr_accessor :lines
# Public: Initialize an Asciidoctor::Block object.
@@ -72,18 +72,18 @@
end
# resolve the subs eagerly only if subs option is specified
lock_in_subs
# e.g., :subs => nil
else
- @subs = []
+ # NOTE @subs is initialized as empty array by super constructor
# prevent subs from being resolved
@default_subs = []
@attributes.delete 'subs'
end
# defer subs resolution; subs attribute is honored
else
- @subs = []
+ # NOTE @subs is initialized as empty array by super constructor
# QUESTION should we honor :default_subs option (i.e., @default_subs = opts[:default_subs])?
@default_subs = nil
end
if (raw_source = opts[:source]).nil_or_empty?
@lines = []
@@ -107,23 +107,23 @@
def content
case @content_model
when :compound
super
when :simple
- apply_subs(@lines * EOL, @subs)
+ apply_subs @lines * LF, @subs
when :verbatim, :raw
- #((apply_subs @lines.join(EOL), @subs).sub StripLineWiseRx, '\1')
+ #((apply_subs @lines * LF, @subs).sub StripLineWiseRx, '\1')
# QUESTION could we use strip here instead of popping empty lines?
# maybe apply_subs can know how to strip whitespace?
result = apply_subs @lines, @subs
if result.size < 2
result[0]
else
result.shift while (first = result[0]) && first.rstrip.empty?
result.pop while (last = result[-1]) && last.rstrip.empty?
- result * EOL
+ result * LF
end
else
warn %(Unknown content model '#{@content_model}' for block: #{to_s}) unless @content_model == :empty
nil
end
@@ -132,10 +132,10 @@
# Public: Returns the preprocessed source of this block
#
# Returns the a String containing the lines joined together or nil if there
# are no lines
def source
- @lines * EOL
+ @lines * LF
end
def to_s
content_summary = @content_model == :compound ? %(blocks: #{@blocks.size}) : %(lines: #{@lines.size})
%(#<#{self.class}@#{object_id} {context: #{@context.inspect}, content_model: #{@content_model.inspect}, style: #{@style.inspect}, #{content_summary}}>)