pandoc-ruby 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 02f0af2a61483032f01e2d07de58a08bb63625a9
4
- data.tar.gz: 84fcc719beb7c3ec49ec3d5b6411ab8e74a2ff84
2
+ SHA256:
3
+ metadata.gz: cbbaf2248f0a6fa408258b8d8a49c19f78e2688a81ee5000f8c23f4d0eb1bebc
4
+ data.tar.gz: b819cb5b8406a798a6dcc6a7c472e34ff286e4882edbb076d72482a6202ceba6
5
5
  SHA512:
6
- metadata.gz: a9c155e6003414f32e8eeaf1922b4aec59afb301e7b5055619a539ab8e7a7588928acb0cc2a4a8bd8a9ca66a88c41c2ffed3854ba77cfa3da0db3a1872c943aa
7
- data.tar.gz: c605f036e0f8dd80fad8b6a58468e6f8b17535d12b0fa4518c5d7724909cebec3dd432ed929f42c588631a706572e71384bed40e6a95c0b8e3430f11818e2a0a
6
+ metadata.gz: f96d584f2c2998282a714cbdb86acdd87243505edafc85b4d8efe2fda1d5645f7e0a4f49d104e07bec12f7dce5e55fe91ad251210d3af1146f9c2aaf62c6eebc
7
+ data.tar.gz: cfd58d1cd5fd113a9a700b4dae8b87399d9d2affe9c9727832ca6e12584d5e1b1fd279545bf94a065b35fd61b529a9dbdbeee79070f60b40bdcd0b83f96dc39e
data/Gemfile CHANGED
@@ -6,8 +6,8 @@ source 'http://rubygems.org'
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development, :test do
9
- gem 'minitest', '~>5.8.3'
10
- gem 'mocha', '~>1.1.0'
9
+ gem 'minitest'
10
+ gem 'mocha'
11
11
  gem 'rake'
12
12
  gem 'rdoc'
13
13
  end
@@ -1,21 +1,19 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- metaclass (0.0.4)
5
- minitest (5.8.5)
6
- mocha (1.1.0)
7
- metaclass (~> 0.0.1)
8
- rake (12.1.0)
9
- rdoc (5.1.0)
4
+ minitest (5.14.0)
5
+ mocha (1.11.2)
6
+ rake (13.0.1)
7
+ rdoc (6.2.1)
10
8
 
11
9
  PLATFORMS
12
10
  ruby
13
11
 
14
12
  DEPENDENCIES
15
- minitest (~> 5.8.3)
16
- mocha (~> 1.1.0)
13
+ minitest
14
+ mocha
17
15
  rake
18
16
  rdoc
19
17
 
20
18
  BUNDLED WITH
21
- 1.14.3
19
+ 2.1.4
data/README.md CHANGED
@@ -11,7 +11,7 @@ OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, groff man pages,
11
11
  HTML slide shows, EPUB, and Microsoft Word docx.
12
12
 
13
13
  *This documentation is for version 2 and higher. For version 1 documentation
14
- [see here](https://github.com/alphabetum/pandoc-ruby/blob/v1.0.0/README.markdown).*
14
+ [see here](https://github.com/xwmx/pandoc-ruby/blob/v1.0.0/README.markdown).*
15
15
 
16
16
  ## Installation
17
17
 
@@ -105,7 +105,7 @@ or run `man pandoc`
105
105
  If you'd prefer a pure-Ruby extended markdown interpreter that can output a
106
106
  few different formats, take a look at [Maruku](http://maruku.rubyforge.org/).
107
107
  If you want to use the full reStructuredText syntax from within Ruby, check
108
- out [RbST](https://github.com/alphabetum/rbst), a docutils wrapper.
108
+ out [RbST](https://github.com/xwmx/rbst), a docutils wrapper.
109
109
 
110
110
  This gem was inspired by [Albino](http://github.com/github/albino). For a
111
111
  slightly different approach to using Pandoc with Ruby, see
data/Rakefile CHANGED
@@ -1,12 +1,10 @@
1
- # encoding: utf-8
2
-
3
1
  require 'rubygems'
4
2
  require 'bundler'
5
3
  begin
6
4
  Bundler.setup(:default, :development)
7
5
  rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts 'Run `bundle install` to install missing gems'
6
+ warn e.message
7
+ warn 'Run `bundle install` to install missing gems'
10
8
  exit e.status_code
11
9
  end
12
10
  require 'rake'
@@ -3,7 +3,6 @@ require 'tempfile'
3
3
  require 'timeout'
4
4
 
5
5
  class PandocRuby
6
-
7
6
  @@pandoc_path = 'pandoc'
8
7
 
9
8
  # The available readers and their corresponding names. The keys are used to
@@ -21,28 +20,28 @@ class PandocRuby
21
20
  # The available string writers and their corresponding names. The keys are
22
21
  # used to generate methods and specify options to Pandoc.
23
22
  STRING_WRITERS = {
24
- 'native' => 'pandoc native',
25
- 'json' => 'pandoc JSON',
26
- 'html' => 'HTML',
27
- 'html5' => 'HTML5',
28
- 's5' => 'S5 HTML slideshow',
29
- 'slidy' => 'Slidy HTML slideshow',
30
- 'dzslides' => 'Dzslides HTML slideshow',
31
- 'docbook' => 'DocBook XML',
32
- 'opendocument' => 'OpenDocument XML',
33
- 'latex' => 'LaTeX',
34
- 'beamer' => 'Beamer PDF slideshow',
35
- 'context' => 'ConTeXt',
36
- 'texinfo' => 'GNU Texinfo',
37
- 'man' => 'groff man',
38
- 'markdown' => 'markdown',
39
- 'plain' => 'plain',
40
- 'rst' => 'reStructuredText',
41
- 'mediawiki' => 'MediaWiki markup',
42
- 'textile' => 'textile',
43
- 'rtf' => 'rich text format',
44
- 'org' => 'emacs org mode',
45
- 'asciidoc' => 'asciidoc'
23
+ 'native' => 'pandoc native',
24
+ 'json' => 'pandoc JSON',
25
+ 'html' => 'HTML',
26
+ 'html5' => 'HTML5',
27
+ 's5' => 'S5 HTML slideshow',
28
+ 'slidy' => 'Slidy HTML slideshow',
29
+ 'dzslides' => 'Dzslides HTML slideshow',
30
+ 'docbook' => 'DocBook XML',
31
+ 'opendocument' => 'OpenDocument XML',
32
+ 'latex' => 'LaTeX',
33
+ 'beamer' => 'Beamer PDF slideshow',
34
+ 'context' => 'ConTeXt',
35
+ 'texinfo' => 'GNU Texinfo',
36
+ 'man' => 'groff man',
37
+ 'markdown' => 'markdown',
38
+ 'plain' => 'plain',
39
+ 'rst' => 'reStructuredText',
40
+ 'mediawiki' => 'MediaWiki markup',
41
+ 'textile' => 'textile',
42
+ 'rtf' => 'rich text format',
43
+ 'org' => 'emacs org mode',
44
+ 'asciidoc' => 'asciidoc'
46
45
  }.freeze
47
46
 
48
47
  # The available binary writers and their corresponding names. The keys are
@@ -220,6 +219,7 @@ class PandocRuby
220
219
  end
221
220
 
222
221
  raise error unless exit_status && exit_status.success?
222
+
223
223
  output
224
224
  end
225
225
 
@@ -227,14 +227,13 @@ class PandocRuby
227
227
  # opts passed in. Recursively calls itself in order to handle hash options.
228
228
  def prepare_options(opts = [])
229
229
  opts.inject('') do |string, (option, value)|
230
- string += case
231
- when value
232
- create_option(option, value)
233
- when option.respond_to?(:each_pair)
234
- prepare_options(option)
235
- else
236
- create_option(option)
237
- end
230
+ string + if value
231
+ create_option(option, value)
232
+ elsif option.respond_to?(:each_pair)
233
+ prepare_options(option)
234
+ else
235
+ create_option(option)
236
+ end
238
237
  end
239
238
  end
240
239
 
@@ -243,9 +242,11 @@ class PandocRuby
243
242
  # command line options. If the option has an argument, it is also included.
244
243
  def create_option(flag, argument = nil)
245
244
  return '' unless flag
245
+
246
246
  flag = flag.to_s
247
247
  set_pandoc_ruby_options(flag, argument)
248
248
  return '' if flag == 'timeout' # pandoc doesn't accept timeouts yet
249
+
249
250
  if !argument.nil?
250
251
  "#{format_flag(flag)} #{argument}"
251
252
  else
@@ -269,10 +270,9 @@ class PandocRuby
269
270
  case flag
270
271
  when 't', 'to'
271
272
  self.writer = argument.to_s
272
- self.binary_output = true if BINARY_WRITERS.keys.include?(self.writer)
273
+ self.binary_output = true if BINARY_WRITERS.key?(self.writer)
273
274
  when 'timeout'
274
275
  @timeout = argument
275
276
  end
276
277
  end
277
-
278
278
  end
@@ -5,18 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'pandoc-ruby'
8
- s.version = '2.0.2'
9
-
10
- s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
8
+ s.version = '2.1.0'
11
9
  s.authors = ['William Melody']
12
- s.date = '2017-09-17'
10
+ s.date = '2020-03-23'
13
11
  s.description = 'Ruby wrapper for Pandoc'
14
12
  s.email = 'hi@williammelody.com'
15
13
  s.extra_rdoc_files = [
16
14
  'LICENSE',
17
15
  'README.md'
18
16
  ]
19
- s.files = %w(
17
+ s.files = %w[
20
18
  .document
21
19
  Gemfile
22
20
  Gemfile.lock
@@ -31,32 +29,10 @@ Gem::Specification.new do |s|
31
29
  test/helper.rb
32
30
  test/test_conversions.rb
33
31
  test/test_pandoc_ruby.rb
34
- )
35
- s.homepage = 'http://github.com/alphabetum/pandoc-ruby'
32
+ ]
33
+ s.homepage = 'http://github.com/xwmx/pandoc-ruby'
36
34
  s.licenses = ['MIT']
37
35
  s.require_paths = ['lib']
38
- s.required_ruby_version = '>= 1.9.3'
39
- s.rubygems_version = '1.8.25'
36
+ s.required_ruby_version = '>= 2.2'
40
37
  s.summary = 'PandocRuby'
41
-
42
- if s.respond_to? :specification_version then
43
- s.specification_version = 3
44
-
45
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
- s.add_development_dependency('mocha', '~> 1.1', '>= 1.1.0')
47
- s.add_development_dependency('rake', '~> 10.4', '>= 10.4.2')
48
- s.add_development_dependency('rdoc', '~> 4.2', '>= 4.2.0')
49
- s.add_development_dependency('minitest', '~>5.8.3', '>= 5.8.3')
50
- else
51
- s.add_dependency('mocha', ['~> 1.1.0'])
52
- s.add_dependency('rake', ['~> 10.4.2'])
53
- s.add_dependency('rdoc', ['~> 4.2.0'])
54
- s.add_dependency('minitest', ['~>5.8.3'])
55
- end
56
- else
57
- s.add_dependency('mocha', ['~> 1.1.0'])
58
- s.add_dependency('rake', ['~> 10.4.2'])
59
- s.add_dependency('rdoc', ['~> 4.2.0'])
60
- s.add_dependency('minitest', ['~>5.8.3'])
61
- end
62
38
  end
@@ -6,10 +6,10 @@
6
6
  iterations = 100
7
7
  test_file = File.join(File.dirname(__FILE__), 'files', 'benchmark.txt')
8
8
  impl_gems = {
9
- 'BlueCloth' => 'bluecloth',
10
- 'RDiscount' => 'rdiscount',
11
- 'Maruku' => 'maruku',
12
- 'PandocRuby' => 'pandoc-ruby'
9
+ 'BlueCloth' => 'bluecloth',
10
+ 'RDiscount' => 'rdiscount',
11
+ 'Maruku' => 'maruku',
12
+ 'PandocRuby' => 'pandoc-ruby'
13
13
  }
14
14
 
15
15
  implementations = impl_gems.keys
@@ -3,13 +3,13 @@ require 'bundler'
3
3
  begin
4
4
  Bundler.setup(:default, :development)
5
5
  rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts 'Run `bundle install` to install missing gems'
6
+ warn e.message
7
+ warn 'Run `bundle install` to install missing gems'
8
8
  exit e.status_code
9
9
  end
10
10
  require 'minitest/autorun'
11
11
  require 'minitest/pride'
12
- require 'mocha/setup'
12
+ require 'mocha/minitest'
13
13
 
14
14
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
15
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -27,4 +27,39 @@ describe 'Conversions' do
27
27
  end
28
28
  end
29
29
  end
30
+
31
+ describe '.docx' do
32
+ it "converts from docx to html" do
33
+ converted_content = PandocRuby.convert(
34
+ ['./test/files/reference.docx'],
35
+ :from => 'docx',
36
+ :to => 'html'
37
+ )
38
+ assert_equal("<p>Hello World.</p>", converted_content.strip)
39
+ end
40
+
41
+ it "raises an error when attempting to convert doc with docx format" do
42
+ error = assert_raises(RuntimeError) do
43
+ PandocRuby.convert(
44
+ ['./test/files/reference.doc'],
45
+ :from => 'docx',
46
+ :to => 'html'
47
+ )
48
+ end
49
+
50
+ assert_match(/couldn't parse docx file/, error.message)
51
+ end
52
+
53
+ it "raises an error when attempting to convert doc with doc format" do
54
+ error = assert_raises(RuntimeError) do
55
+ PandocRuby.convert(
56
+ ['./test/files/reference.doc'],
57
+ :from => 'doc',
58
+ :to => 'html'
59
+ )
60
+ end
61
+
62
+ assert_match(/Pandoc can convert from DOCX, but not from DOC./, error.message)
63
+ end
64
+ end
30
65
  end
@@ -163,6 +163,9 @@ describe PandocRuby do
163
163
  end
164
164
 
165
165
  it 'gracefully times out when pandoc hangs due to malformed input' do
166
+ skip(%(
167
+ Pandoc no longer times out with test file. Determine how to test.
168
+ ))
166
169
  file = File.join(File.dirname(__FILE__), 'files', 'bomb.tex')
167
170
  contents = File.read(file)
168
171
 
@@ -175,37 +178,37 @@ describe PandocRuby do
175
178
 
176
179
  it 'has reader and writer constants' do
177
180
  assert_equal PandocRuby::READERS,
178
- 'html' => 'HTML',
179
- 'latex' => 'LaTeX',
180
- 'textile' => 'textile',
181
- 'native' => 'pandoc native',
182
- 'markdown' => 'markdown',
183
- 'json' => 'pandoc JSON',
184
- 'rst' => 'reStructuredText'
181
+ 'html' => 'HTML',
182
+ 'latex' => 'LaTeX',
183
+ 'textile' => 'textile',
184
+ 'native' => 'pandoc native',
185
+ 'markdown' => 'markdown',
186
+ 'json' => 'pandoc JSON',
187
+ 'rst' => 'reStructuredText'
185
188
 
186
189
  assert_equal PandocRuby::STRING_WRITERS,
187
- 'mediawiki' => 'MediaWiki markup',
188
- 'html' => 'HTML',
189
- 'plain' => 'plain',
190
- 'latex' => 'LaTeX',
191
- 's5' => 'S5 HTML slideshow',
192
- 'textile' => 'textile',
193
- 'texinfo' => 'GNU Texinfo',
194
- 'docbook' => 'DocBook XML',
195
- 'html5' => 'HTML5',
196
- 'native' => 'pandoc native',
197
- 'org' => 'emacs org mode',
198
- 'rtf' => 'rich text format',
199
- 'markdown' => 'markdown',
200
- 'man' => 'groff man',
201
- 'dzslides' => 'Dzslides HTML slideshow',
202
- 'beamer' => 'Beamer PDF slideshow',
203
- 'json' => 'pandoc JSON',
204
- 'opendocument' => 'OpenDocument XML',
205
- 'slidy' => 'Slidy HTML slideshow',
206
- 'rst' => 'reStructuredText',
207
- 'context' => 'ConTeXt',
208
- 'asciidoc' => 'asciidoc'
190
+ 'mediawiki' => 'MediaWiki markup',
191
+ 'html' => 'HTML',
192
+ 'plain' => 'plain',
193
+ 'latex' => 'LaTeX',
194
+ 's5' => 'S5 HTML slideshow',
195
+ 'textile' => 'textile',
196
+ 'texinfo' => 'GNU Texinfo',
197
+ 'docbook' => 'DocBook XML',
198
+ 'html5' => 'HTML5',
199
+ 'native' => 'pandoc native',
200
+ 'org' => 'emacs org mode',
201
+ 'rtf' => 'rich text format',
202
+ 'markdown' => 'markdown',
203
+ 'man' => 'groff man',
204
+ 'dzslides' => 'Dzslides HTML slideshow',
205
+ 'beamer' => 'Beamer PDF slideshow',
206
+ 'json' => 'pandoc JSON',
207
+ 'opendocument' => 'OpenDocument XML',
208
+ 'slidy' => 'Slidy HTML slideshow',
209
+ 'rst' => 'reStructuredText',
210
+ 'context' => 'ConTeXt',
211
+ 'asciidoc' => 'asciidoc'
209
212
 
210
213
  assert_equal PandocRuby::BINARY_WRITERS,
211
214
  'odt' => 'OpenDocument',
metadata CHANGED
@@ -1,95 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Melody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-17 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: mocha
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.1'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.1.0
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.1'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.1.0
33
- - !ruby/object:Gem::Dependency
34
- name: rake
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '10.4'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 10.4.2
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '10.4'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 10.4.2
53
- - !ruby/object:Gem::Dependency
54
- name: rdoc
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '4.2'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 4.2.0
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '4.2'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 4.2.0
73
- - !ruby/object:Gem::Dependency
74
- name: minitest
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: 5.8.3
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 5.8.3
83
- type: :development
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 5.8.3
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 5.8.3
11
+ date: 2020-03-23 00:00:00.000000000 Z
12
+ dependencies: []
93
13
  description: Ruby wrapper for Pandoc
94
14
  email: hi@williammelody.com
95
15
  executables: []
@@ -112,7 +32,7 @@ files:
112
32
  - test/helper.rb
113
33
  - test/test_conversions.rb
114
34
  - test/test_pandoc_ruby.rb
115
- homepage: http://github.com/alphabetum/pandoc-ruby
35
+ homepage: http://github.com/xwmx/pandoc-ruby
116
36
  licenses:
117
37
  - MIT
118
38
  metadata: {}
@@ -124,17 +44,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
44
  requirements:
125
45
  - - ">="
126
46
  - !ruby/object:Gem::Version
127
- version: 1.9.3
47
+ version: '2.2'
128
48
  required_rubygems_version: !ruby/object:Gem::Requirement
129
49
  requirements:
130
50
  - - ">="
131
51
  - !ruby/object:Gem::Version
132
52
  version: '0'
133
53
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.5.1
54
+ rubygems_version: 3.1.2
136
55
  signing_key:
137
- specification_version: 3
56
+ specification_version: 4
138
57
  summary: PandocRuby
139
58
  test_files: []
140
- has_rdoc: