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,31 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
-
10
- jobs:
11
- test-macos:
12
- name: Test on Ruby ${{ matrix.ruby }} macOS
13
- runs-on: macos-latest
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- ruby: [ '2.6', '2.5', '2.4' ]
18
- steps:
19
- - uses: actions/checkout@master
20
- - name: Use Ruby
21
- uses: actions/setup-ruby@v1
22
- with:
23
- ruby-version: ${{ matrix.ruby }}
24
- architecture: 'x64'
25
- - name: Update gems
26
- run: |
27
- sudo gem install bundler --force
28
- bundle install --jobs 4 --retry 3
29
- - name: Run specs
30
- run: |
31
- bundle exec rake
@@ -1,33 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
-
10
- jobs:
11
- test-linux:
12
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
13
- runs-on: ubuntu-latest
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- ruby: [ '2.6', '2.5', '2.4' ]
18
- steps:
19
- - uses: actions/checkout@master
20
- - name: Use Ruby
21
- uses: actions/setup-ruby@v1
22
- with:
23
- ruby-version: ${{ matrix.ruby }}
24
- architecture: 'x64'
25
- - name: Install LibreOffice
26
- run: sudo apt-get -y --no-install-recommends install libreoffice
27
- - name: Update gems
28
- run: |
29
- gem install bundler
30
- bundle install --jobs 4 --retry 3
31
- - name: Run specs
32
- run: |
33
- bundle exec rake
@@ -1,37 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
-
10
- jobs:
11
- test-windows:
12
- name: Test on Ruby ${{ matrix.ruby }} Windows
13
- runs-on: windows-latest
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- ruby: [ '2.6', '2.5', '2.4' ]
18
- steps:
19
- - uses: actions/checkout@master
20
- - name: Use Ruby
21
- uses: actions/setup-ruby@v1
22
- with:
23
- ruby-version: ${{ matrix.ruby }}
24
- architecture: 'x64'
25
- - name: Install LibreOffice
26
- run: |
27
- choco install libreoffice-still
28
- echo "::add-path::C:\Program Files\LibreOffice\program"
29
- - name: Update gems
30
- shell: pwsh
31
- run: |
32
- gem install bundler
33
- bundle config --local path vendor/bundle
34
- bundle install --jobs 4 --retry 3
35
- - name: Run specs
36
- run: |
37
- bundle exec rake
data/Gemfile.lock DELETED
@@ -1,84 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- reverse_adoc (0.2.8)
5
- mathml2asciimath
6
- mimemagic
7
- nokogiri (>= 1.10.4)
8
- word-to-markdown
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- addressable (2.7.0)
14
- public_suffix (>= 2.0.2, < 5.0)
15
- byebug (11.1.1)
16
- cliver (0.3.2)
17
- codeclimate-test-reporter (1.0.7)
18
- simplecov
19
- css_parser (1.7.1)
20
- addressable
21
- descriptive_statistics (2.5.1)
22
- diff-lcs (1.3)
23
- docile (1.3.2)
24
- ffi (1.13.1)
25
- htmlentities (4.3.4)
26
- mathml2asciimath (0.0.10)
27
- htmlentities (~> 4.3.4)
28
- nokogiri (>= 1.10.4)
29
- mimemagic (0.3.5)
30
- mini_portile2 (2.4.0)
31
- nokogiri (1.10.9)
32
- mini_portile2 (~> 2.4.0)
33
- nokogiri-styles (0.1.2)
34
- nokogiri
35
- premailer (1.11.1)
36
- addressable
37
- css_parser (>= 1.6.0)
38
- htmlentities (>= 4.0.0)
39
- public_suffix (4.0.5)
40
- rake (13.0.1)
41
- redcarpet (3.5.0)
42
- reverse_markdown (1.4.0)
43
- nokogiri
44
- rspec (3.9.0)
45
- rspec-core (~> 3.9.0)
46
- rspec-expectations (~> 3.9.0)
47
- rspec-mocks (~> 3.9.0)
48
- rspec-core (3.9.1)
49
- rspec-support (~> 3.9.1)
50
- rspec-expectations (3.9.0)
51
- diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.9.0)
53
- rspec-mocks (3.9.1)
54
- diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.9.0)
56
- rspec-support (3.9.2)
57
- simplecov (0.18.5)
58
- docile (~> 1.1)
59
- simplecov-html (~> 0.11)
60
- simplecov-html (0.12.1)
61
- sys-proctable (1.2.5)
62
- ffi
63
- word-to-markdown (1.1.8)
64
- cliver (~> 0.3)
65
- descriptive_statistics (~> 2.5)
66
- nokogiri-styles (~> 0.1)
67
- premailer (~> 1.8)
68
- reverse_markdown (~> 1.0)
69
- sys-proctable (~> 1.0)
70
-
71
- PLATFORMS
72
- ruby
73
-
74
- DEPENDENCIES
75
- byebug
76
- codeclimate-test-reporter
77
- rake
78
- redcarpet
79
- reverse_adoc!
80
- rspec
81
- simplecov
82
-
83
- BUNDLED WITH
84
- 2.0.2
data/bin/reverse_adoc DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Usage: reverse_asciidoctor [FILE]...
3
- # Usage: cat FILE | reverse_asciidoctor
4
- require 'rubygems'
5
- require 'bundler/setup'
6
-
7
- require 'reverse_asciidoctor'
8
- require 'optparse'
9
- require 'fileutils'
10
-
11
- OptionParser.new do |opts|
12
- opts.banner = "Usage: reverse_adoc [options] <file>"
13
- opts.on('-m', '--mathml2asciimath', 'Convert MathML to AsciiMath') do |v|
14
- ReverseAsciidoctor.config.mathml2asciimath = true
15
- end
16
-
17
- opts.on('-oFILENAME', '--output=FILENAME', 'Output file to write to') do |v|
18
- ReverseAsciidoctor.config.destination = File.expand_path(v)
19
- # puts "output goes to #{ReverseAsciidoctor.config.destination}"
20
- end
21
-
22
- opts.on('-e', '--external-images', 'Export images if data URI') do |v|
23
- ReverseAsciidoctor.config.external_images = true
24
- end
25
-
26
- opts.on('-f', '--input_format [html, smrl_description]', 'Unknown input format (default: html)') do |v|
27
- ReverseAsciidoctor.config.input_format = v
28
- end
29
-
30
- opts.on('-u', '--unknown_tags [pass_through, drop, bypass, raise]', 'Unknown tag handling (default: pass_through)') do |v|
31
- ReverseAsciidoctor.config.unknown_tags = v
32
- end
33
-
34
- opts.on('-v', '--version', 'Version information') do |v|
35
- puts "reverse_adoc: v#{ReverseAsciidoctor::VERSION}"
36
- exit
37
- end
38
-
39
- opts.on("-h", "--help", "Prints this help") do
40
- puts opts
41
- exit
42
- end
43
-
44
- end.parse!
45
-
46
- if filename = ARGV.pop
47
- input_content = IO.read(filename)
48
- ReverseAsciidoctor.config.sourcedir = File.dirname(File.expand_path(filename))
49
- else
50
- if ReverseAsciidoctor.config.external_images
51
- raise "The -e | --external-images feature cannot be used with STDIN input. Exiting."
52
- end
53
-
54
- input_content = ARGF.read
55
- end
56
-
57
- if ReverseAsciidoctor.config.external_images && ReverseAsciidoctor.config.destination.nil?
58
- raise "The -e | --external-images feature must be used with -o | --output. Exiting."
59
- end
60
-
61
- # Read from STDIN
62
- adoc_content = ReverseAsciidoctor.convert(input_content)
63
-
64
- # Print to STDOUT
65
- unless ReverseAsciidoctor.config.destination
66
- puts adoc_content
67
- exit
68
- end
69
-
70
- # Write output to ReverseAsciidoctor.config.destination
71
- FileUtils.mkdir_p(File.dirname(ReverseAsciidoctor.config.destination))
72
- File.open(ReverseAsciidoctor.config.destination, "w") do |file|
73
- file.write(adoc_content)
74
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'digest'
4
- require 'nokogiri'
5
- require 'reverse_asciidoctor/version'
6
- require 'reverse_asciidoctor/errors'
7
- require 'reverse_asciidoctor/cleaner'
8
- require 'reverse_asciidoctor/config'
9
- require 'reverse_asciidoctor/converters'
10
- require 'reverse_asciidoctor/converters/base'
11
-
12
- module ReverseAsciidoctor
13
- def self.convert(input, options = {})
14
- type = config.input_format
15
- name = "#{type}_converter"
16
- require "reverse_asciidoctor/#{type}_converter"
17
- constant = name.split('_').map(&:capitalize).join.to_s
18
- ReverseAsciidoctor.const_get(constant).convert(input, options)
19
- end
20
-
21
- def self.config
22
- @config ||= Config.new
23
- yield @config if block_given?
24
- @config
25
- end
26
-
27
- def self.cleaner
28
- @cleaner ||= Cleaner.new
29
- end
30
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ReverseAsciidoctor
4
- module Converters
5
- class Example < Base
6
- def convert(node, state = {})
7
- <<~TEMPLATE
8
- [example]
9
- ====
10
- #{treat_children(node, state)}
11
- ====
12
- TEMPLATE
13
- end
14
- end
15
- register :example, Example.new
16
- end
17
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ReverseAsciidoctor
4
- module Converters
5
- class ExpressRef < Base
6
- def convert(node, _state = {})
7
- "express_ref:[#{node['linkend']}]"
8
- end
9
- end
10
- register :express_ref, ExpressRef.new
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ReverseAsciidoctor
4
- module Converters
5
- class ExtDescription < Base
6
- def convert(node, state = {})
7
- <<~TEMPLATE
8
- (*"#{node['linkend']}"
9
- #{treat_children(node, state)}
10
- *)
11
- TEMPLATE
12
- end
13
- end
14
- register :ext_description, ExtDescription.new
15
- end
16
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ReverseAsciidoctor
4
- module Converters
5
- class ExtDescriptions < Base
6
- def convert(node, state = {})
7
- treat_children(node, state)
8
- end
9
- end
10
- register :ext_descriptions, ExtDescriptions.new
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ReverseAsciidoctor
4
- module Converters
5
- class Note < Base
6
- def convert(node, state = {})
7
- <<~TEMPLATE
8
- [NOTE]
9
- --
10
- #{treat_children(node, state)}
11
- --
12
- TEMPLATE
13
- end
14
- end
15
- register :note, Note.new
16
- end
17
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'reverse_asciidoctor/converters/a'
4
- require 'reverse_asciidoctor/converters/aside'
5
- require 'reverse_asciidoctor/converters/audio'
6
- require 'reverse_asciidoctor/converters/blockquote'
7
- require 'reverse_asciidoctor/converters/br'
8
- require 'reverse_asciidoctor/converters/bypass'
9
- require 'reverse_asciidoctor/converters/code'
10
- require 'reverse_asciidoctor/converters/div'
11
- require 'reverse_asciidoctor/converters/drop'
12
- require 'reverse_asciidoctor/converters/em'
13
- require 'reverse_asciidoctor/converters/figure'
14
- require 'reverse_asciidoctor/converters/h'
15
- require 'reverse_asciidoctor/converters/head'
16
- require 'reverse_asciidoctor/converters/hr'
17
- require 'reverse_asciidoctor/converters/ignore'
18
- require 'reverse_asciidoctor/converters/img'
19
- require 'reverse_asciidoctor/converters/mark'
20
- require 'reverse_asciidoctor/converters/li'
21
- require 'reverse_asciidoctor/converters/ol'
22
- require 'reverse_asciidoctor/converters/p'
23
- require 'reverse_asciidoctor/converters/pass_through'
24
- require 'reverse_asciidoctor/converters/pre'
25
- require 'reverse_asciidoctor/converters/q'
26
- require 'reverse_asciidoctor/converters/strong'
27
- require 'reverse_asciidoctor/converters/sup'
28
- require 'reverse_asciidoctor/converters/sub'
29
- require 'reverse_asciidoctor/converters/table'
30
- require 'reverse_asciidoctor/converters/td'
31
- require 'reverse_asciidoctor/converters/th'
32
- require 'reverse_asciidoctor/converters/text'
33
- require 'reverse_asciidoctor/converters/tr'
34
- require 'reverse_asciidoctor/converters/video'
35
- require 'reverse_asciidoctor/converters/math'
36
-
37
- module ReverseAsciidoctor
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
- ReverseAsciidoctor.config.with(options) do
51
- result = ReverseAsciidoctor::Converters.lookup(root.name).convert(root)
52
- ReverseAsciidoctor.cleaner.tidy(result)
53
- end
54
- end
55
- end
56
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'reverse_asciidoctor/converters/a'
4
- require 'reverse_asciidoctor/converters/blockquote'
5
- require 'reverse_asciidoctor/converters/bypass'
6
- require 'reverse_asciidoctor/converters/br'
7
- require 'reverse_asciidoctor/converters/code'
8
- require 'reverse_asciidoctor/converters/drop'
9
- require 'reverse_asciidoctor/converters/em'
10
- require 'reverse_asciidoctor/converters/example'
11
- require 'reverse_asciidoctor/converters/ext_descriptions'
12
- require 'reverse_asciidoctor/converters/ext_description'
13
- require 'reverse_asciidoctor/converters/express_ref'
14
- require 'reverse_asciidoctor/converters/head'
15
- require 'reverse_asciidoctor/converters/hr'
16
- require 'reverse_asciidoctor/converters/ignore'
17
- require 'reverse_asciidoctor/converters/note'
18
- require 'reverse_asciidoctor/converters/p'
19
- require 'reverse_asciidoctor/converters/pass_through'
20
- require 'reverse_asciidoctor/converters/q'
21
- require 'reverse_asciidoctor/converters/strong'
22
- require 'reverse_asciidoctor/converters/sup'
23
- require 'reverse_asciidoctor/converters/sub'
24
- require 'reverse_asciidoctor/converters/text'
25
-
26
- module ReverseAsciidoctor
27
- class SmrlDescriptionConverter
28
- def self.convert(input, options = {})
29
- root = if input.is_a?(String)
30
- then Nokogiri::XML(input).root
31
- elsif input.is_a?(Nokogiri::XML::Document)
32
- then input.root
33
- elsif input.is_a?(Nokogiri::XML::Node)
34
- then input
35
- end
36
-
37
- root || (return '')
38
-
39
- ReverseAsciidoctor.config.with(options) do
40
- result = ReverseAsciidoctor::Converters.lookup(root.name).convert(root)
41
- ReverseAsciidoctor.cleaner.tidy(result)
42
- end
43
- end
44
- end
45
- end