pandoc-ruby 2.0.0 → 2.0.1

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
2
  SHA1:
3
- metadata.gz: 606934acc12140a2ce1f99e2f9c4e0cadfc24977
4
- data.tar.gz: 6ae5fa55a9d05bb7f9f915d45a388f06869395fe
3
+ metadata.gz: c07c31b644c343bcd4ab9371b2128579ced7577e
4
+ data.tar.gz: 983a9f0c36bd180077d4449bb51639cb22edf5e7
5
5
  SHA512:
6
- metadata.gz: 367018a0d5f56c3edac2a521ade4c695b6afc14f1755dc11605f30856a71b1ed7160da1aead1a4aa0e9919175a6e40e920bb0908bfb90539e98c3a397744e062
7
- data.tar.gz: 9ebe803a32985af625b33165cf5db03d9daca6763bda2a80dda948e41fcd58bfdb46eac2181a8a0da2ba21a711ad3747cafce25d2cf80ac9fe76fad2c2d52b4e
6
+ metadata.gz: cf592d887248d4d8f5131a8aebf55fcd4bf9b990cd34efd4058fc39629ccdc891d5ba40a8c470866d4448afedda6812bccd108aaf1ef49ddddaaf09ab8dec056
7
+ data.tar.gz: 8d6e6a5e741360555372e5054d625612b7fe2a6c8a4437768c57972d35d76f9919b632b6fece80421d4607b265454bdc09f806d5d6a6a4c58eb1ad87bfe3f579
@@ -1,12 +1,14 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ json (1.8.3)
4
5
  metaclass (0.0.4)
5
- minitest (5.8.3)
6
+ minitest (5.8.4)
6
7
  mocha (1.1.0)
7
8
  metaclass (~> 0.0.1)
8
- rake (10.4.2)
9
- rdoc (4.2.0)
9
+ rake (11.1.2)
10
+ rdoc (4.2.2)
11
+ json (~> 1.4)
10
12
 
11
13
  PLATFORMS
12
14
  ruby
@@ -18,4 +20,4 @@ DEPENDENCIES
18
20
  rdoc
19
21
 
20
22
  BUNDLED WITH
21
- 1.10.6
23
+ 1.12.2
data/README.md CHANGED
@@ -83,7 +83,9 @@ PandocRuby assumes the `pandoc` executable is via your environment's `$PATH`
83
83
  variable. If you'd like to set an explicit path to the `pandoc` executable,
84
84
  you can do so with `PandocRuby.pandoc_path = '/path/to/pandoc'`
85
85
 
86
- Pandoc can also be set to take an array of file paths as the first argument.
86
+ PandocRuby can also take an array of one or more file paths as the first
87
+ argument. The files will be concatenated together with a blank line between
88
+ each and used as input.
87
89
 
88
90
  ```ruby
89
91
  # One file path as a single-element array.
@@ -71,24 +71,24 @@ class PandocRuby
71
71
  new(*args).convert
72
72
  end
73
73
 
74
- attr_accessor :options
74
+ attr_writer :options
75
75
  def options
76
- @options || []
76
+ @options ||= []
77
77
  end
78
78
 
79
- attr_accessor :option_string
79
+ attr_writer :option_string
80
80
  def option_string
81
- @option_string || ''
81
+ @option_string ||= ''
82
82
  end
83
83
 
84
- attr_accessor :binary_output
84
+ attr_writer :binary_output
85
85
  def binary_output
86
- @binary_output || false
86
+ @binary_output ||= false
87
87
  end
88
88
 
89
- attr_accessor :writer
89
+ attr_writer :writer
90
90
  def writer
91
- @writer || 'html'
91
+ @writer ||= 'html'
92
92
  end
93
93
 
94
94
  # Create a new PandocRuby converter object. The first argument contains the
@@ -101,6 +101,9 @@ class PandocRuby
101
101
  # new(["/path/to/file.md"], :option1 => :value, :option2)
102
102
  # new(["/to/file1.html", "/to/file2.html"], :option1 => :value)
103
103
  def initialize(*args)
104
+ @input_string = nil
105
+ @input_files = nil
106
+
104
107
  if args[0].is_a?(String)
105
108
  @input_string = args.shift
106
109
  elsif args[0].is_a?(Array)
@@ -174,7 +177,7 @@ class PandocRuby
174
177
  begin
175
178
  self.options += [{ :output => tmp_file.path }]
176
179
  self.option_string = "#{self.option_string} --output #{tmp_file.path}"
177
- execute("#{@@pandoc_path}#{self.option_string}")
180
+ execute_pandoc
178
181
  return IO.binread(tmp_file)
179
182
  ensure
180
183
  tmp_file.close
@@ -184,6 +187,11 @@ class PandocRuby
184
187
 
185
188
  # Execute the pandoc command for string writers.
186
189
  def convert_string
190
+ execute_pandoc
191
+ end
192
+
193
+ # Wrapper to run pandoc in a consistent, DRY way
194
+ def execute_pandoc
187
195
  if ! @input_files.nil?
188
196
  execute("#{@@pandoc_path} #{@input_files}#{self.option_string}")
189
197
  else
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'pandoc-ruby'
8
- s.version = '2.0.0'
8
+ s.version = '2.0.1'
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ['William Melody']
12
- s.date = '2016-03-28'
12
+ s.date = '2016-05-04'
13
13
  s.description = 'Ruby wrapper for Pandoc'
14
14
  s.email = 'hi@williammelody.com'
15
15
  s.extra_rdoc_files = [
@@ -40,6 +40,10 @@ describe PandocRuby do
40
40
  assert PandocRuby.new([@file, @file2]).to_html.match(/A Second Title/)
41
41
  end
42
42
 
43
+ it 'converts multiple element array input as array of file paths to a binary output format' do
44
+ assert PandocRuby.new([@file, @file2]).to_epub.match(/com.apple.ibooks/)
45
+ end
46
+
43
47
  it 'accepts short options' do
44
48
  @converter.expects(:execute).with('pandoc -t rst').returns(true)
45
49
  assert @converter.convert
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Melody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mocha
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.4.5.1
135
+ rubygems_version: 2.5.1
136
136
  signing_key:
137
137
  specification_version: 3
138
138
  summary: PandocRuby