pandoc-ruby 0.4.1 → 0.5.0
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.
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/lib/pandoc-ruby.rb +27 -11
- data/pandoc-ruby.gemspec +23 -32
- data/test/test_conversions.rb +40 -20
- data/test/test_pandoc-ruby.rb +55 -23
- metadata +19 -16
- data/.gitignore +0 -5
data/README.markdown
CHANGED
@@ -8,7 +8,7 @@ Pandoc can read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and
|
|
8
8
|
|
9
9
|
First, make sure to [install Pandoc](http://johnmacfarlane.net/pandoc/#installing-pandoc).
|
10
10
|
|
11
|
-
Next, install PandocRuby from [
|
11
|
+
Next, install PandocRuby from [RubyGems](http://rubygems.org/gems/pandoc-ruby).
|
12
12
|
|
13
13
|
gem install pandoc-ruby
|
14
14
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/pandoc-ruby.rb
CHANGED
@@ -12,25 +12,41 @@ class PandocRuby
|
|
12
12
|
]
|
13
13
|
|
14
14
|
READERS = {
|
15
|
-
'
|
16
|
-
'
|
17
|
-
'
|
18
|
-
'
|
15
|
+
'native' => 'pandoc native',
|
16
|
+
'json' => 'pandoc JSON',
|
17
|
+
'markdown' => 'markdown',
|
18
|
+
'rst' => 'reStructuredText',
|
19
|
+
'textile' => 'textile',
|
20
|
+
'html' => 'HTML',
|
21
|
+
'latex' => 'LaTeX',
|
19
22
|
}
|
20
23
|
|
21
24
|
WRITERS = {
|
22
|
-
'
|
23
|
-
'
|
25
|
+
'native' => 'pandoc native',
|
26
|
+
'json' => 'pandoc JSON',
|
24
27
|
'html' => 'HTML',
|
28
|
+
'html5' => 'HTML5',
|
29
|
+
's5' => 'S5 HTML slideshow',
|
30
|
+
'slidy' => 'Slidy HTML slideshow',
|
31
|
+
'dzslides' => 'Dzslides HTML slideshow',
|
32
|
+
'docbook' => 'DocBook XML',
|
33
|
+
'opendocument' => 'OpenDocument XML',
|
25
34
|
'latex' => 'LaTeX',
|
35
|
+
'beamer' => 'Beamer PDF slideshow',
|
26
36
|
'context' => 'ConTeXt',
|
37
|
+
'texinfo' => 'GNU Texinfo',
|
27
38
|
'man' => 'groff man',
|
39
|
+
'markdown' => 'markdown',
|
40
|
+
'plain' => 'plain',
|
41
|
+
'rst' => 'reStructuredText',
|
28
42
|
'mediawiki' => 'MediaWiki markup',
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'
|
33
|
-
'
|
43
|
+
'textile' => 'textile',
|
44
|
+
'rtf' => 'rich text format',
|
45
|
+
'org' => 'emacs org mode',
|
46
|
+
'asciidoc' => 'asciidoc',
|
47
|
+
'odt' => 'odt',
|
48
|
+
'docx' => 'docx',
|
49
|
+
'epub' => 'epub'
|
34
50
|
}
|
35
51
|
|
36
52
|
def self.bin_path=(path)
|
data/pandoc-ruby.gemspec
CHANGED
@@ -1,54 +1,45 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "pandoc-ruby"
|
8
|
+
s.version = "0.5.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 =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-04-01"
|
13
|
+
s.description = "Ruby wrapper for Pandoc"
|
14
|
+
s.email = "wmelody@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.markdown"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"pandoc-ruby.gemspec",
|
28
|
-
"test/benchmark.rb",
|
29
|
-
"test/files/benchmark.txt",
|
30
|
-
"test/files/test.md",
|
31
|
-
"test/test_conversions.rb",
|
32
|
-
"test/test_helper.rb",
|
33
|
-
"test/test_pandoc-ruby.rb"
|
34
|
-
]
|
35
|
-
s.homepage = %q{http://rdoc.info/projects/alphabetum/pandoc-ruby}
|
36
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.6}
|
39
|
-
s.summary = %q{PandocRuby}
|
40
|
-
s.test_files = [
|
21
|
+
"LICENSE",
|
22
|
+
"README.markdown",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/pandoc-ruby.rb",
|
26
|
+
"pandoc-ruby.gemspec",
|
41
27
|
"test/benchmark.rb",
|
42
|
-
|
43
|
-
|
44
|
-
|
28
|
+
"test/files/benchmark.txt",
|
29
|
+
"test/files/test.md",
|
30
|
+
"test/test_conversions.rb",
|
31
|
+
"test/test_helper.rb",
|
32
|
+
"test/test_pandoc-ruby.rb"
|
45
33
|
]
|
34
|
+
s.homepage = "http://rdoc.info/projects/alphabetum/pandoc-ruby"
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = "1.8.10"
|
37
|
+
s.summary = "PandocRuby"
|
46
38
|
|
47
39
|
if s.respond_to? :specification_version then
|
48
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
40
|
s.specification_version = 3
|
50
41
|
|
51
|
-
if Gem::Version.new(Gem::
|
42
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
43
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
44
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
54
45
|
else
|
data/test/test_conversions.rb
CHANGED
@@ -4,33 +4,53 @@ class TestConversions < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def self.formatted_strings
|
6
6
|
h = Hash.new
|
7
|
-
h[:
|
8
|
-
"
|
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/\",\"\")]]|
|
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/\",\"\"]]}]}]]|
|
9
11
|
h[:html] =
|
10
|
-
|
11
|
-
h[:
|
12
|
-
"This is a Title
|
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
|
+
h[:html5] =
|
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
|
+
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>|
|
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>|
|
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>|
|
21
|
+
h[:docbook] =
|
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
|
+
h[:opendocument] =
|
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>|
|
13
25
|
h[:latex] =
|
14
|
-
|
15
|
-
h[:
|
16
|
-
|
26
|
+
%Q|\\section{This is a Title}\n\nSome \\emph{emphasized text} and\n\\href{http://daringfireball.net/projects/markdown/}{a link}|
|
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}|
|
17
29
|
h[:context] =
|
18
|
-
|
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
|
+
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}|
|
19
33
|
h[:man] =
|
20
|
-
|
34
|
+
%Q|.SH This is a Title\n.PP\nSome \\f[I]emphasized text\\f[] and a\nlink (http://daringfireball.net/projects/markdown/)|
|
35
|
+
h[:markdown] =
|
36
|
+
%Q|This is a Title\n===============\n\nSome *emphasized text* and [a\nlink](http://daringfireball.net/projects/markdown/)|
|
37
|
+
h[:plain] =
|
38
|
+
%Q|This is a Title\n===============\n\nSome emphasized text and a link|
|
39
|
+
h[:rst] =
|
40
|
+
%Q|This is a Title\n===============\n\nSome *emphasized text* and `a\nlink <http://daringfireball.net/projects/markdown/>`_|
|
21
41
|
h[:mediawiki] =
|
22
|
-
|
23
|
-
h[:
|
24
|
-
|
25
|
-
h[:
|
26
|
-
|
27
|
-
h[:
|
28
|
-
|
29
|
-
h[:
|
30
|
-
|
42
|
+
%Q|= This is a Title =\n\nSome ''emphasized text'' and [http://daringfireball.net/projects/markdown/ a link]|
|
43
|
+
h[:textile] =
|
44
|
+
%Q|h1. This is a Title\n\nSome _emphasized text_ and \"a link\":http://daringfireball.net/projects/markdown/|
|
45
|
+
h[:rtf] =
|
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
|
+
h[:org] =
|
48
|
+
%Q|* This is a Title\n\nSome /emphasized text/ and\n[[http://daringfireball.net/projects/markdown/][a link]]|
|
49
|
+
h[:asciidoc] =
|
50
|
+
%Q|This is a Title\n---------------\n\nSome _emphasized text_ and\nhttp://daringfireball.net/projects/markdown/[a link]|
|
31
51
|
return h
|
32
52
|
end
|
33
|
-
|
53
|
+
|
34
54
|
[:markdown, :html, :rst, :latex].each do |from|
|
35
55
|
formatted_strings.each_key do |format|
|
36
56
|
unless from == format
|
data/test/test_pandoc-ruby.rb
CHANGED
@@ -27,7 +27,7 @@ class TestPandocRuby < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
should "treat file paths as strings by default" do
|
30
|
-
assert_equal "<p
|
30
|
+
assert_equal "<p>#{@file}</p>", PandocRuby.new(@file).to_html
|
31
31
|
end
|
32
32
|
|
33
33
|
should "treat file paths as file paths when enabled" do
|
@@ -48,20 +48,33 @@ class TestPandocRuby < Test::Unit::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
should "accept a variety of options in initializer" do
|
51
|
-
converter = PandocRuby.new(@file, :s, {
|
52
|
-
|
51
|
+
converter = PandocRuby.new(@file, :s, {
|
52
|
+
:f => :markdown, :to => :rst
|
53
|
+
}, 'no-wrap')
|
54
|
+
converter \
|
55
|
+
.expects(:execute) \
|
56
|
+
.with('pandoc -s --to=rst -f markdown --no-wrap') \
|
57
|
+
.returns(true)
|
53
58
|
assert converter.convert
|
54
59
|
end
|
55
60
|
|
56
61
|
should "accept a variety of options in convert" do
|
57
62
|
converter = PandocRuby.new(@file)
|
58
|
-
converter
|
63
|
+
converter \
|
64
|
+
.expects(:execute) \
|
65
|
+
.with('pandoc -s --to=rst -f markdown --no-wrap') \
|
66
|
+
.returns(true)
|
59
67
|
assert converter.convert(:s, {:f => :markdown, :to => :rst}, 'no-wrap')
|
60
68
|
end
|
61
69
|
|
62
70
|
should "convert underscore symbol ares to hyphenated long options" do
|
63
|
-
converter = PandocRuby.new(@file, {
|
64
|
-
|
71
|
+
converter = PandocRuby.new(@file, {
|
72
|
+
:email_obfuscation => :javascript
|
73
|
+
}, :table_of_contents)
|
74
|
+
converter \
|
75
|
+
.expects(:execute) \
|
76
|
+
.with('pandoc --email-obfuscation=javascript --table-of-contents') \
|
77
|
+
.returns(true)
|
65
78
|
assert converter.convert
|
66
79
|
end
|
67
80
|
|
@@ -88,7 +101,10 @@ class TestPandocRuby < Test::Unit::TestCase
|
|
88
101
|
PandocRuby::WRITERS.each_key do |w|
|
89
102
|
should "convert to #{w} with to_#{w}" do
|
90
103
|
converter = PandocRuby.new(@file)
|
91
|
-
converter
|
104
|
+
converter \
|
105
|
+
.expects(:execute) \
|
106
|
+
.with("pandoc --no-wrap --to=#{w}") \
|
107
|
+
.returns(true)
|
92
108
|
assert converter.send("to_#{w}", :no_wrap)
|
93
109
|
end
|
94
110
|
end
|
@@ -119,25 +135,41 @@ class TestPandocRuby < Test::Unit::TestCase
|
|
119
135
|
|
120
136
|
should "have reader and writer constants" do
|
121
137
|
assert_equal PandocRuby::READERS, {
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
138
|
+
"html" => "HTML",
|
139
|
+
"latex" => "LaTeX",
|
140
|
+
"textile" => "textile",
|
141
|
+
"native" => "pandoc native",
|
142
|
+
"markdown" => "markdown",
|
143
|
+
"json" => "pandoc JSON",
|
144
|
+
"rst" => "reStructuredText"
|
126
145
|
}
|
127
146
|
|
128
147
|
assert_equal PandocRuby::WRITERS, {
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
148
|
+
"mediawiki" => "MediaWiki markup",
|
149
|
+
"html" => "HTML",
|
150
|
+
"plain" => "plain",
|
151
|
+
"docx" => "docx",
|
152
|
+
"latex" => "LaTeX",
|
153
|
+
"s5" => "S5 HTML slideshow",
|
154
|
+
"textile" => "textile",
|
155
|
+
"texinfo" => "GNU Texinfo",
|
156
|
+
"docbook" => "DocBook XML",
|
157
|
+
"html5" => "HTML5",
|
158
|
+
"native" => "pandoc native",
|
159
|
+
"epub" => "epub",
|
160
|
+
"org" => "emacs org mode",
|
161
|
+
"rtf" => "rich text format",
|
162
|
+
"markdown" => "markdown",
|
163
|
+
"man" => "groff man",
|
164
|
+
"dzslides" => "Dzslides HTML slideshow",
|
165
|
+
"beamer" => "Beamer PDF slideshow",
|
166
|
+
"json" => "pandoc JSON",
|
167
|
+
"opendocument" => "OpenDocument XML",
|
168
|
+
"slidy" => "Slidy HTML slideshow",
|
169
|
+
"rst" => "reStructuredText",
|
170
|
+
"context" => "ConTeXt",
|
171
|
+
"odt" => "odt",
|
172
|
+
"asciidoc" => "asciidoc"
|
141
173
|
}
|
142
174
|
|
143
175
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pandoc-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- William Melody
|
@@ -14,16 +15,17 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2012-04-01 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: shoulda
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
27
29
|
segments:
|
28
30
|
- 0
|
29
31
|
version: "0"
|
@@ -33,9 +35,11 @@ dependencies:
|
|
33
35
|
name: mocha
|
34
36
|
prerelease: false
|
35
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
36
39
|
requirements:
|
37
40
|
- - ">="
|
38
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
39
43
|
segments:
|
40
44
|
- 0
|
41
45
|
version: "0"
|
@@ -52,7 +56,6 @@ extra_rdoc_files:
|
|
52
56
|
- README.markdown
|
53
57
|
files:
|
54
58
|
- .document
|
55
|
-
- .gitignore
|
56
59
|
- LICENSE
|
57
60
|
- README.markdown
|
58
61
|
- Rakefile
|
@@ -65,38 +68,38 @@ files:
|
|
65
68
|
- test/test_conversions.rb
|
66
69
|
- test/test_helper.rb
|
67
70
|
- test/test_pandoc-ruby.rb
|
68
|
-
has_rdoc: true
|
69
71
|
homepage: http://rdoc.info/projects/alphabetum/pandoc-ruby
|
70
72
|
licenses: []
|
71
73
|
|
72
74
|
post_install_message:
|
73
|
-
rdoc_options:
|
74
|
-
|
75
|
+
rdoc_options: []
|
76
|
+
|
75
77
|
require_paths:
|
76
78
|
- lib
|
77
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
78
81
|
requirements:
|
79
82
|
- - ">="
|
80
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
81
85
|
segments:
|
82
86
|
- 0
|
83
87
|
version: "0"
|
84
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
85
90
|
requirements:
|
86
91
|
- - ">="
|
87
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
88
94
|
segments:
|
89
95
|
- 0
|
90
96
|
version: "0"
|
91
97
|
requirements: []
|
92
98
|
|
93
99
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.8.10
|
95
101
|
signing_key:
|
96
102
|
specification_version: 3
|
97
103
|
summary: PandocRuby
|
98
|
-
test_files:
|
99
|
-
|
100
|
-
- test/test_conversions.rb
|
101
|
-
- test/test_helper.rb
|
102
|
-
- test/test_pandoc-ruby.rb
|
104
|
+
test_files: []
|
105
|
+
|