reverse_adoc 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 906cadff19bcc530a5aa527f3a7cb87bd80050163638ce87d052d3615e82c68d
4
- data.tar.gz: ffaf10410be78e4971c80a7c45c946aa4d4803546102b90c0c5bc01342dd962d
3
+ metadata.gz: abd0bf0dce3d437c176a1c3486d565fedd235d4b4e58cfdb4259188a1a94e090
4
+ data.tar.gz: '08926fcde9721aecc4672ac81c1dce18bf750763fe60621f57eb4cc32605eb70'
5
5
  SHA512:
6
- metadata.gz: 1436a34f5bd46e9c73d41028562f9edd78970bc5c88acf3cf815c6b76975c228045266c32e6cbc63ffcef3fc9d05101f51de446476f10ace57d565cc306d8629
7
- data.tar.gz: 78e5514b5d5e01e5407d12644db5deda0d73e9d62f274932a2dee50de098dd65e36ddd96ef0a523726ec1915d80e42ab847d6227e8d927b5a85e229f53aaff86
6
+ metadata.gz: 39bf9ee3868bbb02440e2d853839a267f4c385e84204aedaeabe1000a7fa3fdc3f9e6baf381025548633b02b5c9e8f7d87925044c3ec992ca1eca2b83e7722b6
7
+ data.tar.gz: 5c34f9d71fa904a05c2e726b627d944f61a09f08e50ff587a102cc6e42c107600e08ad4b583fb5c9a07d678c09f06bc86fe25c15b94ae2dbefa0f29d046796bf
@@ -33,6 +33,9 @@ jobs:
33
33
  run: |
34
34
  sudo gem install bundler --force
35
35
  bundle install --jobs 4 --retry 3
36
+ - name: Install LibreOffice
37
+ run: |
38
+ brew cask install libreoffice
36
39
  - name: Run specs
37
40
  run: |
38
41
  bundle exec rake
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reverse_adoc (0.2.8)
4
+ reverse_adoc (0.2.10)
5
5
  mathml2asciimath
6
6
  mimemagic
7
7
  nokogiri (>= 1.10.4)
8
+ premailer (~> 1.11.0)
8
9
  word-to-markdown
9
10
 
10
11
  GEM
@@ -28,7 +29,7 @@ GEM
28
29
  nokogiri (>= 1.10.4)
29
30
  mimemagic (0.3.5)
30
31
  mini_portile2 (2.4.0)
31
- nokogiri (1.10.9)
32
+ nokogiri (1.10.10)
32
33
  mini_portile2 (~> 2.4.0)
33
34
  nokogiri-styles (0.1.2)
34
35
  nokogiri
@@ -36,7 +37,7 @@ GEM
36
37
  addressable
37
38
  css_parser (>= 1.6.0)
38
39
  htmlentities (>= 4.0.0)
39
- public_suffix (4.0.5)
40
+ public_suffix (4.0.6)
40
41
  rake (13.0.1)
41
42
  redcarpet (3.5.0)
42
43
  reverse_markdown (1.4.0)
@@ -58,7 +59,7 @@ GEM
58
59
  docile (~> 1.1)
59
60
  simplecov-html (~> 0.11)
60
61
  simplecov-html (0.12.1)
61
- sys-proctable (1.2.5)
62
+ sys-proctable (1.2.6)
62
63
  ffi
63
64
  word-to-markdown (1.1.8)
64
65
  cliver (~> 0.3)
@@ -44,31 +44,6 @@ $ reverse_adoc file.html > file.adoc
44
44
  $ cat file.html | reverse_adoc > file.adoc
45
45
  ----
46
46
 
47
- === XML smrl description to AsciiDoc: `reverse_adoc`
48
-
49
- Convert XML smrl description files to AsciiDoc:
50
-
51
- [source,console]
52
- ----
53
- $ reverse_adoc -f smrl_description descriptions.xml > file.adoc
54
- $ cat descriptions.xml | reverse_adoc -f smrl_description > file.adoc
55
- ----
56
-
57
- [source,console]
58
- ----
59
- $ reverse_adoc -h
60
- Usage: reverse_adoc [options] <file>
61
- -f, --input_format Supply input format to choose converter(html or smrl_description)
62
- -m, --mathml2asciimath Convert MathML to AsciiMath
63
- -o, --output=FILENAME Output file to write to
64
- -e, --external-images Export images if data URI
65
- -u [pass_through, drop, bypass, raise],
66
- --unknown_tags Unknown tag handling (default: pass_through)
67
- -v, --version Version information
68
- -h, --help Prints this help
69
- ----
70
-
71
-
72
47
 
73
48
  === Microsoft Word to AsciiDoc: `w2a`
74
49
 
@@ -23,10 +23,6 @@ OptionParser.new do |opts|
23
23
  ReverseAdoc.config.external_images = true
24
24
  end
25
25
 
26
- opts.on('-f', '--input_format [html, smrl_description]', 'Unknown input format (default: html)') do |v|
27
- ReverseAdoc.config.input_format = v
28
- end
29
-
30
26
  opts.on('-u', '--unknown_tags [pass_through, drop, bypass, raise]', 'Unknown tag handling (default: pass_through)') do |v|
31
27
  ReverseAdoc.config.unknown_tags = v
32
28
  end
@@ -8,14 +8,11 @@ require 'reverse_adoc/cleaner'
8
8
  require 'reverse_adoc/config'
9
9
  require 'reverse_adoc/converters'
10
10
  require 'reverse_adoc/converters/base'
11
+ require "reverse_adoc/html_converter"
11
12
 
12
13
  module ReverseAdoc
13
14
  def self.convert(input, options = {})
14
- type = config.input_format
15
- name = "#{type}_converter"
16
- require "reverse_adoc/#{type}_converter"
17
- constant = name.split('_').map(&:capitalize).join.to_s
18
- ReverseAdoc.const_get(constant).convert(input, options)
15
+ ReverseAdoc::HtmlConverter.convert(input, options)
19
16
  end
20
17
 
21
18
  def self.config
@@ -1,3 +1,3 @@
1
1
  module ReverseAdoc
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.10'
3
3
  end
@@ -33,4 +33,5 @@ Gem::Specification.new do |s|
33
33
 
34
34
  # All the following are for bin/w2m
35
35
  s.add_dependency 'word-to-markdown'
36
+ s.add_dependency 'premailer', '~> 1.11.0'
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reverse_adoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-06 00:00:00.000000000 Z
11
+ date: 2020-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: premailer
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.11.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.11.0
139
153
  description: Generate AsciiDoc from HTML and Microsoft Word via CLI or library.
140
154
  email:
141
155
  - open.source@ribose.com
@@ -172,10 +186,6 @@ files:
172
186
  - lib/reverse_adoc/converters/div.rb
173
187
  - lib/reverse_adoc/converters/drop.rb
174
188
  - lib/reverse_adoc/converters/em.rb
175
- - lib/reverse_adoc/converters/example.rb
176
- - lib/reverse_adoc/converters/express_ref.rb
177
- - lib/reverse_adoc/converters/ext_description.rb
178
- - lib/reverse_adoc/converters/ext_descriptions.rb
179
189
  - lib/reverse_adoc/converters/figure.rb
180
190
  - lib/reverse_adoc/converters/h.rb
181
191
  - lib/reverse_adoc/converters/head.rb
@@ -185,7 +195,6 @@ files:
185
195
  - lib/reverse_adoc/converters/li.rb
186
196
  - lib/reverse_adoc/converters/mark.rb
187
197
  - lib/reverse_adoc/converters/math.rb
188
- - lib/reverse_adoc/converters/note.rb
189
198
  - lib/reverse_adoc/converters/ol.rb
190
199
  - lib/reverse_adoc/converters/p.rb
191
200
  - lib/reverse_adoc/converters/pass_through.rb
@@ -202,7 +211,6 @@ files:
202
211
  - lib/reverse_adoc/converters/video.rb
203
212
  - lib/reverse_adoc/errors.rb
204
213
  - lib/reverse_adoc/html_converter.rb
205
- - lib/reverse_adoc/smrl_description_converter.rb
206
214
  - lib/reverse_adoc/version.rb
207
215
  - reverse_adoc.gemspec
208
216
  - spec/assets/anchors.html
@@ -242,15 +250,10 @@ files:
242
250
  - spec/lib/reverse_adoc/converters/br_spec.rb
243
251
  - spec/lib/reverse_adoc/converters/code_spec.rb
244
252
  - spec/lib/reverse_adoc/converters/div_spec.rb
245
- - spec/lib/reverse_adoc/converters/example_spec.rb
246
- - spec/lib/reverse_adoc/converters/express_ref_spec.rb
247
- - spec/lib/reverse_adoc/converters/ext_description_spec.rb
248
- - spec/lib/reverse_adoc/converters/ext_descriptions_spec.rb
249
253
  - spec/lib/reverse_adoc/converters/figure_spec.rb
250
254
  - spec/lib/reverse_adoc/converters/img_spec.rb
251
255
  - spec/lib/reverse_adoc/converters/li_spec.rb
252
256
  - spec/lib/reverse_adoc/converters/mark_spec.rb
253
- - spec/lib/reverse_adoc/converters/note_spec.rb
254
257
  - spec/lib/reverse_adoc/converters/p_spec.rb
255
258
  - spec/lib/reverse_adoc/converters/pre_spec.rb
256
259
  - spec/lib/reverse_adoc/converters/q_spec.rb
@@ -264,7 +267,7 @@ homepage: http://github.com/metanorma/reverse_adoc
264
267
  licenses:
265
268
  - BSD-2-Clause
266
269
  metadata: {}
267
- post_install_message:
270
+ post_install_message:
268
271
  rdoc_options: []
269
272
  require_paths:
270
273
  - lib
@@ -279,8 +282,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
282
  - !ruby/object:Gem::Version
280
283
  version: '0'
281
284
  requirements: []
282
- rubygems_version: 3.0.3
283
- signing_key:
285
+ rubygems_version: 3.0.6
286
+ signing_key:
284
287
  specification_version: 4
285
288
  summary: Generate AsciiDoc from HTML and Microsoft Word via CLI or library.
286
289
  test_files:
@@ -321,15 +324,10 @@ test_files:
321
324
  - spec/lib/reverse_adoc/converters/br_spec.rb
322
325
  - spec/lib/reverse_adoc/converters/code_spec.rb
323
326
  - spec/lib/reverse_adoc/converters/div_spec.rb
324
- - spec/lib/reverse_adoc/converters/example_spec.rb
325
- - spec/lib/reverse_adoc/converters/express_ref_spec.rb
326
- - spec/lib/reverse_adoc/converters/ext_description_spec.rb
327
- - spec/lib/reverse_adoc/converters/ext_descriptions_spec.rb
328
327
  - spec/lib/reverse_adoc/converters/figure_spec.rb
329
328
  - spec/lib/reverse_adoc/converters/img_spec.rb
330
329
  - spec/lib/reverse_adoc/converters/li_spec.rb
331
330
  - spec/lib/reverse_adoc/converters/mark_spec.rb
332
- - spec/lib/reverse_adoc/converters/note_spec.rb
333
331
  - spec/lib/reverse_adoc/converters/p_spec.rb
334
332
  - spec/lib/reverse_adoc/converters/pre_spec.rb
335
333
  - spec/lib/reverse_adoc/converters/q_spec.rb
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ReverseAdoc
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 ReverseAdoc
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 ReverseAdoc
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 ReverseAdoc
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 ReverseAdoc
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,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'reverse_adoc/converters/a'
4
- require 'reverse_adoc/converters/blockquote'
5
- require 'reverse_adoc/converters/bypass'
6
- require 'reverse_adoc/converters/br'
7
- require 'reverse_adoc/converters/code'
8
- require 'reverse_adoc/converters/drop'
9
- require 'reverse_adoc/converters/em'
10
- require 'reverse_adoc/converters/example'
11
- require 'reverse_adoc/converters/ext_descriptions'
12
- require 'reverse_adoc/converters/ext_description'
13
- require 'reverse_adoc/converters/express_ref'
14
- require 'reverse_adoc/converters/head'
15
- require 'reverse_adoc/converters/hr'
16
- require 'reverse_adoc/converters/ignore'
17
- require 'reverse_adoc/converters/note'
18
- require 'reverse_adoc/converters/p'
19
- require 'reverse_adoc/converters/pass_through'
20
- require 'reverse_adoc/converters/q'
21
- require 'reverse_adoc/converters/strong'
22
- require 'reverse_adoc/converters/sup'
23
- require 'reverse_adoc/converters/sub'
24
- require 'reverse_adoc/converters/text'
25
-
26
- module ReverseAdoc
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
- ReverseAdoc.config.with(options) do
40
- result = ReverseAdoc::Converters.lookup(root.name).convert(root)
41
- ReverseAdoc.cleaner.tidy(result)
42
- end
43
- end
44
- end
45
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'reverse_adoc/converters/example'
5
-
6
- describe ReverseAdoc::Converters::Example do
7
- let(:converter) { described_class.new }
8
- let(:output) do
9
- <<~TEXT
10
- [example]
11
- ====
12
- foo
13
-
14
- ====
15
- TEXT
16
- end
17
-
18
- it 'converts example` children' do
19
- input = node_for('<example><li>foo</li></example>')
20
- expect(converter.convert(input)).to eq(output)
21
- end
22
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'reverse_adoc/converters/express_ref'
5
-
6
- describe ReverseAdoc::Converters::ExpressRef do
7
- let(:converter) { described_class.new }
8
- let(:schema) { 'schema' }
9
-
10
- it 'converts supplied tag by format' do
11
- input = node_for("<express_ref linkend='#{schema}' />")
12
- expect(converter.convert(input)).to eq("express_ref:[#{schema}]")
13
- end
14
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'reverse_adoc/converters/ext_description'
5
-
6
- describe ReverseAdoc::Converters::ExtDescription do
7
- let(:converter) { described_class.new }
8
- let(:schema) { 'schema' }
9
-
10
- it 'takes ext_description linkend attribute' do
11
- input = node_for("<ext_description linkend='#{schema}'></ext_description>")
12
- expect(converter.convert(input)).to include(%{(*"#{schema}"})
13
- end
14
-
15
- it 'converts html children' do
16
- input = node_for(
17
- "<ext_description linkend='#{schema}'><li>foo</li></ext_description>")
18
- expect(converter.convert(input)).to include(" foo\n")
19
- end
20
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'reverse_adoc/converters/ext_descriptions'
5
-
6
- describe ReverseAdoc::Converters::ExtDescriptions do
7
- let(:converter) { described_class.new }
8
-
9
- it 'converts ext_descriptions children' do
10
- input = node_for('<ext_descriptions><li>foo</li></ext_descriptions>')
11
- expect(converter.convert(input)).to eq " foo\n"
12
- end
13
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'reverse_adoc/converters/note'
5
-
6
- describe ReverseAdoc::Converters::Note do
7
- let(:converter) { described_class.new }
8
- let(:output) do
9
- <<~TEXT
10
- [NOTE]
11
- --
12
- foo
13
-
14
- --
15
- TEXT
16
- end
17
-
18
- it 'converts note` children' do
19
- input = node_for('<note><li>foo</li></note>')
20
- expect(converter.convert(input)).to eq(output)
21
- end
22
- end