72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/ex-doc-include.rb', line 72
def process doc, reader, target, attributes
if not attributes.key? 'expand'
target_name = File.basename(target,'.*')
expanded_target = "#{target_name}.html"
if attributes.key? 'out-dir'
expanded_target = attributes["out-dir"] + "/" + expanded_target
end
Asciidoctor.convert("include::#{target}[expand=true]", to_file: expanded_target, attributes: doc.attributes)
text = if attributes.key? 'link' then attributes["link"] else target_name end
content = ["link:#{expanded_target}[#{text}]"]
else
content =
IO.readlines(target)
.map( &DocBlocksExtractor.new() )
.compact
end
reader.push_include content, target, target, 1, attributes
return reader
end
|