pandoc-ruby 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,14 +44,15 @@ with `PandocRuby.bin_path = '/path/to/bin'`
44
44
 
45
45
  For more information on Pandoc, see the [Pandoc documentation](http://johnmacfarlane.net/pandoc/) or run `man pandoc`.
46
46
 
47
- Pretty much everything in the gem was derived directly from [Albino](http://github.com/github/albino).
48
-
49
47
  If you'd prefer a pure-Ruby extended markdown interpreter that can output a few different formats, take a look at [Maruku](http://maruku.rubyforge.org/).
50
48
 
49
+ This gem was inspired by [Albino](http://github.com/github/albino).
50
+
51
51
  ## Caveats
52
52
 
53
53
  * This has only been tested on *nix systems.
54
- * Some conversions may still not work and/or require additional dependencies.
54
+ * ODT is not currently supported because it is a binary format.
55
+ * PDF conversion may require additional dependencies and has not been tested.
55
56
 
56
57
  ## Note on Patches/Pull Requests
57
58
 
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ end
20
20
  require 'rake/testtask'
21
21
  Rake::TestTask.new(:test) do |test|
22
22
  test.libs << 'lib' << 'test'
23
- test.pattern = 'test/**/*_test.rb'
23
+ test.pattern = 'test/**/test_*.rb'
24
24
  test.verbose = true
25
25
  end
26
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -20,7 +20,7 @@ class PandocRuby
20
20
  def initialize(*args)
21
21
  target = args.shift
22
22
  @target = File.exists?(target) ? File.read(target) : target rescue target
23
- if args[0] && !args[0].respond_to?(:merge) && EXECUTABLES.include?(args[0])
23
+ if args[0] && !args[0].respond_to?(:each_pair) && EXECUTABLES.include?(args[0])
24
24
  @executable = args.shift
25
25
  else
26
26
  @executable = 'pandoc'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pandoc-ruby}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
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 = %q{2009-10-13}
12
+ s.date = %q{2009-10-14}
13
13
  s.description = %q{Ruby wrapper for Pandoc}
14
14
  s.email = %q{wmelody@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -25,9 +25,10 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "lib/pandoc-ruby.rb",
27
27
  "pandoc-ruby.gemspec",
28
- "test/pandoc-ruby_test.rb",
29
28
  "test/test.md",
30
- "test/test_helper.rb"
29
+ "test/test_conversions.rb",
30
+ "test/test_helper.rb",
31
+ "test/test_pandoc-ruby.rb"
31
32
  ]
32
33
  s.homepage = %q{http://github.com/autodata/pandoc-ruby}
33
34
  s.rdoc_options = ["--charset=UTF-8"]
@@ -35,8 +36,9 @@ Gem::Specification.new do |s|
35
36
  s.rubygems_version = %q{1.3.5}
36
37
  s.summary = %q{PandocRuby}
37
38
  s.test_files = [
38
- "test/pandoc-ruby_test.rb",
39
- "test/test_helper.rb"
39
+ "test/test_conversions.rb",
40
+ "test/test_helper.rb",
41
+ "test/test_pandoc-ruby.rb"
40
42
  ]
41
43
 
42
44
  if s.respond_to? :specification_version then
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+ require 'mocha'
3
+
4
+ class TestConversions < Test::Unit::TestCase
5
+
6
+ def self.formatted_strings
7
+ h = Hash.new
8
+ h[:markdown] =
9
+ "# This is a Title\n\nSome *emphasized text* and\n[a link](http://daringfireball.net/projects/markdown/)"
10
+ h[:html] =
11
+ "<div id=\"this-is-a-title\"\n><h1\n >This is a Title</h1\n ><p\n >Some <em\n >emphasized text</em\n > and <a href=\"http://daringfireball.net/projects/markdown/\"\n >a link</a\n ></p\n ></div\n>"
12
+ h[:rst] =
13
+ "This is a Title\n===============\n\nSome *emphasized text* and\n`a link <http://daringfireball.net/projects/markdown/>`_"
14
+ h[:latex] =
15
+ "\\section{This is a Title}\n\nSome \\emph{emphasized text} and\n\\href{http://daringfireball.net/projects/markdown/}{a link}"
16
+ h[:rtf] =
17
+ "{\\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}"
18
+ h[:context] =
19
+ "\\subject{This is a Title}\n\nSome {\\em emphasized text} and\n\\useURL[1][http://daringfireball.net/projects/markdown/][][a link]\\from[1]"
20
+ h[:man] =
21
+ ".SH This is a Title\n.PP\nSome \\f[I]emphasized text\\f[] and\na link (http://daringfireball.net/projects/markdown/)"
22
+ h[:mediawiki] =
23
+ "== This is a Title ==\n\nSome ''emphasized text'' and [http://daringfireball.net/projects/markdown/ a link]"
24
+ h[:texinfo] =
25
+ "@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}"
26
+ h[:docbook] =
27
+ "<section>\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 link</ulink>\n </para>\n</section>"
28
+ h[:opendocument] =
29
+ "<office:document-content xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\" xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\" xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\" xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\" xmlns:math=\"http://www.w3.org/1998/Math/MathML\" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\" xmlns:ooo=\"http://openoffice.org/2004/office\" xmlns:ooow=\"http://openoffice.org/2004/writer\" xmlns:oooc=\"http://openoffice.org/2004/calc\" xmlns:dom=\"http://www.w3.org/2001/xml-events\" xmlns:xforms=\"http://www.w3.org/2002/xforms\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" office:version=\"1.0\">\n <office:scripts />\n <office:font-face-decls>\n <style:font-face style:name=\"&amp;apos;Lucida Sans Unicode&amp;apos;\" svg:font-family=\"Lucida Sans Unicode\" />\n <style:font-face style:name=\"&amp;apos;Tahoma&amp;apos;\" svg:font-family=\"Tahoma\" />\n <style:font-face style:name=\"&amp;apos;Times New Roman&amp;apos;\" svg:font-family=\"Times New Roman\" />\n </office:font-face-decls>\n <office:automatic-styles>\n <style:style style:name=\"T1\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\" style:font-style-complex=\"italic\" /></style:style>\n <style:style style:name=\"T2\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\" style:font-style-complex=\"italic\" /></style:style>\n <style:style style:name=\"T3\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\" style:font-style-complex=\"italic\" /></style:style>\n </office:automatic-styles>\n <text:h text:style-name=\"Heading_20_1\" text:outline-level=\"1\">This\n is a Title</text:h>\n <text:p text:style-name=\"Text_20_body\">Some\n <text:span text:style-name=\"T1\">emphasized</text:span><text:span text:style-name=\"T2\"> </text:span><text:span text:style-name=\"T3\">text</text:span>\n and\n <text:a xlink:type=\"simple\" xlink:href=\"http://daringfireball.net/projects/markdown/\" office:name=\"\"><text:span text:style-name=\"Definition\">a link</text:span></text:a></text:p>\n \n</office:document-content>"
30
+ h[:s5] =
31
+ "<div class=\"layout\">\n<div id=\"controls\"></div>\n<div id=\"currentSlide\"></div>\n<div id=\"header\"></div>\n<div id=\"footer\">\n<h1\n></h1\n><h2\n></h2\n></div>\n</div>\n<div class=\"presentation\">\n\n<div class=\"slide\">\n<h1\n>This is a Title</h1\n><p\n>Some <em\n >emphasized text</em\n > and <a href=\"http://daringfireball.net/projects/markdown/\"\n >a link</a\n ></p\n></div>\n</div>"
32
+ return h
33
+ end
34
+
35
+ [:markdown, :html, :rst, :latex].each do |from|
36
+ formatted_strings.each_key do |format|
37
+ unless from == format
38
+ should "convert #{from} to #{format}" do
39
+ assert_equal(
40
+ PandocRuby.convert(TestConversions.formatted_strings[from], :from => from, :to => format),
41
+ TestConversions.formatted_strings[format]
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'mocha'
3
3
 
4
- class PandocRubyTest < Test::Unit::TestCase
4
+ class TestPandocRuby < Test::Unit::TestCase
5
5
 
6
6
  def setup
7
7
  @file = File.join(File.dirname(__FILE__), 'test.md')
@@ -72,7 +72,7 @@ class PandocRubyTest < Test::Unit::TestCase
72
72
  begin
73
73
  400.times do
74
74
  PandocRuby.convert(@file)
75
- end
75
+ end
76
76
  assert true
77
77
  rescue Errno::EMFILE, Errno::EAGAIN => e
78
78
  flunk e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Melody
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-13 00:00:00 -05:00
12
+ date: 2009-10-14 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,9 +40,10 @@ files:
40
40
  - VERSION
41
41
  - lib/pandoc-ruby.rb
42
42
  - pandoc-ruby.gemspec
43
- - test/pandoc-ruby_test.rb
44
43
  - test/test.md
44
+ - test/test_conversions.rb
45
45
  - test/test_helper.rb
46
+ - test/test_pandoc-ruby.rb
46
47
  has_rdoc: true
47
48
  homepage: http://github.com/autodata/pandoc-ruby
48
49
  licenses: []
@@ -72,5 +73,6 @@ signing_key:
72
73
  specification_version: 3
73
74
  summary: PandocRuby
74
75
  test_files:
75
- - test/pandoc-ruby_test.rb
76
+ - test/test_conversions.rb
76
77
  - test/test_helper.rb
78
+ - test/test_pandoc-ruby.rb