pandoc-ruby 0.7.5 → 1.0.0

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
  SHA1:
3
- metadata.gz: 3658e79390d364b65c6bcdc7e4b21ed9c5c9e456
4
- data.tar.gz: 05e2821ad3a8add8126c85f29a899b7f1194cb5c
3
+ metadata.gz: bb86a51dc3901cc03725daebcaa9afe2c4d2d4b2
4
+ data.tar.gz: 0c53e1b182af84515130b764a06d68041dae22ab
5
5
  SHA512:
6
- metadata.gz: c753b5af720e64a66ac89a2630024706ef47cf5e5b922a3d987a2b0e64f0fe9764192568301ccf15aae0da78cd145fdf3b2aaa87413801e9b68e9977bcf75d70
7
- data.tar.gz: e61b4db2df1b2c1db386044a22583168b24e5ee0426bd0e6d9fef8e20e94715d1aa3cb0e593de768c741d49f1cc75ccb03a3462f41f7da9e91079ada5da56c08
6
+ metadata.gz: d607cd66c09554e971bd9757e2b155125867117d5ce4a6dcac8f08e8245f9261a40b1b6843cc52dae87afe26da885f04f7f338b19891a2b637cb529ce4781ff8
7
+ data.tar.gz: eaa4f5abf913287d78d70f054e64e0bde58d7c3675151ac058850bfa87ee9e77c5857cf649aace0fac640c3f001ad37d0ffa5b000199617592d0788a1adbc434
data/Gemfile CHANGED
@@ -6,8 +6,9 @@ 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 "mocha", "~> 0.13.3"
10
- gem "rdoc", "~> 3.12"
11
- gem "shoulda", ">= 0"
9
+ gem "mocha", "~> 1.1.0"
12
10
  gem "rake"
11
+ gem "rdoc", "~> 4.2.0"
12
+ gem "shoulda", "~> 3.5.0"
13
+ gem "test-unit", "~> 3.0.9"
13
14
  end
@@ -1,30 +1,39 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (3.2.13)
5
- i18n (= 0.6.1)
6
- multi_json (~> 1.0)
7
- i18n (0.6.1)
8
- json (1.8.0)
9
- metaclass (0.0.1)
10
- mocha (0.13.3)
4
+ activesupport (4.2.0)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ i18n (0.7.0)
11
+ json (1.8.2)
12
+ metaclass (0.0.4)
13
+ minitest (5.5.1)
14
+ mocha (1.1.0)
11
15
  metaclass (~> 0.0.1)
12
- multi_json (1.7.7)
13
- rake (10.1.0)
14
- rdoc (3.12.2)
15
- json (~> 1.4)
16
+ power_assert (0.2.2)
17
+ rake (10.4.2)
18
+ rdoc (4.2.0)
16
19
  shoulda (3.5.0)
17
20
  shoulda-context (~> 1.0, >= 1.0.1)
18
21
  shoulda-matchers (>= 1.4.1, < 3.0)
19
- shoulda-context (1.1.2)
20
- shoulda-matchers (2.2.0)
22
+ shoulda-context (1.2.1)
23
+ shoulda-matchers (2.8.0)
21
24
  activesupport (>= 3.0.0)
25
+ test-unit (3.0.9)
26
+ power_assert
27
+ thread_safe (0.3.4)
28
+ tzinfo (1.2.2)
29
+ thread_safe (~> 0.1)
22
30
 
23
31
  PLATFORMS
24
32
  ruby
25
33
 
26
34
  DEPENDENCIES
27
- mocha (~> 0.13.3)
35
+ mocha (~> 1.1.0)
28
36
  rake
29
- rdoc (~> 3.12)
30
- shoulda
37
+ rdoc (~> 4.2.0)
38
+ shoulda (~> 3.5.0)
39
+ test-unit (~> 3.0.9)
@@ -75,11 +75,12 @@ If you are trying to generate a standalone file with full file headers rather th
75
75
 
76
76
  ## Caveats
77
77
 
78
+ * Ruby 1.9.3 or higher is required.
78
79
  * This has only been tested on \*nix systems.
79
80
  * PDF conversion may require additional dependencies and has not been tested.
80
81
 
81
82
  ## Note on Patches/Pull Requests
82
-
83
+
83
84
  * Fork the project.
84
85
  * Make your feature addition or bug fix.
85
86
  * Add tests for it. This is important so I don't break it in a
data/Rakefile CHANGED
@@ -28,4 +28,4 @@ Rake::RDocTask.new do |rdoc|
28
28
  rdoc.title = "pandoc-ruby #{version}"
29
29
  rdoc.rdoc_files.include('README*')
30
30
  rdoc.rdoc_files.include('lib/**/*.rb')
31
- end
31
+ end
@@ -5,7 +5,7 @@ class PandocRuby
5
5
 
6
6
  @@bin_path = nil
7
7
  @@allow_file_paths = false
8
-
8
+
9
9
  # The executable options. The `pandoc` executable is used by default.
10
10
  EXECUTABLES = %W[
11
11
  pandoc
@@ -13,7 +13,7 @@ class PandocRuby
13
13
  html2markdown
14
14
  hsmarkdown
15
15
  ]
16
-
16
+
17
17
  # The available readers and their corresponding names. The keys are used to
18
18
  # generate methods and specify options to Pandoc.
19
19
  READERS = {
@@ -64,13 +64,13 @@ class PandocRuby
64
64
 
65
65
  # All of the available Writers.
66
66
  WRITERS = STRING_WRITERS.merge(BINARY_WRITERS)
67
-
67
+
68
68
  # If the pandoc executables are not in the PATH, bin_path can be set to
69
69
  # the directory they are contained in.
70
70
  def self.bin_path=(path)
71
71
  @@bin_path = path
72
72
  end
73
-
73
+
74
74
  # Pandoc can also be used with a file path as the first argument. For
75
75
  # security reasons, this is disabled by default, but it can be enabled by
76
76
  # setting this to `true`.
@@ -88,13 +88,13 @@ class PandocRuby
88
88
 
89
89
  attr_accessor :options
90
90
  def options; @options || [] end
91
-
91
+
92
92
  attr_accessor :option_string
93
93
  def option_string; @option_string || '' end
94
94
 
95
95
  attr_accessor :binary_output
96
96
  def binary_output; @binary_output || false end
97
-
97
+
98
98
  attr_accessor :writer
99
99
  def writer; @writer || 'html' end
100
100
 
@@ -136,13 +136,13 @@ class PandocRuby
136
136
  end
137
137
  end
138
138
  alias_method :to_s, :convert
139
-
139
+
140
140
  # Generate class methods for each of the readers in PandocRuby::READERS.
141
141
  # When one of these methods is called, it simply calls the initializer
142
142
  # with the `from` option set to the reader key, and returns the object.
143
143
  #
144
144
  # Example:
145
- #
145
+ #
146
146
  # PandocRuby.markdown("# text")
147
147
  # # => #<PandocRuby:0x007 @target="# text", @options=[{:from=>"markdown"}]
148
148
  class << self
@@ -153,14 +153,14 @@ class PandocRuby
153
153
  end
154
154
  end
155
155
  end
156
-
156
+
157
157
  # Generate instance methods for each of the writers in PandocRuby::WRITERS.
158
158
  # When one of these methods is called, it simply calls the `#convert` method
159
159
  # with the `to` option set to the writer key, thereby returning the
160
160
  # converted string.
161
161
  #
162
162
  # Example:
163
- #
163
+ #
164
164
  # PandocRuby.new("# text").to_html
165
165
  # # => "<h1 id=\"text\">text</h1>\n"
166
166
  WRITERS.each_key do |w|
@@ -169,7 +169,7 @@ class PandocRuby
169
169
  convert(*args)
170
170
  end
171
171
  end
172
-
172
+
173
173
  private
174
174
 
175
175
  # Sets the executable, which by default is `pandoc`. The `@executable`
@@ -208,12 +208,15 @@ private
208
208
 
209
209
  # Runs the command and returns the output.
210
210
  def execute(command)
211
- output = ''
212
- Open3::popen3(command) do |stdin, stdout, stderr|
213
- stdin.puts @target
211
+ output = error = exit_status = nil
212
+ Open3::popen3(command) do |stdin, stdout, stderr, wait_thr|
213
+ stdin.puts @target
214
214
  stdin.close
215
- output = stdout.read
215
+ output = stdout.read
216
+ error = stderr.read
217
+ exit_status = wait_thr.value
216
218
  end
219
+ raise error unless exit_status.success?
217
220
  output
218
221
  end
219
222
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pandoc-ruby"
8
- s.version = "0.7.5"
8
+ s.version = "1.0.0"
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 = "2013-08-20"
12
+ s.date = "2015-02-09"
13
13
  s.description = "Ruby wrapper for Pandoc"
14
14
  s.email = "hi@williammelody.com"
15
15
  s.extra_rdoc_files = [
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.homepage = "http://github.com/alphabetum/pandoc-ruby"
36
36
  s.licenses = ["MIT"]
37
37
  s.require_paths = ["lib"]
38
+ s.required_ruby_version = '>= 1.9.3'
38
39
  s.rubygems_version = "1.8.25"
39
40
  s.summary = "PandocRuby"
40
41
 
@@ -42,18 +43,23 @@ Gem::Specification.new do |s|
42
43
  s.specification_version = 3
43
44
 
44
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_development_dependency(%q<mocha>, ["~> 0.13.3"])
46
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
- s.add_development_dependency(%q<shoulda>, [">= 0"])
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('shoulda', '~> 3.5', '>= 3.5.0')
50
+ s.add_development_dependency('test-unit', '~> 3.0', '>= 3.0.9')
48
51
  else
49
- s.add_dependency(%q<mocha>, ["~> 0.13.3"])
50
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
51
- s.add_dependency(%q<shoulda>, [">= 0"])
52
+ s.add_dependency(%q<mocha>, ["~> 1.1.0"])
53
+ s.add_dependency(%q<rake>, ["~> 10.4.2"])
54
+ s.add_dependency(%q<rdoc>, ["~> 4.2.0"])
55
+ s.add_dependency(%q<shoulda>, ["~> 3.5.0"])
56
+ s.add_dependency(%q<test-unit>, ["~> 3.0.9"])
52
57
  end
53
58
  else
54
- s.add_dependency(%q<mocha>, ["~> 0.13.3"])
55
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
- s.add_dependency(%q<shoulda>, [">= 0"])
59
+ s.add_dependency(%q<mocha>, ["~> 1.1.0"])
60
+ s.add_dependency(%q<rake>, ["~> 10.4.2"])
61
+ s.add_dependency(%q<rdoc>, ["~> 4.2.0"])
62
+ s.add_dependency(%q<shoulda>, ["~> 3.5.0"])
63
+ s.add_dependency(%q<test-unit>, ["~> 3.0.9"])
57
64
  end
58
65
  end
59
-
@@ -1,67 +1,67 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestConversions < Test::Unit::TestCase
4
-
4
+
5
5
  def self.formatted_strings
6
6
  h = Hash.new
7
7
  h[:native] =
8
- %Q|[Header 1 [Str \"This\",Space,Str \"is\",Space,Str \"a\",Space,Str \"Title\"]\n,Para [Str \"Some\",Space,Emph [Str \"emphasized\",Space,Str \"text\"],Space,Str \"and\",Space,Link [Str \"a\",Space,Str \"link\"] (\"http://daringfireball.net/projects/markdown/\",\"\")]]|
8
+ %Q|[Header 1 (\"this-is-a-title\",[],[]) [Str \"This\",Space,Str \"is\",Space,Str \"a\",Space,Str \"Title\"]\n,Para [Str \"Some\",Space,Emph [Str \"emphasized\",Space,Str \"text\"],Space,Str \"and\",Space,Link [Str \"a\",Space,Str \"link\"] (\"http://daringfireball.net/projects/markdown/\",\"\")]]|
9
9
  h[:json] =
10
- %Q|[{\"docTitle\":[],\"docAuthors\":[],\"docDate\":[]},[{\"Header\":[1,[{\"Str\":\"This\"},\"Space\",{\"Str\":\"is\"},\"Space\",{\"Str\":\"a\"},\"Space\",{\"Str\":\"Title\"}]]},{\"Para\":[{\"Str\":\"Some\"},\"Space\",{\"Emph\":[{\"Str\":\"emphasized\"},\"Space\",{\"Str\":\"text\"}]},\"Space\",{\"Str\":\"and\"},\"Space\",{\"Link\":[[{\"Str\":\"a\"},\"Space\",{\"Str\":\"link\"}],[\"http://daringfireball.net/projects/markdown/\",\"\"]]}]}]]|
10
+ %Q|[{"unMeta":{}},[{"t":"Header","c":[1,["this-is-a-title",[],[]],[{"t":"Str","c":"This"},{"t":"Space","c":[]},{"t":"Str","c":"is"},{"t":"Space","c":[]},{"t":"Str","c":"a"},{"t":"Space","c":[]},{"t":"Str","c":"Title"}]]},{"t":"Para","c":[{"t":"Str","c":"Some"},{"t":"Space","c":[]},{"t":"Emph","c":[{"t":"Str","c":"emphasized"},{"t":"Space","c":[]},{"t":"Str","c":"text"}]},{"t":"Space","c":[]},{"t":"Str","c":"and"},{"t":"Space","c":[]},{"t":"Link","c":[[{"t":"Str","c":"a"},{"t":"Space","c":[]},{"t":"Str","c":"link"}],["http://daringfireball.net/projects/markdown/",""]]}]}]]|
11
11
  h[:html] =
12
12
  %Q|<h1 id=\"this-is-a-title\">This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>|
13
13
  h[:html5] =
14
14
  %Q|<h1 id=\"this-is-a-title\">This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>|
15
15
  h[:s5] =
16
- %Q|<div class=\"section slide level1\" id=\"this-is-a-title\">\n<h1>This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>\n</div>|
16
+ %Q|<div id=\"this-is-a-title\" class=\"slide section level1\">\n<h1>This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>\n</div>|
17
17
  h[:slidy] =
18
- %Q|<div class=\"section slide level1\" id=\"this-is-a-title\">\n<h1 id=\"this-is-a-title\">This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>\n</div>|
18
+ %Q|<div id=\"this-is-a-title\" class=\"slide section level1\">\n<h1>This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>\n</div>|
19
19
  h[:dzslides] =
20
- %Q|<section class=\"slide level1\" id=\"this-is-a-title\">\n<h1 id=\"this-is-a-title\">This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>\n</section>|
20
+ %Q|<section id=\"this-is-a-title\" class=\"slide level1\">\n<h1>This is a Title</h1>\n<p>Some <em>emphasized text</em> and <a href=\"http://daringfireball.net/projects/markdown/\">a link</a></p>\n</section>|
21
21
  h[:docbook] =
22
22
  %Q|<sect1 id=\"this-is-a-title\">\n <title>This is a Title</title>\n <para>\n Some <emphasis>emphasized text</emphasis> and\n <ulink url=\"http://daringfireball.net/projects/markdown/\">a\n link</ulink>\n </para>\n</sect1>|
23
23
  h[:opendocument] =
24
24
  %Q|<text:h text:style-name=\"Heading_20_1\" text:outline-level=\"1\">This is a\nTitle</text:h>\n<text:p text:style-name=\"First_20_paragraph\">Some\n<text:span text:style-name=\"T1\">emphasized</text:span><text:span text:style-name=\"T2\">\n</text:span><text:span text:style-name=\"T3\">text</text:span> and\n<text:a xlink:type=\"simple\" xlink:href=\"http://daringfireball.net/projects/markdown/\" office:name=\"\"><text:span text:style-name=\"Definition\">a\nlink</text:span></text:a></text:p>|
25
25
  h[:latex] =
26
- %Q|\\section{This is a Title}\n\nSome \\emph{emphasized text} and\n\\href{http://daringfireball.net/projects/markdown/}{a link}|
26
+ %Q|\\section{This is a Title}\\label{this-is-a-title}\n\nSome \\emph{emphasized text} and\n\\href{http://daringfireball.net/projects/markdown/}{a link}|
27
27
  h[:beamer] =
28
- %Q|\\begin{frame}\\frametitle{This is a Title}\n\nSome \\emph{emphasized text} and\n\\href{http://daringfireball.net/projects/markdown/}{a link}\n\n\\end{frame}|
28
+ %Q|\\begin{frame}{This is a Title}\n\nSome \\emph{emphasized text} and\n\\href{http://daringfireball.net/projects/markdown/}{a link}\n\n\\end{frame}|
29
29
  h[:context] =
30
30
  %Q|\\section[this-is-a-title]{This is a Title}\n\nSome {\\em emphasized text} and\n\\useURL[url1][http://daringfireball.net/projects/markdown/][][a\nlink]\\from[url1]|
31
31
  h[:texinfo] =
32
- %Q|@node Top\n@top Top\n\n@menu\n* This is a Title::\n@end menu\n\n@node This is a Title\n@chapter This is a Title\nSome @emph{emphasized text} and @uref{http://daringfireball.net/projects/markdown/,a link}|
32
+ %Q|@node Top\n@top Top\n\n@menu\n* This is a Title::\n@end menu\n\n@node This is a Title\n@chapter This is a Title\n@anchor{#this-is-a-title}\nSome @emph{emphasized text} and @uref{http://daringfireball.net/projects/markdown/,a link}|
33
33
  h[:man] =
34
34
  %Q|.SH This is a Title\n.PP\nSome \\f[I]emphasized text\\f[] and a\nlink (http://daringfireball.net/projects/markdown/)|
35
35
  h[:markdown] =
36
36
  %Q|This is a Title\n===============\n\nSome *emphasized text* and [a\nlink](http://daringfireball.net/projects/markdown/)|
37
37
  h[:plain] =
38
- %Q|This is a Title\n===============\n\nSome emphasized text and a link|
38
+ %Q|THIS IS A TITLE\n\n\nSome _emphasized text_ and a link|
39
39
  h[:rst] =
40
- %Q|This is a Title\n===============\n\nSome *emphasized text* and `a\nlink <http://daringfireball.net/projects/markdown/>`_|
40
+ %Q|This is a Title\n===============\n\nSome *emphasized text* and `a\nlink <http://daringfireball.net/projects/markdown/>`__|
41
41
  h[:mediawiki] =
42
42
  %Q|= This is a Title =\n\nSome ''emphasized text'' and [http://daringfireball.net/projects/markdown/ a link]|
43
43
  h[:textile] =
44
- %Q|h1. This is a Title\n\nSome _emphasized text_ and \"a link\":http://daringfireball.net/projects/markdown/|
44
+ %Q|h1(#this-is-a-title). This is a Title\n\nSome _emphasized text_ and \"a link\":http://daringfireball.net/projects/markdown/|
45
45
  h[:rtf] =
46
46
  %Q|{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs36 This is a Title\\par}\n{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 Some {\\i emphasized text} and {\\field{\\*\\fldinst{HYPERLINK \"http://daringfireball.net/projects/markdown/\"}}{\\fldrslt{\\ul\na link\n}}}\n\\par}|
47
47
  h[:org] =
48
48
  %Q|* This is a Title\n\nSome /emphasized text/ and\n[[http://daringfireball.net/projects/markdown/][a link]]|
49
49
  h[:asciidoc] =
50
- %Q|This is a Title\n---------------\n\nSome _emphasized text_ and\nhttp://daringfireball.net/projects/markdown/[a link]|
50
+ %Q|[[this-is-a-title]]\nThis is a Title\n---------------\n\nSome _emphasized text_ and\nhttp://daringfireball.net/projects/markdown/[a link]|
51
51
  return h
52
52
  end
53
-
53
+
54
54
  [:markdown, :html, :rst, :latex].each do |from|
55
55
  formatted_strings.each_key do |format|
56
56
  unless from == format
57
57
  should "convert #{from} to #{format}" do
58
58
  assert_equal(
59
- PandocRuby.convert(TestConversions.formatted_strings[from], :from => from, :to => format).strip,
59
+ PandocRuby.convert(TestConversions.formatted_strings[from], :from => from, :to => format).strip,
60
60
  TestConversions.formatted_strings[format]
61
61
  )
62
62
  end
63
63
  end
64
64
  end
65
65
  end
66
-
66
+
67
67
  end
@@ -1,23 +1,23 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestPandocRuby < Test::Unit::TestCase
4
-
4
+
5
5
  def setup
6
6
  @file = File.join(File.dirname(__FILE__), 'files', 'test.md')
7
7
  @converter = PandocRuby.new(@file, :t => :rst)
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  PandocRuby.bin_path = nil
12
12
  PandocRuby.allow_file_paths = false
13
13
  end
14
-
14
+
15
15
  should "call bare pandoc when passed no options" do
16
16
  converter = PandocRuby.new(@file)
17
17
  converter.expects(:execute).with('pandoc').returns(true)
18
18
  assert converter.convert
19
19
  end
20
-
20
+
21
21
  should "convert with altered bin_path" do
22
22
  path = %x[which pandoc].strip
23
23
  PandocRuby.bin_path = path
@@ -25,7 +25,7 @@ class TestPandocRuby < Test::Unit::TestCase
25
25
  converter.expects(:execute).with("#{path}/pandoc").returns(true)
26
26
  assert converter.convert
27
27
  end
28
-
28
+
29
29
  should "treat file paths as strings by default" do
30
30
  assert_equal "<p>#{@file}</p>\n", PandocRuby.new(@file).to_html
31
31
  end
@@ -35,18 +35,17 @@ class TestPandocRuby < Test::Unit::TestCase
35
35
  assert PandocRuby.new(@file).to_html.match(%r{This is a Title})
36
36
  end
37
37
 
38
-
39
38
  should "accept short options" do
40
39
  @converter.expects(:execute).with('pandoc -t rst').returns(true)
41
40
  assert @converter.convert
42
41
  end
43
-
42
+
44
43
  should "accept long options" do
45
44
  converter = PandocRuby.new(@file, :to => :rst)
46
45
  converter.expects(:execute).with('pandoc --to rst').returns(true)
47
46
  assert converter.convert
48
47
  end
49
-
48
+
50
49
  should "accept a variety of options in initializer" do
51
50
  converter = PandocRuby.new(@file, :s, {
52
51
  :f => :markdown, :to => :rst
@@ -57,7 +56,7 @@ class TestPandocRuby < Test::Unit::TestCase
57
56
  .returns(true)
58
57
  assert converter.convert
59
58
  end
60
-
59
+
61
60
  should "accept a variety of options in convert" do
62
61
  converter = PandocRuby.new(@file)
63
62
  converter \
@@ -66,7 +65,7 @@ class TestPandocRuby < Test::Unit::TestCase
66
65
  .returns(true)
67
66
  assert converter.convert(:s, {:f => :markdown, :to => :rst}, 'no-wrap')
68
67
  end
69
-
68
+
70
69
  should "convert underscore symbol ares to hyphenated long options" do
71
70
  converter = PandocRuby.new(@file, {
72
71
  :email_obfuscation => :javascript
@@ -83,13 +82,19 @@ class TestPandocRuby < Test::Unit::TestCase
83
82
  converter.expects(:execute).with('html2markdown').returns(true)
84
83
  assert converter.convert
85
84
  end
86
-
85
+
87
86
  should "use non-executable second arg as option" do
88
87
  converter = PandocRuby.new(@file, 'toc')
89
88
  converter.expects(:execute).with('pandoc --toc').returns(true)
90
89
  assert converter.convert
91
90
  end
92
-
91
+
92
+ should "raise RuntimeError from pandoc executable error" do
93
+ assert_raise RuntimeError do
94
+ PandocRuby.new("# hello", "badopt").to_html5
95
+ end
96
+ end
97
+
93
98
  PandocRuby::READERS.each_key do |r|
94
99
  should "convert from #{r} with PandocRuby.#{r}" do
95
100
  converter = PandocRuby.send(r, @file)
@@ -97,7 +102,7 @@ class TestPandocRuby < Test::Unit::TestCase
97
102
  assert converter.convert
98
103
  end
99
104
  end
100
-
105
+
101
106
  PandocRuby::STRING_WRITERS.each_key do |w|
102
107
  should "convert to #{w} with to_#{w}" do
103
108
  converter = PandocRuby.new(@file)
@@ -108,7 +113,7 @@ class TestPandocRuby < Test::Unit::TestCase
108
113
  assert converter.send("to_#{w}", :no_wrap)
109
114
  end
110
115
  end
111
-
116
+
112
117
  PandocRuby::BINARY_WRITERS.each_key do |w|
113
118
  should "convert to #{w} with to_#{w}" do
114
119
  converter = PandocRuby.new(@file)
@@ -119,31 +124,31 @@ class TestPandocRuby < Test::Unit::TestCase
119
124
  assert converter.send("to_#{w}", :no_wrap)
120
125
  end
121
126
  end
122
-
127
+
123
128
  should "work with strings" do
124
129
  converter = PandocRuby.new('## this is a title')
125
130
  assert_match %r(h2), converter.convert
126
131
  end
127
-
132
+
128
133
  should "alias to_s" do
129
134
  assert_equal @converter.convert, @converter.to_s
130
135
  end
131
-
136
+
132
137
  should "have convert class method" do
133
138
  assert_equal @converter.convert, PandocRuby.convert(@file, :t => :rst)
134
139
  end
135
-
140
+
136
141
  should "run more than 400 times without error" do
137
142
  begin
138
143
  400.times do
139
144
  PandocRuby.convert(@file)
140
- end
145
+ end
141
146
  assert true
142
147
  rescue Errno::EMFILE, Errno::EAGAIN => e
143
148
  flunk e
144
149
  end
145
150
  end
146
-
151
+
147
152
  should "have reader and writer constants" do
148
153
  assert_equal PandocRuby::READERS, {
149
154
  "html" => "HTML",
@@ -154,7 +159,7 @@ class TestPandocRuby < Test::Unit::TestCase
154
159
  "json" => "pandoc JSON",
155
160
  "rst" => "reStructuredText"
156
161
  }
157
-
162
+
158
163
  assert_equal PandocRuby::STRING_WRITERS, {
159
164
  "mediawiki" => "MediaWiki markup",
160
165
  "html" => "HTML",
metadata CHANGED
@@ -1,57 +1,115 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 1.0.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: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mocha
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.13.3
19
+ version: '1.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.1.0
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: 0.13.3
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
27
53
  - !ruby/object:Gem::Dependency
28
54
  name: rdoc
29
55
  requirement: !ruby/object:Gem::Requirement
30
56
  requirements:
31
- - - ~>
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '4.2'
60
+ - - ">="
32
61
  - !ruby/object:Gem::Version
33
- version: '3.12'
62
+ version: 4.2.0
34
63
  type: :development
35
64
  prerelease: false
36
65
  version_requirements: !ruby/object:Gem::Requirement
37
66
  requirements:
38
- - - ~>
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '4.2'
70
+ - - ">="
39
71
  - !ruby/object:Gem::Version
40
- version: '3.12'
72
+ version: 4.2.0
41
73
  - !ruby/object:Gem::Dependency
42
74
  name: shoulda
43
75
  requirement: !ruby/object:Gem::Requirement
44
76
  requirements:
45
- - - '>='
77
+ - - "~>"
46
78
  - !ruby/object:Gem::Version
47
- version: '0'
79
+ version: '3.5'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.5.0
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.5'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 3.5.0
93
+ - !ruby/object:Gem::Dependency
94
+ name: test-unit
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '3.0'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 3.0.9
48
103
  type: :development
49
104
  prerelease: false
50
105
  version_requirements: !ruby/object:Gem::Requirement
51
106
  requirements:
52
- - - '>='
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.0'
110
+ - - ">="
53
111
  - !ruby/object:Gem::Version
54
- version: '0'
112
+ version: 3.0.9
55
113
  description: Ruby wrapper for Pandoc
56
114
  email: hi@williammelody.com
57
115
  executables: []
@@ -60,7 +118,7 @@ extra_rdoc_files:
60
118
  - LICENSE
61
119
  - README.markdown
62
120
  files:
63
- - .document
121
+ - ".document"
64
122
  - Gemfile
65
123
  - Gemfile.lock
66
124
  - LICENSE
@@ -84,17 +142,17 @@ require_paths:
84
142
  - lib
85
143
  required_ruby_version: !ruby/object:Gem::Requirement
86
144
  requirements:
87
- - - '>='
145
+ - - ">="
88
146
  - !ruby/object:Gem::Version
89
- version: '0'
147
+ version: 1.9.3
90
148
  required_rubygems_version: !ruby/object:Gem::Requirement
91
149
  requirements:
92
- - - '>='
150
+ - - ">="
93
151
  - !ruby/object:Gem::Version
94
152
  version: '0'
95
153
  requirements: []
96
154
  rubyforge_project:
97
- rubygems_version: 2.0.0
155
+ rubygems_version: 2.4.5
98
156
  signing_key:
99
157
  specification_version: 3
100
158
  summary: PandocRuby