pandoc-ruby 2.1.6 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pandoc-ruby.rb +27 -15
- data/pandoc-ruby.gemspec +4 -3
- data/test/files/Test File 2.md +1 -0
- data/test/test_pandoc_ruby.rb +23 -11
- metadata +5 -4
- /data/test/files/{test.md → Test File 1.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d9359ca27925935afcdd5599c555064864b1e0d14e5c55f54baf95678ccfba0
|
4
|
+
data.tar.gz: d9e80c8530cc6452d0b50b3a60b971bc5d3fed5cc43cb93a35132c30a0973f63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de8d38e929bc12e5e3e93a22586cdc81740c69071b956dd01685e835f1007e350476851379220bf192a67444afe51bef4b7e19e4f8bb3a59c876360d4fdca95
|
7
|
+
data.tar.gz: '0685c4b3c0286942be26232e4767a94f1194d7babbf5493a6ccdef4dfa45e783da51e63818f24e72fb00422d86cbd6b1947af9b56507680691660c9eff6c93b9'
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PandocRuby
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://img.shields.io/github/actions/workflow/status/xwmx/pandoc-ruby/tests.yml?branch=master)](https://github.com/xwmx/pandoc-ruby/actions)
|
4
4
|
[![Gem Version](https://img.shields.io/gem/v/pandoc-ruby)](http://rubygems.org/gems/pandoc-ruby)
|
5
5
|
[![Gem Downloads](https://img.shields.io/gem/dt/pandoc-ruby)](http://rubygems.org/gems/pandoc-ruby)
|
6
6
|
|
data/lib/pandoc-ruby.rb
CHANGED
@@ -12,12 +12,17 @@ class PandocRuby
|
|
12
12
|
# The available readers and their corresponding names. The keys are used to
|
13
13
|
# generate methods and specify options to Pandoc.
|
14
14
|
READERS = {
|
15
|
+
'biblatex' => 'BibLaTeX bibliography',
|
16
|
+
'bibtex' => 'BibTeX bibliography',
|
15
17
|
'commonmark' => 'CommonMark Markdown',
|
18
|
+
'commonmark_x' => 'CommonMark Markdown with extensions',
|
16
19
|
'creole' => 'Creole 1.0',
|
20
|
+
'csljson' => 'CSL JSON bibliography',
|
17
21
|
'csv' => 'CSV table',
|
18
22
|
'docbook' => 'DocBook',
|
19
23
|
'docx' => 'Word docx',
|
20
24
|
'dokuwiki' => 'DokuWiki markup',
|
25
|
+
'endnotexml' => 'EndNote XML bibliography',
|
21
26
|
'epub' => 'EPUB',
|
22
27
|
'fb2' => 'FictionBook2 e-book',
|
23
28
|
'gfm' => 'GitHub-Flavored Markdown',
|
@@ -39,10 +44,13 @@ class PandocRuby
|
|
39
44
|
'odt' => 'ODT',
|
40
45
|
'opml' => 'OPML',
|
41
46
|
'org' => 'Emacs Org mode',
|
47
|
+
'ris' => 'RIS bibliography',
|
42
48
|
'rst' => 'reStructuredText',
|
49
|
+
'rtf' => 'Rich Text Format',
|
43
50
|
't2t' => 'txt2tags',
|
44
51
|
'textile' => 'Textile',
|
45
52
|
'tikiwiki' => 'TikiWiki markup',
|
53
|
+
'tsv' => 'TSV table',
|
46
54
|
'twiki' => 'TWiki markup',
|
47
55
|
'vimwiki' => 'Vimwiki'
|
48
56
|
}.freeze
|
@@ -53,8 +61,13 @@ class PandocRuby
|
|
53
61
|
'asciidoc' => 'AsciiDoc',
|
54
62
|
'asciidoctor' => 'AsciiDoctor',
|
55
63
|
'beamer' => 'LaTeX beamer slide show',
|
64
|
+
'biblatex' => 'BibLaTeX bibliography',
|
65
|
+
'bibtex' => 'BibTeX bibliography',
|
66
|
+
'chunkedhtml' => 'zip archive of multiple linked HTML files',
|
56
67
|
'commonmark' => 'CommonMark Markdown',
|
68
|
+
'commonmark_x' => 'CommonMark Markdown with extensions',
|
57
69
|
'context' => 'ConTeXt',
|
70
|
+
'csljson' => 'CSL JSON bibliography',
|
58
71
|
'docbook' => 'DocBook 4',
|
59
72
|
'docbook4' => 'DocBook 4',
|
60
73
|
'docbook5' => 'DocBook 5',
|
@@ -79,6 +92,7 @@ class PandocRuby
|
|
79
92
|
'markdown_mmd' => 'MultiMarkdown',
|
80
93
|
'markdown_phpextra' => 'PHP Markdown Extra',
|
81
94
|
'markdown_strict' => 'original unextended Markdown',
|
95
|
+
'markua' => 'Markua',
|
82
96
|
'mediawiki' => 'MediaWiki markup',
|
83
97
|
'ms' => 'roff ms',
|
84
98
|
'muse' => 'Muse',
|
@@ -108,7 +122,7 @@ class PandocRuby
|
|
108
122
|
BINARY_WRITERS = {
|
109
123
|
'odt' => 'OpenOffice text document',
|
110
124
|
'docx' => 'Word docx',
|
111
|
-
'epub' => 'EPUB
|
125
|
+
'epub' => 'EPUB v3',
|
112
126
|
'epub2' => 'EPUB v2',
|
113
127
|
'epub3' => 'EPUB v3'
|
114
128
|
}.freeze
|
@@ -165,7 +179,7 @@ class PandocRuby
|
|
165
179
|
when String
|
166
180
|
self.input_string = args.shift
|
167
181
|
when Array
|
168
|
-
self.input_files = args.shift.join(' ')
|
182
|
+
self.input_files = args.shift.map { |f| "'#{f}'" }.join(' ')
|
169
183
|
end
|
170
184
|
|
171
185
|
self.options = args
|
@@ -272,22 +286,20 @@ class PandocRuby
|
|
272
286
|
@timeout ||= 31_557_600
|
273
287
|
|
274
288
|
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
|
275
|
-
|
276
|
-
|
277
|
-
stdin.puts self.input_string
|
289
|
+
Timeout.timeout(@timeout) do
|
290
|
+
stdin.puts self.input_string
|
278
291
|
|
279
|
-
|
292
|
+
stdin.close
|
280
293
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
end
|
285
|
-
rescue Timeout::Error => ex
|
286
|
-
Process.kill 9, wait_thr.pid
|
287
|
-
|
288
|
-
maybe_ex = "\n#{ex}" if ex
|
289
|
-
error = "Pandoc timed out after #{@timeout} seconds.#{maybe_ex}"
|
294
|
+
output = stdout.read
|
295
|
+
error = stderr.read
|
296
|
+
exit_status = wait_thr.value
|
290
297
|
end
|
298
|
+
rescue Timeout::Error => ex
|
299
|
+
Process.kill 9, wait_thr.pid
|
300
|
+
|
301
|
+
maybe_ex = "\n#{ex}" if ex
|
302
|
+
error = "Pandoc timed out after #{@timeout} seconds.#{maybe_ex}"
|
291
303
|
end
|
292
304
|
|
293
305
|
raise error unless exit_status && exit_status.success?
|
data/pandoc-ruby.gemspec
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'pandoc-ruby'
|
8
|
-
s.version = '2.1.
|
8
|
+
s.version = '2.1.8'
|
9
9
|
s.authors = ['William Melody']
|
10
|
-
s.date = '
|
10
|
+
s.date = '2023-10-04'
|
11
11
|
s.description = 'Ruby wrapper for Pandoc'
|
12
12
|
s.email = 'hi@williammelody.com'
|
13
13
|
s.extra_rdoc_files = [
|
@@ -25,7 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
pandoc-ruby.gemspec
|
26
26
|
test/benchmark.rb
|
27
27
|
test/files/benchmark.txt
|
28
|
-
test/files/
|
28
|
+
test/files/Test\ File\ 1.md
|
29
|
+
test/files/Test\ File\ 2.md
|
29
30
|
test/helper.rb
|
30
31
|
test/test_conversions.rb
|
31
32
|
test/test_pandoc_ruby.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
# A Second Title
|
data/test/test_pandoc_ruby.rb
CHANGED
@@ -2,8 +2,8 @@ require 'helper'
|
|
2
2
|
|
3
3
|
describe PandocRuby do
|
4
4
|
before do
|
5
|
-
@file = File.join(File.dirname(__FILE__), 'files', '
|
6
|
-
@file2 = File.join(File.dirname(__FILE__), 'files', '
|
5
|
+
@file = File.join(File.dirname(__FILE__), 'files', 'Test File 1.md')
|
6
|
+
@file2 = File.join(File.dirname(__FILE__), 'files', 'Test File 2.md')
|
7
7
|
@string = '# Test String'
|
8
8
|
@converter = PandocRuby.new(@string, :t => :rst)
|
9
9
|
end
|
@@ -318,15 +318,13 @@ describe PandocRuby do
|
|
318
318
|
end
|
319
319
|
|
320
320
|
it 'runs more than 400 times without error' do
|
321
|
-
|
322
|
-
|
323
|
-
PandocRuby.convert(@string)
|
324
|
-
end
|
325
|
-
|
326
|
-
assert true
|
327
|
-
rescue Errno::EMFILE, Errno::EAGAIN => e
|
328
|
-
flunk e
|
321
|
+
400.times do
|
322
|
+
PandocRuby.convert(@string)
|
329
323
|
end
|
324
|
+
|
325
|
+
assert true
|
326
|
+
rescue Errno::EMFILE, Errno::EAGAIN => e
|
327
|
+
flunk e
|
330
328
|
end
|
331
329
|
|
332
330
|
it 'gracefully times out when pandoc hangs due to malformed input' do
|
@@ -346,12 +344,17 @@ describe PandocRuby do
|
|
346
344
|
it 'has reader and writer constants' do
|
347
345
|
assert_equal(
|
348
346
|
PandocRuby::READERS,
|
347
|
+
'biblatex' => 'BibLaTeX bibliography',
|
348
|
+
'bibtex' => 'BibTeX bibliography',
|
349
349
|
'commonmark' => 'CommonMark Markdown',
|
350
|
+
'commonmark_x' => 'CommonMark Markdown with extensions',
|
350
351
|
'creole' => 'Creole 1.0',
|
352
|
+
'csljson' => 'CSL JSON bibliography',
|
351
353
|
'csv' => 'CSV table',
|
352
354
|
'docbook' => 'DocBook',
|
353
355
|
'docx' => 'Word docx',
|
354
356
|
'dokuwiki' => 'DokuWiki markup',
|
357
|
+
'endnotexml' => 'EndNote XML bibliography',
|
355
358
|
'epub' => 'EPUB',
|
356
359
|
'fb2' => 'FictionBook2 e-book',
|
357
360
|
'gfm' => 'GitHub-Flavored Markdown',
|
@@ -373,10 +376,13 @@ describe PandocRuby do
|
|
373
376
|
'odt' => 'ODT',
|
374
377
|
'opml' => 'OPML',
|
375
378
|
'org' => 'Emacs Org mode',
|
379
|
+
'ris' => 'RIS bibliography',
|
376
380
|
'rst' => 'reStructuredText',
|
381
|
+
'rtf' => 'Rich Text Format',
|
377
382
|
't2t' => 'txt2tags',
|
378
383
|
'textile' => 'Textile',
|
379
384
|
'tikiwiki' => 'TikiWiki markup',
|
385
|
+
'tsv' => 'TSV table',
|
380
386
|
'twiki' => 'TWiki markup',
|
381
387
|
'vimwiki' => 'Vimwiki'
|
382
388
|
)
|
@@ -386,8 +392,13 @@ describe PandocRuby do
|
|
386
392
|
'asciidoc' => 'AsciiDoc',
|
387
393
|
'asciidoctor' => 'AsciiDoctor',
|
388
394
|
'beamer' => 'LaTeX beamer slide show',
|
395
|
+
'biblatex' => 'BibLaTeX bibliography',
|
396
|
+
'bibtex' => 'BibTeX bibliography',
|
397
|
+
'chunkedhtml' => 'zip archive of multiple linked HTML files',
|
389
398
|
'commonmark' => 'CommonMark Markdown',
|
399
|
+
'commonmark_x' => 'CommonMark Markdown with extensions',
|
390
400
|
'context' => 'ConTeXt',
|
401
|
+
'csljson' => 'CSL JSON bibliography',
|
391
402
|
'docbook' => 'DocBook 4',
|
392
403
|
'docbook4' => 'DocBook 4',
|
393
404
|
'docbook5' => 'DocBook 5',
|
@@ -412,6 +423,7 @@ describe PandocRuby do
|
|
412
423
|
'markdown_mmd' => 'MultiMarkdown',
|
413
424
|
'markdown_phpextra' => 'PHP Markdown Extra',
|
414
425
|
'markdown_strict' => 'original unextended Markdown',
|
426
|
+
'markua' => 'Markua',
|
415
427
|
'mediawiki' => 'MediaWiki markup',
|
416
428
|
'ms' => 'roff ms',
|
417
429
|
'muse' => 'Muse',
|
@@ -440,7 +452,7 @@ describe PandocRuby do
|
|
440
452
|
PandocRuby::BINARY_WRITERS,
|
441
453
|
'odt' => 'OpenOffice text document',
|
442
454
|
'docx' => 'Word docx',
|
443
|
-
'epub' => 'EPUB
|
455
|
+
'epub' => 'EPUB v3',
|
444
456
|
'epub2' => 'EPUB v2',
|
445
457
|
'epub3' => 'EPUB v3'
|
446
458
|
)
|
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.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Melody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby wrapper for Pandoc
|
14
14
|
email: hi@williammelody.com
|
@@ -27,8 +27,9 @@ files:
|
|
27
27
|
- lib/pandoc-ruby.rb
|
28
28
|
- pandoc-ruby.gemspec
|
29
29
|
- test/benchmark.rb
|
30
|
+
- test/files/Test File 1.md
|
31
|
+
- test/files/Test File 2.md
|
30
32
|
- test/files/benchmark.txt
|
31
|
-
- test/files/test.md
|
32
33
|
- test/helper.rb
|
33
34
|
- test/test_conversions.rb
|
34
35
|
- test/test_pandoc_ruby.rb
|
@@ -51,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
52
|
- !ruby/object:Gem::Version
|
52
53
|
version: '0'
|
53
54
|
requirements: []
|
54
|
-
rubygems_version: 3.
|
55
|
+
rubygems_version: 3.4.1
|
55
56
|
signing_key:
|
56
57
|
specification_version: 4
|
57
58
|
summary: PandocRuby
|
File without changes
|