reverse_adoc 0.2.8 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +15 -0
  3. data/.github/workflows/rake.yml +32 -0
  4. data/.github/workflows/release.yml +45 -0
  5. data/.gitignore +10 -0
  6. data/.hound.yml +3 -1
  7. data/.rubocop.yml +7 -7
  8. data/Gemfile +1 -1
  9. data/README.adoc +6 -33
  10. data/Rakefile +1 -1
  11. data/exe/reverse_adoc +70 -0
  12. data/{bin → exe}/w2a +15 -15
  13. data/lib/reverse_adoc.rb +27 -0
  14. data/lib/{reverse_asciidoctor → reverse_adoc}/cleaner.rb +28 -27
  15. data/lib/{reverse_asciidoctor → reverse_adoc}/config.rb +1 -1
  16. data/lib/{reverse_asciidoctor → reverse_adoc}/converters.rb +6 -6
  17. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/a.rb +1 -1
  18. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/aside.rb +1 -1
  19. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/audio.rb +1 -1
  20. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/base.rb +5 -3
  21. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/blockquote.rb +2 -2
  22. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/br.rb +1 -1
  23. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/bypass.rb +1 -1
  24. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/code.rb +1 -1
  25. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/div.rb +1 -1
  26. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/drop.rb +1 -1
  27. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/em.rb +1 -1
  28. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/figure.rb +1 -1
  29. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/h.rb +1 -1
  30. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/head.rb +1 -1
  31. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/hr.rb +1 -1
  32. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ignore.rb +1 -1
  33. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/img.rb +9 -9
  34. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/li.rb +1 -1
  35. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/mark.rb +1 -1
  36. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/math.rb +3 -3
  37. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ol.rb +1 -1
  38. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/p.rb +1 -1
  39. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/pass_through.rb +1 -1
  40. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/pre.rb +1 -1
  41. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/q.rb +1 -1
  42. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/strong.rb +1 -1
  43. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/sub.rb +1 -1
  44. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/sup.rb +1 -1
  45. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/table.rb +1 -1
  46. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/td.rb +1 -1
  47. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/text.rb +1 -1
  48. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/th.rb +1 -1
  49. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/tr.rb +1 -1
  50. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/video.rb +1 -1
  51. data/lib/{reverse_asciidoctor → reverse_adoc}/errors.rb +1 -1
  52. data/lib/reverse_adoc/html_converter.rb +56 -0
  53. data/lib/reverse_adoc/version.rb +3 -0
  54. data/reverse_adoc.gemspec +18 -15
  55. data/spec/assets/escapables.html +2 -0
  56. data/spec/bin/reverse_adoc_spec.rb +2 -2
  57. data/spec/bin/w2a_spec.rb +7 -7
  58. data/spec/components/anchors_spec.rb +2 -2
  59. data/spec/components/basic_spec.rb +3 -3
  60. data/spec/components/code_spec.rb +4 -5
  61. data/spec/components/escapables_spec.rb +10 -2
  62. data/spec/components/from_the_wild_spec.rb +2 -2
  63. data/spec/components/html_fragment_spec.rb +2 -3
  64. data/spec/components/lists_spec.rb +2 -2
  65. data/spec/components/paragraphs_spec.rb +2 -2
  66. data/spec/components/quotation_spec.rb +2 -2
  67. data/spec/components/tables_spec.rb +2 -2
  68. data/spec/components/unknown_tags_spec.rb +9 -10
  69. data/spec/lib/{reverse_asciidoctor_spec.rb → reverse_adoc.rb} +17 -17
  70. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/cleaner_spec.rb +4 -4
  71. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/config_spec.rb +5 -5
  72. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/aside_spec.rb +2 -2
  73. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/audio_spec.rb +2 -3
  74. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/blockquote_spec.rb +2 -2
  75. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/br_spec.rb +2 -2
  76. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/code_spec.rb +2 -3
  77. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/div_spec.rb +2 -3
  78. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/figure_spec.rb +2 -3
  79. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/img_spec.rb +2 -3
  80. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/li_spec.rb +2 -2
  81. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/mark_spec.rb +2 -2
  82. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/p_spec.rb +2 -3
  83. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/pre_spec.rb +2 -3
  84. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/q_spec.rb +2 -2
  85. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/strong_spec.rb +2 -2
  86. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/text_spec.rb +2 -2
  87. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/video_spec.rb +2 -3
  88. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters_spec.rb +5 -5
  89. data/spec/spec_helper.rb +3 -3
  90. metadata +123 -125
  91. data/.github/workflows/macos.yml +0 -31
  92. data/.github/workflows/ubuntu.yml +0 -33
  93. data/.github/workflows/windows.yml +0 -37
  94. data/Gemfile.lock +0 -84
  95. data/bin/reverse_adoc +0 -74
  96. data/lib/reverse_asciidoctor.rb +0 -30
  97. data/lib/reverse_asciidoctor/converters/example.rb +0 -17
  98. data/lib/reverse_asciidoctor/converters/express_ref.rb +0 -12
  99. data/lib/reverse_asciidoctor/converters/ext_description.rb +0 -16
  100. data/lib/reverse_asciidoctor/converters/ext_descriptions.rb +0 -12
  101. data/lib/reverse_asciidoctor/converters/note.rb +0 -17
  102. data/lib/reverse_asciidoctor/html_converter.rb +0 -56
  103. data/lib/reverse_asciidoctor/smrl_description_converter.rb +0 -45
  104. data/lib/reverse_asciidoctor/version.rb +0 -3
  105. data/spec/lib/reverse_asciidoctor/converters/example_spec.rb +0 -22
  106. data/spec/lib/reverse_asciidoctor/converters/express_ref_spec.rb +0 -14
  107. data/spec/lib/reverse_asciidoctor/converters/ext_description_spec.rb +0 -20
  108. data/spec/lib/reverse_asciidoctor/converters/ext_descriptions_spec.rb +0 -13
  109. data/spec/lib/reverse_asciidoctor/converters/note_spec.rb +0 -22
@@ -1,6 +1,6 @@
1
1
  require 'tmpdir'
2
2
 
3
- module ReverseAsciidoctor
3
+ module ReverseAdoc
4
4
  class Config
5
5
  attr_accessor :unknown_tags, :tag_border, :mathml2asciimath, :external_images,
6
6
  :destination, :sourcedir, :image_counter, :image_counter_pattern, :input_format
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  def self.register(tag_name, converter)
4
4
  @@converters ||= {}
@@ -16,17 +16,17 @@ module ReverseAsciidoctor
16
16
  private
17
17
 
18
18
  def self.default_converter(tag_name)
19
- case ReverseAsciidoctor.config.unknown_tags.to_sym
19
+ case ReverseAdoc.config.unknown_tags.to_sym
20
20
  when :pass_through
21
- ReverseAsciidoctor::Converters::PassThrough.new
21
+ ReverseAdoc::Converters::PassThrough.new
22
22
  when :drop
23
- ReverseAsciidoctor::Converters::Drop.new
23
+ ReverseAdoc::Converters::Drop.new
24
24
  when :bypass
25
- ReverseAsciidoctor::Converters::Bypass.new
25
+ ReverseAdoc::Converters::Bypass.new
26
26
  when :raise
27
27
  raise UnknownTagError, "unknown tag: #{tag_name}"
28
28
  else
29
- raise InvalidConfigurationError, "unknown value #{ReverseAsciidoctor.config.unknown_tags.inspect} for ReverseAsciidoctor.config.unknown_tags"
29
+ raise InvalidConfigurationError, "unknown value #{ReverseAdoc.config.unknown_tags.inspect} for ReverseAdoc.config.unknown_tags"
30
30
  end
31
31
  end
32
32
  end
@@ -1,6 +1,6 @@
1
1
  require "uri"
2
2
 
3
- module ReverseAsciidoctor
3
+ module ReverseAdoc
4
4
  module Converters
5
5
  class A < Base
6
6
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Aside < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Audio < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Base
4
4
  def treat_children(node, state)
@@ -8,11 +8,13 @@ module ReverseAsciidoctor
8
8
  end
9
9
 
10
10
  def treat(node, state)
11
- ReverseAsciidoctor::Converters.lookup(node.name).convert(node, state)
11
+ ReverseAdoc::Converters.lookup(node.name).convert(node, state)
12
12
  end
13
13
 
14
14
  def escape_keychars(string)
15
- string.gsub(/(?<!\\)[*_]/, '*' => '\*', '_' => '\_')
15
+ subs = { '*' => '\*', '_' => '\_' }
16
+ string
17
+ .gsub(/((?<=\s)[\*_]+)|[\*_]+(?=\s)/) { |n| n.chars.map { |char| subs[char] }.join }
16
18
  end
17
19
 
18
20
  def extract_title(node)
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Blockquote < Base
4
4
  def convert(node, state = {})
@@ -7,7 +7,7 @@ module ReverseAsciidoctor
7
7
  cite = node['cite']
8
8
  attrs = cite ? "[quote, #{cite}]\n" : ""
9
9
  content = treat_children(node, state).strip
10
- content = ReverseAsciidoctor.cleaner.remove_newlines(content)
10
+ content = ReverseAdoc.cleaner.remove_newlines(content)
11
11
  #"\n\n> " << content.lines.to_a.join('> ') << "\n\n"
12
12
  "\n\n#{attrs}____\n" << content.lines.to_a.join('') << "\n____\n\n"
13
13
  end
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Br < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Bypass < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Code < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Div < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Drop < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Em < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Figure < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class H < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Head < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Hr < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Ignore < Base
4
4
  def convert(node, state = {})
@@ -2,27 +2,27 @@ require "fileutils"
2
2
  require "pathname"
3
3
  require "tempfile"
4
4
  require "base64"
5
- require "mimemagic"
5
+ require "marcel"
6
6
 
7
- module ReverseAsciidoctor
7
+ module ReverseAdoc
8
8
  module Converters
9
9
  class Img < Base
10
10
 
11
11
  def image_number
12
12
  sprintf(
13
- ReverseAsciidoctor.config.image_counter_pattern,
14
- ReverseAsciidoctor.config.image_counter
13
+ ReverseAdoc.config.image_counter_pattern,
14
+ ReverseAdoc.config.image_counter
15
15
  )
16
16
  end
17
17
 
18
18
  def image_number_increment
19
- ReverseAsciidoctor.config.image_counter += 1
19
+ ReverseAdoc.config.image_counter += 1
20
20
  end
21
21
 
22
22
  def datauri2file(src)
23
23
  %r{^data:image/(?<imgtype>[^;]+);base64,(?<imgdata>.+)$} =~ src
24
24
 
25
- dest_dir = Pathname.new(ReverseAsciidoctor.config.destination).dirname
25
+ dest_dir = Pathname.new(ReverseAdoc.config.destination).dirname
26
26
  images_dir = dest_dir + 'images'
27
27
  FileUtils.mkdir_p(images_dir)
28
28
 
@@ -42,7 +42,7 @@ module ReverseAsciidoctor
42
42
  return copy_temp_file(imgdata) if imgdata
43
43
 
44
44
  ext = File.extname(src).strip.downcase[1..-1]
45
- [ext, Pathname.new(ReverseAsciidoctor.config.sourcedir) + src]
45
+ [ext, Pathname.new(ReverseAdoc.config.sourcedir) + src]
46
46
  end
47
47
 
48
48
  def copy_temp_file(imgdata)
@@ -50,7 +50,7 @@ module ReverseAsciidoctor
50
50
  f.binmode
51
51
  f.write(Base64.strict_decode64(imgdata))
52
52
  f.rewind
53
- ext = MimeMagic.by_magic(f).subtype
53
+ ext = Marcel::MimeType.for(f).sub(%r{^[^/]+/}, "")
54
54
  [ext, f.path]
55
55
  end
56
56
  end
@@ -64,7 +64,7 @@ module ReverseAsciidoctor
64
64
  anchor = id ? "[[#{id}]]\n" : ""
65
65
  title = extract_title(node)
66
66
 
67
- if ReverseAsciidoctor.config.external_images
67
+ if ReverseAdoc.config.external_images
68
68
  # puts "external image conversion #{id}, #{src}"
69
69
  src = datauri2file(src)
70
70
  end
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Li < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Mark < Base
4
4
  def convert(node, state = {})
@@ -1,15 +1,15 @@
1
- # Unless run with ReverseAsciidoctor.config.mathml2asciimath,
1
+ # Unless run with ReverseAdoc.config.mathml2asciimath,
2
2
  # this is cheating: we're injecting MathML into Asciidoctor, but
3
3
  # Asciidoctor only understands AsciiMath or LaTeX
4
4
 
5
5
  require "mathml2asciimath"
6
6
 
7
- module ReverseAsciidoctor
7
+ module ReverseAdoc
8
8
  module Converters
9
9
  class Math < Base
10
10
  def convert(node, state = {})
11
11
  stem = node.to_s.gsub(/\n/, " ")
12
- stem = MathML2AsciiMath.m2a(stem) if ReverseAsciidoctor.config.mathml2asciimath
12
+ stem = MathML2AsciiMath.m2a(stem) if ReverseAdoc.config.mathml2asciimath
13
13
  stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(\(([^\)]+)\)\)/, "(\\1)") unless stem.nil?
14
14
  " stem:[" << stem << "] "
15
15
  end
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Ol < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class P < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class PassThrough < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Pre < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Q < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Strong < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Sub < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Sup < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Table < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Td < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Text < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Th < Td
4
4
  def cellstyle(node)
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Tr < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  module Converters
3
3
  class Video < Base
4
4
  def convert(node, state = {})
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  class Error < StandardError
3
3
  end
4
4
 
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "reverse_adoc/converters/a"
4
+ require "reverse_adoc/converters/aside"
5
+ require "reverse_adoc/converters/audio"
6
+ require "reverse_adoc/converters/blockquote"
7
+ require "reverse_adoc/converters/br"
8
+ require "reverse_adoc/converters/bypass"
9
+ require "reverse_adoc/converters/code"
10
+ require "reverse_adoc/converters/div"
11
+ require "reverse_adoc/converters/drop"
12
+ require "reverse_adoc/converters/em"
13
+ require "reverse_adoc/converters/figure"
14
+ require "reverse_adoc/converters/h"
15
+ require "reverse_adoc/converters/head"
16
+ require "reverse_adoc/converters/hr"
17
+ require "reverse_adoc/converters/ignore"
18
+ require "reverse_adoc/converters/img"
19
+ require "reverse_adoc/converters/mark"
20
+ require "reverse_adoc/converters/li"
21
+ require "reverse_adoc/converters/ol"
22
+ require "reverse_adoc/converters/p"
23
+ require "reverse_adoc/converters/pass_through"
24
+ require "reverse_adoc/converters/pre"
25
+ require "reverse_adoc/converters/q"
26
+ require "reverse_adoc/converters/strong"
27
+ require "reverse_adoc/converters/sup"
28
+ require "reverse_adoc/converters/sub"
29
+ require "reverse_adoc/converters/table"
30
+ require "reverse_adoc/converters/td"
31
+ require "reverse_adoc/converters/th"
32
+ require "reverse_adoc/converters/text"
33
+ require "reverse_adoc/converters/tr"
34
+ require "reverse_adoc/converters/video"
35
+ require "reverse_adoc/converters/math"
36
+
37
+ module ReverseAdoc
38
+ class HtmlConverter
39
+ def self.convert(input, options = {})
40
+ root = if input.is_a?(String)
41
+ then Nokogiri::HTML(input).root
42
+ elsif input.is_a?(Nokogiri::XML::Document)
43
+ then input.root
44
+ elsif input.is_a?(Nokogiri::XML::Node)
45
+ then input
46
+ end
47
+
48
+ root || (return "")
49
+
50
+ ReverseAdoc.config.with(options) do
51
+ result = ReverseAdoc::Converters.lookup(root.name).convert(root)
52
+ ReverseAdoc.cleaner.tidy(result)
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module ReverseAdoc
2
+ VERSION = "0.3.3".freeze
3
+ end