def push_include data, file = nil, path = nil, lineno = 1, attributes = {}
@include_stack << [@lines, @file, @dir, @path, @lineno, @maxdepth, @process_lines]
if file
@file = file
@dir = File.dirname file
@process_lines = ASCIIDOC_EXTENSIONS[::File.extname(file)]
else
@file = nil
@dir = '.'
@process_lines = true
end
@path = if path
@includes << Helpers.rootname(path)
path
else
'<stdin>'
end
@lineno = lineno
if attributes.has_key? 'depth'
depth = attributes['depth'].to_i
depth = 1 if depth <= 0
@maxdepth = {:abs => (@include_stack.size - 1) + depth, :rel => depth}
end
if (@lines = prepare_lines data, :normalize => true, :condense => false, :indent => attributes['indent']).empty?
pop_include
else
if attributes.has_key? 'leveloffset'
@lines.unshift ''
@lines.unshift %(:leveloffset: #{attributes['leveloffset']})
@lines.push ''
if (old_leveloffset = @document.attr 'leveloffset')
@lines.push %(:leveloffset: #{old_leveloffset})
else
@lines.push ':leveloffset!:'
end
@lineno -= 2
end
@eof = false
@look_ahead = 0
end
nil
end