paru 0.2.5.2 → 0.2.5.3
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 +4 -4
- data/lib/paru.rb +1 -1
- data/lib/paru/pandoc.rb +28 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f4e0a6ab8839d2b19d005de0d8caacbd5c87244
|
4
|
+
data.tar.gz: 8d358a982f09cb62b309d3cced5183bf6ff16c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a86c52201e8e4451ee4b7175bb5fece4c23b451302db3f56e9b887498427b08a19465631eb7da68edf236e6d8a2368bd8fec8417a70d6b98f77e8fb26855d26c
|
7
|
+
data.tar.gz: 05a2a5b0c2d426d73b69c6d33203a64681096070f48e586c9f5f02bde453199a5426ef08a52597bfdab17ca0fb75e97da042086e668ad08fc4fcc7b099f35975
|
data/lib/paru.rb
CHANGED
data/lib/paru/pandoc.rb
CHANGED
@@ -137,7 +137,9 @@ module Paru
|
|
137
137
|
# configured in this Pandoc instance.
|
138
138
|
#
|
139
139
|
# @param input [String] the input string to convert
|
140
|
-
# @return [String] the converted output string
|
140
|
+
# @return [String] the converted output as a string. Note. For some
|
141
|
+
# formats, output to STDOUT is not supported (see pandoc's manual) and
|
142
|
+
# the result string will be empty.
|
141
143
|
#
|
142
144
|
# The following two examples are the same:
|
143
145
|
#
|
@@ -161,6 +163,31 @@ module Paru
|
|
161
163
|
end
|
162
164
|
alias << convert
|
163
165
|
|
166
|
+
# Converts an input file to output string using the pandoc invocation
|
167
|
+
# configured in this Pandoc instance. The path to the input file is
|
168
|
+
# appended to that invocation.
|
169
|
+
#
|
170
|
+
# @param input_file [String] the path to the input file to convert
|
171
|
+
# @return [String] the converted output as a string. Note. For some
|
172
|
+
# formats, output to STDOUT is not supported (see pandoc's manual) and
|
173
|
+
# the result string will be empty.
|
174
|
+
#
|
175
|
+
# @example Using convert_file
|
176
|
+
# output = converter.convert_file 'files/document.md'
|
177
|
+
def convert_file(input_file)
|
178
|
+
command = "#{to_command} #{input_file}"
|
179
|
+
begin
|
180
|
+
output = ''
|
181
|
+
IO.popen(command, 'r+') do |p|
|
182
|
+
p.close_write
|
183
|
+
output << p.read
|
184
|
+
end
|
185
|
+
output
|
186
|
+
rescue StandardError => err
|
187
|
+
throw Error.new "Error while running '#{command}' on input:\n\n#{input}\n\nPandoc responds: '#{err.message}'"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
164
191
|
# Create a string representation of this converter's pandoc command
|
165
192
|
# line invocation. This is useful for debugging purposes.
|
166
193
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.5.
|
4
|
+
version: 0.2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huub de Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Use Pandoc (http://www.pandoc.org) with ruby
|
14
14
|
email: Huub@heerdebeer.org
|