Sha256: 97d08d70f241b271bdb129a5f88438ee68d775c3ca586c4437c50e6ffeaae0e1

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby

require "optparse"
require "asciidoctor/cli"
require "asciidoctor/rfc/v2/converter"
require "asciidoctor/rfc/v3/converter"
require "asciidoctor/iso/converter"
require "asciidoctor/gb/converter"
require "asciidoctor/csd/converter"

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: metanorma --type XXX --format FORMAT file"

  opts.on('-t', '--type TYPE', 'Type of standard to generate: rfc2, rfc3, iso, gb, csd') { |v| options[:type] = v }
  opts.on('-f', '--format FORMAT', 'Format of source file: asciidoc (current default, only format supported)') { |v| options[:format] = v }

end.parse!

unless options[:type]
  puts "You must specify a standard type (metanorma --type XXX file)"
  exit 0
end
options[:format] = "asciidoc" unless options[:format]

unless %w{rfc2 rfc3 iso gb csd}.include? options[:type]
  puts "#{options[:type]} is not a supported standard type"
  exit 0
end
unless options[:format] == "asciidoc"
  puts "Only source file format currently supported is asciidoc"
  exit 0
end

asciidoc_options = Asciidoctor::Cli::Options.new backend: options[:type], header_footer: true
exit 0 if asciidoc_options.parse!(ARGV) == 0

invoker = Asciidoctor::Cli::Invoker.new asciidoc_options
GC.start
invoker.invoke!
exit invoker.code

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metanorma-0.1.0 exe/metanorma