reverse_adoc 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -1
  3. data/.github/workflows/ubuntu.yml +8 -1
  4. data/.github/workflows/windows.yml +8 -1
  5. data/Gemfile +1 -1
  6. data/README.adoc +5 -5
  7. data/Rakefile +1 -1
  8. data/bin/reverse_adoc +18 -18
  9. data/bin/w2a +15 -15
  10. data/lib/{reverse_asciidoctor.rb → reverse_adoc.rb} +9 -9
  11. data/lib/{reverse_asciidoctor → reverse_adoc}/cleaner.rb +4 -4
  12. data/lib/{reverse_asciidoctor → reverse_adoc}/config.rb +1 -1
  13. data/lib/{reverse_asciidoctor → reverse_adoc}/converters.rb +6 -6
  14. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/a.rb +1 -1
  15. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/aside.rb +1 -1
  16. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/audio.rb +1 -1
  17. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/base.rb +2 -2
  18. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/blockquote.rb +2 -2
  19. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/br.rb +1 -1
  20. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/bypass.rb +1 -1
  21. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/code.rb +1 -1
  22. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/div.rb +1 -1
  23. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/drop.rb +1 -1
  24. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/em.rb +1 -1
  25. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/example.rb +1 -1
  26. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/express_ref.rb +1 -1
  27. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ext_description.rb +1 -1
  28. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ext_descriptions.rb +1 -1
  29. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/figure.rb +1 -1
  30. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/h.rb +1 -1
  31. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/head.rb +1 -1
  32. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/hr.rb +1 -1
  33. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ignore.rb +1 -1
  34. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/img.rb +7 -7
  35. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/li.rb +1 -1
  36. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/mark.rb +1 -1
  37. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/math.rb +3 -3
  38. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/note.rb +1 -1
  39. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ol.rb +1 -1
  40. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/p.rb +1 -1
  41. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/pass_through.rb +1 -1
  42. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/pre.rb +1 -1
  43. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/q.rb +1 -1
  44. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/strong.rb +1 -1
  45. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/sub.rb +1 -1
  46. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/sup.rb +1 -1
  47. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/table.rb +1 -1
  48. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/td.rb +1 -1
  49. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/text.rb +1 -1
  50. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/th.rb +1 -1
  51. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/tr.rb +1 -1
  52. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/video.rb +1 -1
  53. data/lib/{reverse_asciidoctor → reverse_adoc}/errors.rb +1 -1
  54. data/lib/reverse_adoc/html_converter.rb +56 -0
  55. data/lib/reverse_adoc/smrl_description_converter.rb +45 -0
  56. data/lib/reverse_adoc/version.rb +3 -0
  57. data/reverse_adoc.gemspec +2 -2
  58. data/spec/components/anchors_spec.rb +2 -2
  59. data/spec/components/basic_spec.rb +2 -2
  60. data/spec/components/code_spec.rb +4 -4
  61. data/spec/components/escapables_spec.rb +2 -2
  62. data/spec/components/from_the_wild_spec.rb +2 -2
  63. data/spec/components/html_fragment_spec.rb +2 -2
  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 -9
  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 -2
  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 -2
  77. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/div_spec.rb +2 -2
  78. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/example_spec.rb +2 -2
  79. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/express_ref_spec.rb +2 -2
  80. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/ext_description_spec.rb +2 -2
  81. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/ext_descriptions_spec.rb +2 -2
  82. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/figure_spec.rb +2 -2
  83. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/img_spec.rb +2 -2
  84. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/li_spec.rb +2 -2
  85. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/mark_spec.rb +2 -2
  86. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/note_spec.rb +2 -2
  87. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/p_spec.rb +2 -2
  88. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/pre_spec.rb +2 -2
  89. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/q_spec.rb +2 -2
  90. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/strong_spec.rb +2 -2
  91. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/text_spec.rb +2 -2
  92. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/video_spec.rb +2 -2
  93. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters_spec.rb +5 -5
  94. data/spec/spec_helper.rb +3 -3
  95. metadata +100 -100
  96. data/lib/reverse_asciidoctor/html_converter.rb +0 -56
  97. data/lib/reverse_asciidoctor/smrl_description_converter.rb +0 -45
  98. data/lib/reverse_asciidoctor/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb34effa1c1af2e72ef8df7b6b1553c7c2574bcca9608e02cfaf561ed8a2bfec
4
- data.tar.gz: e18b3b9cf2d936a48fdf2e6d5f265aa5c945c9493bd232a4d8fb311df780e81f
3
+ metadata.gz: 906cadff19bcc530a5aa527f3a7cb87bd80050163638ce87d052d3615e82c68d
4
+ data.tar.gz: ffaf10410be78e4971c80a7c45c946aa4d4803546102b90c0c5bc01342dd962d
5
5
  SHA512:
6
- metadata.gz: ca8454b96ad3064c16018f09198f8450f9a15e6525c1df6e63b7a0e3dd3254f66f2bee56e69e8c7088087962911480513f3608c759f955489b2e602dc2251890
7
- data.tar.gz: 49c2198645f22b9ac26ea78aa36e1073a27807dca8364ad076250dccfc6b307055775894962d70d6400d7c8ec6b3dfa02cb31c84c922c60d8c18cbbf5ee55171
6
+ metadata.gz: 1436a34f5bd46e9c73d41028562f9edd78970bc5c88acf3cf815c6b76975c228045266c32e6cbc63ffcef3fc9d05101f51de446476f10ace57d565cc306d8629
7
+ data.tar.gz: 78e5514b5d5e01e5407d12644db5deda0d73e9d62f274932a2dee50de098dd65e36ddd96ef0a523726ec1915d80e42ab847d6227e8d927b5a85e229f53aaff86
@@ -6,22 +6,29 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/ubuntu.yml
11
+ - .github/workflows/windows.yml
9
12
 
10
13
  jobs:
11
14
  test-macos:
12
15
  name: Test on Ruby ${{ matrix.ruby }} macOS
13
16
  runs-on: macos-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
21
29
  uses: actions/setup-ruby@v1
22
30
  with:
23
31
  ruby-version: ${{ matrix.ruby }}
24
- architecture: 'x64'
25
32
  - name: Update gems
26
33
  run: |
27
34
  sudo gem install bundler --force
@@ -6,22 +6,29 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/windows.yml
9
12
 
10
13
  jobs:
11
14
  test-linux:
12
15
  name: Test on Ruby ${{ matrix.ruby }} Ubuntu
13
16
  runs-on: ubuntu-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
21
29
  uses: actions/setup-ruby@v1
22
30
  with:
23
31
  ruby-version: ${{ matrix.ruby }}
24
- architecture: 'x64'
25
32
  - name: Install LibreOffice
26
33
  run: sudo apt-get -y --no-install-recommends install libreoffice
27
34
  - name: Update gems
@@ -6,22 +6,29 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/ubuntu.yml
9
12
 
10
13
  jobs:
11
14
  test-windows:
12
15
  name: Test on Ruby ${{ matrix.ruby }} Windows
13
16
  runs-on: windows-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
21
29
  uses: actions/setup-ruby@v1
22
30
  with:
23
31
  ruby-version: ${{ matrix.ruby }}
24
- architecture: 'x64'
25
32
  - name: Install LibreOffice
26
33
  run: |
27
34
  choco install libreoffice-still
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
- # Specify your gem's dependencies in reverse_asciidoctor.gemspec
5
+ # Specify your gem's dependencies in reverse_adoc.gemspec
6
6
  gemspec
7
7
 
8
8
  gem "byebug"
@@ -247,7 +247,7 @@ The gem does not support:
247
247
  === MathML support
248
248
 
249
249
  If you are using this gem in the context of https://www.metanorma.com[Metanorma],
250
- Metanorma Asciidoctor accepts MathML as a native mathematical format. So you do not need
250
+ Metanorma AsciiDoc accepts MathML as a native mathematical format. So you do not need
251
251
  to convert the MathML to AsciiMath.
252
252
 
253
253
  The gem will optionally invoke the https://github.com/metanorma/mathml2asciimath
@@ -265,7 +265,7 @@ uses the output) as such; so this is still much better than nothing for stem pro
265
265
 
266
266
  === Word cleanup
267
267
 
268
- This gem is routinely used in the Metanorma project to export Word documents to Asciidoctor.
268
+ This gem is routinely used in the Metanorma project to export Word documents to AsciiDoc.
269
269
  The HTML export from Word that the gem uses, from LibreOffice, is much cleaner than the
270
270
  native HTML 4 export from Word; but it has some infelicities which this gem cleans up:
271
271
 
@@ -284,7 +284,7 @@ Simple to use.
284
284
 
285
285
  [source,ruby]
286
286
  ----
287
- result = ReverseAsciidoctor.convert input
287
+ result = ReverseAdoc.convert input
288
288
  result.inspect # " *feelings* "
289
289
  ----
290
290
 
@@ -294,7 +294,7 @@ Just pass your chosen configuration options in after the input. The given option
294
294
 
295
295
  [source,ruby]
296
296
  ----
297
- ReverseAsciidoctor.convert(input, unknown_tags: :raise, mathml2asciimath: true)
297
+ ReverseAdoc.convert(input, unknown_tags: :raise, mathml2asciimath: true)
298
298
  ----
299
299
 
300
300
 
@@ -304,7 +304,7 @@ Or configure it block style on a initializer level. These configurations will la
304
304
 
305
305
  [source,ruby]
306
306
  ----
307
- ReverseAsciidoctor.config do |config|
307
+ ReverseAdoc.config do |config|
308
308
  config.unknown_tags = :bypass
309
309
  config.mathml2asciimath = true
310
310
  config.tag_border = ''
data/Rakefile CHANGED
@@ -10,5 +10,5 @@ task :default => :spec
10
10
 
11
11
  desc 'Open an irb session preloaded with this library'
12
12
  task :console do
13
- sh 'irb -rubygems -I lib -r reverse_asciidoctor.rb'
13
+ sh 'irb -rubygems -I lib -r reverse_adoc.rb'
14
14
  end
@@ -1,38 +1,38 @@
1
1
  #!/usr/bin/env ruby
2
- # Usage: reverse_asciidoctor [FILE]...
3
- # Usage: cat FILE | reverse_asciidoctor
2
+ # Usage: reverse_adoc [FILE]...
3
+ # Usage: cat FILE | reverse_adoc
4
4
  require 'rubygems'
5
5
  require 'bundler/setup'
6
6
 
7
- require 'reverse_asciidoctor'
7
+ require 'reverse_adoc'
8
8
  require 'optparse'
9
9
  require 'fileutils'
10
10
 
11
11
  OptionParser.new do |opts|
12
12
  opts.banner = "Usage: reverse_adoc [options] <file>"
13
13
  opts.on('-m', '--mathml2asciimath', 'Convert MathML to AsciiMath') do |v|
14
- ReverseAsciidoctor.config.mathml2asciimath = true
14
+ ReverseAdoc.config.mathml2asciimath = true
15
15
  end
16
16
 
17
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}"
18
+ ReverseAdoc.config.destination = File.expand_path(v)
19
+ # puts "output goes to #{ReverseAdoc.config.destination}"
20
20
  end
21
21
 
22
22
  opts.on('-e', '--external-images', 'Export images if data URI') do |v|
23
- ReverseAsciidoctor.config.external_images = true
23
+ ReverseAdoc.config.external_images = true
24
24
  end
25
25
 
26
26
  opts.on('-f', '--input_format [html, smrl_description]', 'Unknown input format (default: html)') do |v|
27
- ReverseAsciidoctor.config.input_format = v
27
+ ReverseAdoc.config.input_format = v
28
28
  end
29
29
 
30
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
31
+ ReverseAdoc.config.unknown_tags = v
32
32
  end
33
33
 
34
34
  opts.on('-v', '--version', 'Version information') do |v|
35
- puts "reverse_adoc: v#{ReverseAsciidoctor::VERSION}"
35
+ puts "reverse_adoc: v#{ReverseAdoc::VERSION}"
36
36
  exit
37
37
  end
38
38
 
@@ -45,30 +45,30 @@ end.parse!
45
45
 
46
46
  if filename = ARGV.pop
47
47
  input_content = IO.read(filename)
48
- ReverseAsciidoctor.config.sourcedir = File.dirname(File.expand_path(filename))
48
+ ReverseAdoc.config.sourcedir = File.dirname(File.expand_path(filename))
49
49
  else
50
- if ReverseAsciidoctor.config.external_images
50
+ if ReverseAdoc.config.external_images
51
51
  raise "The -e | --external-images feature cannot be used with STDIN input. Exiting."
52
52
  end
53
53
 
54
54
  input_content = ARGF.read
55
55
  end
56
56
 
57
- if ReverseAsciidoctor.config.external_images && ReverseAsciidoctor.config.destination.nil?
57
+ if ReverseAdoc.config.external_images && ReverseAdoc.config.destination.nil?
58
58
  raise "The -e | --external-images feature must be used with -o | --output. Exiting."
59
59
  end
60
60
 
61
61
  # Read from STDIN
62
- adoc_content = ReverseAsciidoctor.convert(input_content)
62
+ adoc_content = ReverseAdoc.convert(input_content)
63
63
 
64
64
  # Print to STDOUT
65
- unless ReverseAsciidoctor.config.destination
65
+ unless ReverseAdoc.config.destination
66
66
  puts adoc_content
67
67
  exit
68
68
  end
69
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|
70
+ # Write output to ReverseAdoc.config.destination
71
+ FileUtils.mkdir_p(File.dirname(ReverseAdoc.config.destination))
72
+ File.open(ReverseAdoc.config.destination, "w") do |file|
73
73
  file.write(adoc_content)
74
74
  end
data/bin/w2a CHANGED
@@ -6,27 +6,27 @@ require 'bundler/setup'
6
6
 
7
7
  require 'word-to-markdown'
8
8
  require 'optparse'
9
- require 'reverse_asciidoctor'
9
+ require 'reverse_adoc'
10
10
 
11
11
  ARGV.push('-h') if ARGV.empty?
12
12
 
13
13
  OptionParser.new do |opts|
14
14
  opts.banner = "Usage: w2a [options] <file>"
15
15
  opts.on('-m', '--mathml2asciimath', 'Convert MathML to AsciiMath') do |v|
16
- ReverseAsciidoctor.config.mathml2asciimath = true
16
+ ReverseAdoc.config.mathml2asciimath = true
17
17
  end
18
18
 
19
19
  opts.on('-oFILENAME', '--output=FILENAME', 'Output file to write to') do |v|
20
- ReverseAsciidoctor.config.destination = File.expand_path(v)
21
- # puts "output goes to #{ReverseAsciidoctor.config.destination}"
20
+ ReverseAdoc.config.destination = File.expand_path(v)
21
+ # puts "output goes to #{ReverseAdoc.config.destination}"
22
22
  end
23
23
 
24
24
  opts.on('-e', '--external-images', 'Export images if data URI') do |v|
25
- ReverseAsciidoctor.config.external_images = true
25
+ ReverseAdoc.config.external_images = true
26
26
  end
27
27
 
28
28
  opts.on('-v', '--version', 'Version information') do |v|
29
- puts "reverse_adoc: v#{ReverseAsciidoctor::VERSION}"
29
+ puts "reverse_adoc: v#{ReverseAdoc::VERSION}"
30
30
  puts "[dependency] WordToMarkdown: v#{WordToMarkdown::VERSION}"
31
31
  unless Gem.win_platform?
32
32
  puts "[dependency] LibreOffice: v#{WordToMarkdown.soffice.version}"
@@ -46,28 +46,28 @@ end.parse!
46
46
  filename = ARGV.pop
47
47
  raise "Please provide an input file to process. Exiting." unless filename
48
48
 
49
- if ReverseAsciidoctor.config.external_images && ReverseAsciidoctor.config.destination.nil?
49
+ if ReverseAdoc.config.external_images && ReverseAdoc.config.destination.nil?
50
50
  raise "The -e | --external-images feature must be used with -o | --output. Exiting."
51
51
  end
52
52
 
53
- ReverseAsciidoctor.config.sourcedir = Dir.mktmpdir
53
+ ReverseAdoc.config.sourcedir = Dir.mktmpdir
54
54
 
55
- doc = WordToMarkdown.new(filename, ReverseAsciidoctor.config.sourcedir)
55
+ doc = WordToMarkdown.new(filename, ReverseAdoc.config.sourcedir)
56
56
  #File.open("test.html", "w:UTF-8") { |f| f.write doc.document.html }
57
- adoc_content = ReverseAsciidoctor.convert(
58
- ReverseAsciidoctor.cleaner.preprocess_word_html(doc.document.html),
57
+ adoc_content = ReverseAdoc.convert(
58
+ ReverseAdoc.cleaner.preprocess_word_html(doc.document.html),
59
59
  WordToMarkdown::REVERSE_MARKDOWN_OPTIONS
60
60
  )
61
61
  # puts scrub_whitespace(doc.document.html)
62
62
 
63
63
  # Print to STDOUT
64
- unless ReverseAsciidoctor.config.destination
64
+ unless ReverseAdoc.config.destination
65
65
  puts adoc_content
66
66
  exit
67
67
  end
68
68
 
69
- # Write output to ReverseAsciidoctor.config.destination
70
- FileUtils.mkdir_p(File.dirname(ReverseAsciidoctor.config.destination))
71
- File.open(ReverseAsciidoctor.config.destination, "w") do |file|
69
+ # Write output to ReverseAdoc.config.destination
70
+ FileUtils.mkdir_p(File.dirname(ReverseAdoc.config.destination))
71
+ File.open(ReverseAdoc.config.destination, "w") do |file|
72
72
  file.write(adoc_content)
73
73
  end
@@ -2,20 +2,20 @@
2
2
 
3
3
  require 'digest'
4
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'
5
+ require 'reverse_adoc/version'
6
+ require 'reverse_adoc/errors'
7
+ require 'reverse_adoc/cleaner'
8
+ require 'reverse_adoc/config'
9
+ require 'reverse_adoc/converters'
10
+ require 'reverse_adoc/converters/base'
11
11
 
12
- module ReverseAsciidoctor
12
+ module ReverseAdoc
13
13
  def self.convert(input, options = {})
14
14
  type = config.input_format
15
15
  name = "#{type}_converter"
16
- require "reverse_asciidoctor/#{type}_converter"
16
+ require "reverse_adoc/#{type}_converter"
17
17
  constant = name.split('_').map(&:capitalize).join.to_s
18
- ReverseAsciidoctor.const_get(constant).convert(input, options)
18
+ ReverseAdoc.const_get(constant).convert(input, options)
19
19
  end
20
20
 
21
21
  def self.config
@@ -1,4 +1,4 @@
1
- module ReverseAsciidoctor
1
+ module ReverseAdoc
2
2
  class Cleaner
3
3
 
4
4
  def tidy(string)
@@ -36,19 +36,19 @@ module ReverseAsciidoctor
36
36
  # Same for underscores and brackets.
37
37
  def clean_tag_borders(string)
38
38
  result = string.gsub(/\s?\*{2,}.*?\*{2,}\s?/) do |match|
39
- preserve_border_whitespaces(match, default_border: ReverseAsciidoctor.config.tag_border) do
39
+ preserve_border_whitespaces(match, default_border: ReverseAdoc.config.tag_border) do
40
40
  match.strip.sub('** ', '**').sub(' **', '**')
41
41
  end
42
42
  end
43
43
 
44
44
  result = result.gsub(/\s?\_{2,}.*?\_{2,}\s?/) do |match|
45
- preserve_border_whitespaces(match, default_border: ReverseAsciidoctor.config.tag_border) do
45
+ preserve_border_whitespaces(match, default_border: ReverseAdoc.config.tag_border) do
46
46
  match.strip.sub('__ ', '__').sub(' __', '__')
47
47
  end
48
48
  end
49
49
 
50
50
  result = result.gsub(/\s?~{2,}.*?~{2,}\s?/) do |match|
51
- preserve_border_whitespaces(match, default_border: ReverseAsciidoctor.config.tag_border) do
51
+ preserve_border_whitespaces(match, default_border: ReverseAdoc.config.tag_border) do
52
52
  match.strip.sub('~~ ', '~~').sub(' ~~', '~~')
53
53
  end
54
54
  end
@@ -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 = {})