Added project-root var resolution in readme generation script

This commit is contained in:
Marcin Grzejszczak
2019-10-23 15:49:54 +02:00
parent c780d61513
commit fc96d209c7

View File

@@ -17,7 +17,10 @@ end
file = ARGV[0] if ARGV.length>0
# Copied from https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb
doc = Asciidoctor.load_file file, safe: :unsafe, header_only: true, attributes: options[:attributes]
attributes = {}
attributes['project-root'] = File.expand_path("#{base_dir}/../")
doc = Asciidoctor.load_file file, safe: :unsafe, header_only: true, attributes: attributes
header_attr_names = (doc.instance_variable_get :@attributes_modified).to_a
header_attr_names.each {|k| doc.attributes[%(#{k}!)] = '' unless doc.attr? k }
attrs = doc.attributes