Skip to content
This repository has been archived by the owner on Dec 23, 2019. It is now read-only.

Commit

Permalink
Update for metanorma 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Jun 20, 2018
1 parent d67b83c commit fbdb26e
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/asciidoctor-rfc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
require_relative "asciidoctor/rfc/v2/converter"
require_relative "asciidoctor/rfc/v3/converter"
require_relative "asciidoctor/rfc/version"

if defined? Metanorma
require_relative "metanorma/rfc"
Metanorma::Registry.instance.register(Metanorma::Rfc::ProcessorV2)
Metanorma::Registry.instance.register(Metanorma::Rfc::ProcessorV3)
end
2 changes: 1 addition & 1 deletion lib/asciidoctor/rfc/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Asciidoctor
module RFC
VERSION = "0.8.5".freeze
VERSION = "0.9.0".freeze
end
end
8 changes: 8 additions & 0 deletions lib/metanorma/rfc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative "./rfc/processor_v2"
require_relative "./rfc/processor_v3"

module Metanorma
module Rfc

end
end
38 changes: 38 additions & 0 deletions lib/metanorma/rfc/processor_v2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require "metanorma/processor"

module Metanorma
module Rfc
class ProcessorV2 < Metanorma::Processor

def initialize
@short = :rfc2
@input_format = :asciidoc
@asciidoctor_backend = :rfc2
end

def output_formats
{
xmlrfc: "v2.xml"
}
end

def input_to_isodoc(file)
Asciidoctor.convert(
file,
to_file: false,
safe: :safe,
backend: @asciidoctor_backend,
header_footer: true
)
end

def output(isodoc_node, outname, format, options={})
case format
when :xmlrfc
File.open(outname, 'w') { |file| file << isodoc_node }
end
end

end
end
end
38 changes: 38 additions & 0 deletions lib/metanorma/rfc/processor_v3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require "metanorma/processor"

module Metanorma
module Rfc
class ProcessorV3 < Metanorma::Processor

def initialize
@short = :rfc3
@input_format = :asciidoc
@asciidoctor_backend = :rfc3
end

def output_formats
{
xmlrfc: "v3.xml"
}
end

def input_to_isodoc(file)
Asciidoctor.convert(
file,
to_file: false,
safe: :safe,
backend: @asciidoctor_backend,
header_footer: true
)
end

def output(isodoc_node, outname, format, options={})
case format
when :xmlrfc
File.open(outname, 'w') { |file| file << isodoc_node }
end
end

end
end
end

0 comments on commit fbdb26e

Please sign in to comment.