class Relaton::Cli::Command
Public Instance Methods
concatenate(source_dir, outfile)
click to toggle source
# File lib/relaton/cli/command.rb, line 51 def concatenate(source_dir, outfile) Relaton::Cli::RelatonFile.concatenate(source_dir, outfile, options) end
convert(file)
click to toggle source
# File lib/relaton/cli/command.rb, line 129 def convert(file) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength xml = Nokogiri::XML(File.read(file, encoding: "UTF-8")) item = Relaton::Cli.parse_xml xml result = if /yaml|yml/.match?(options[:format]) item.to_hash.to_yaml else item.send "to_#{options[:format]}" end ext = case options[:format] when "bibtex" then "bib" when "asciibib" then "adoc" else options[:format] end output = options[:output] || file.sub(/(?<=\.)[^.]+$/, ext) File.write output, result, encoding: "UTF-8" end
extract(source_dir, outdir)
click to toggle source
# File lib/relaton/cli/command.rb, line 39 def extract(source_dir, outdir) Relaton::Cli::RelatonFile.extract(source_dir, outdir, options) end
fetch(code)
click to toggle source
# File lib/relaton/cli/command.rb, line 29 def fetch(code) io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8") io.puts(fetch_document(code, options) || supported_type_message) end
fetch_data(source)
click to toggle source
# File lib/relaton/cli/command.rb, line 149 def fetch_data(source) DataFetcher.fetch source, options end
relaton_config()
click to toggle source
# File lib/relaton/cli/command.rb, line 160 def relaton_config log_types = %i[info error] log_types << :warning if options[:verbose] Relaton.configure do |conf| conf.logs = log_types end end
split(source, outdir)
click to toggle source
# File lib/relaton/cli/command.rb, line 60 def split(source, outdir) Relaton::Cli::RelatonFile.split(source, outdir, options) end
xml2html(file, style = nil, template = nil)
click to toggle source
# File lib/relaton/cli/command.rb, line 107 def xml2html(file, style = nil, template = nil) Relaton::Cli::XMLConvertor.to_html(file, style, template) end
xml2yaml(filename)
click to toggle source
# File lib/relaton/cli/command.rb, line 94 def xml2yaml(filename) Relaton::Cli::XMLConvertor.to_yaml(filename, options) end
yaml2html(file, style = nil, template = nil)
click to toggle source
# File lib/relaton/cli/command.rb, line 120 def yaml2html(file, style = nil, template = nil) Relaton::Cli::YAMLConvertor.to_html(file, style, template) end
yaml2xml(filename)
click to toggle source
# File lib/relaton/cli/command.rb, line 77 def yaml2xml(filename) Relaton::Cli::YAMLConvertor.to_xml(filename, options) end