RbST 0.4.0 → 0.5.1

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: 0280eb7dba5780504efdeaa0669e8050a20a6cec
4
- data.tar.gz: 3d550b0ff2e56e6af1b53417e96fb3be3e0c70b1
3
+ metadata.gz: e4300ed0df2f3d9e19a5b3af60d29c6b97b8cf28
4
+ data.tar.gz: d2219182d61736eb21747b4fd91549bf3e9c9506
5
5
  SHA512:
6
- metadata.gz: e9423d17d8c6feb9ba003f6c0eba0ea2fc374b2c155a6e7a8d73be15ff1d4e062394a73492b50dfaa34da5d5f920bfd3fbfa3d1afbd7e0240bffabf64db233e4
7
- data.tar.gz: 83584b9acd84d67710169af5a3fcb9fe909055d29be054fc26c2c00a916c4276203b734d9cd9ac6e3a00f033f2f7f6c92212a2805381362feea9120f5139c7bd
6
+ metadata.gz: 6363108ae317b6d0decbde9fc16d8266716f23aa1157f53ac5dd6b5a680ff71d39b1c8ff2131b9af7adabd2290584b4a17a47630bb57058b767e213d45e71fd8
7
+ data.tar.gz: be8f6a799bf142600b11b4f8d302668ee01b5fe3786b83e4f29d6289594a6d8f47e682a8aeccb771e84841270bb8643459ebc56be48ea7fe8696507900a0b5e3
data/Gemfile CHANGED
@@ -6,9 +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"
10
- gem "rdoc", "~> 3.12"
11
- gem "rake"
12
- gem "shoulda"
13
- gem "test-unit"
9
+ gem "mocha", "~> 1.1.0"
10
+ gem "rake", "~> 10.4.2"
11
+ gem "rdoc", "~> 4.2.0"
12
+ gem "shoulda", "~> 3.5.0"
13
+ gem "test-unit", "~> 3.0.9"
14
14
  end
@@ -15,8 +15,7 @@ GEM
15
15
  metaclass (~> 0.0.1)
16
16
  power_assert (0.2.2)
17
17
  rake (10.4.2)
18
- rdoc (3.12.2)
19
- json (~> 1.4)
18
+ rdoc (4.2.0)
20
19
  shoulda (3.5.0)
21
20
  shoulda-context (~> 1.0, >= 1.0.1)
22
21
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -33,8 +32,8 @@ PLATFORMS
33
32
  ruby
34
33
 
35
34
  DEPENDENCIES
36
- mocha
37
- rake
38
- rdoc (~> 3.12)
39
- shoulda
40
- test-unit
35
+ mocha (~> 1.1.0)
36
+ rake (~> 10.4.2)
37
+ rdoc (~> 4.2.0)
38
+ shoulda (~> 3.5.0)
39
+ test-unit (~> 3.0.9)
@@ -4,7 +4,7 @@ A simple Ruby wrapper for processing reStructuredText via Python's Docutils.
4
4
 
5
5
  ## Installation
6
6
 
7
- Python 2.3+ is required.
7
+ Python 2.3+ (or 3.3+) is required.
8
8
 
9
9
  RbST is available on [RubyGems.org](http://gemcutter.org/gems/RbST).
10
10
 
@@ -18,18 +18,22 @@ RbST is available on [RubyGems.org](http://gemcutter.org/gems/RbST).
18
18
  # or
19
19
  @latex = RbST.new('*hello*').to_latex
20
20
 
21
- This takes the reStructuredText formatted file and converts it to either HTML or LaTeX. The first argument can be either a file or a string.
21
+ This takes the reStructuredText formatted file and converts it to either HTML
22
+ or LaTeX. The first argument can be either a file or a string.
22
23
 
23
24
  You can also use the `convert` class method to output HTML:
24
25
 
25
26
  puts RbST.convert('/some/file.rst')
26
27
 
27
- Arguments can be passed to `#to_html`, `#to_latex`, `new` or `convert`, accepting symbols or strings for options without arguments and hashes of strings or symbols for options with arguments.
28
+ Arguments can be passed to `#to_html`, `#to_latex`, `new` or `convert`,
29
+ accepting symbols or strings for options without arguments and hashes of
30
+ strings or symbols for options with arguments.
28
31
 
29
32
  puts RbST.new(".. a comment").to_html('strip-comments')
30
33
  # => '<div class="document">\n</div>'
31
34
 
32
- Options passed as string use hyphens while symbols use underscores. For instance, the above could also be written as:
35
+ Options passed as string use hyphens while symbols use underscores. For
36
+ instance, the above could also be written as:
33
37
 
34
38
  puts RbST.new(".. a comment").to_html(:strip_comments)
35
39
  # => '<div class="document">\n</div>'
@@ -39,33 +43,45 @@ Document parts can also be specified with the `:parts` option.
39
43
  puts RbST.new("hello world").to_html(:part => :fragment)
40
44
  # => '<p>hello world</p>'
41
45
 
42
- By default, RbST uses the `html_body` part for HTML and the `whole` part for LaTeX.
46
+ By default, RbST uses the `html_body` part for HTML and the `whole` part
47
+ for LaTeX.
43
48
 
44
- Available options can be viewed using the `RbST.html_options` and `RbST.latex_options` class methods.
49
+ Available options can be viewed using the `RbST.html_options` and
50
+ `RbST.latex_options` class methods.
45
51
 
46
- You might run into a situation where you want to specify a custom script for processing one or both of the output formats. If so, just specify the full path to the custom script for the format by passing a hash to the `RbST.executables=` method:
52
+ You might run into a situation where you want to specify a custom script for
53
+ processing one or both of the output formats. If so, just specify the full
54
+ path to the custom script for the format by passing a hash to the
55
+ `RbST.executables=` method:
47
56
 
48
57
  RbST.executables = {:html => "/some/other/path/2html.py"}
49
- RbST.new("something").to_html # uses custom executable for outputting html
50
- RbST.new("something else").to_latex # uses default executable for latex since a custom one wasn't specified
51
58
 
52
- For more information on reStructuredText, see the
53
- [ReST documentation](http://docutils.sourceforge.net/rst.html).
59
+ # uses custom executable for outputting html
60
+ RbST.new("something").to_html
61
+
62
+ # uses default executable for latex since a custom one wasn't specified
63
+ RbST.new("something else").to_latex
54
64
 
55
- ## Caveats
65
+ Similarly, if you want to explicitly specify which python executable to
66
+ use, set the path with the `RbST.python_path=` method:
56
67
 
57
- - Docutils is very slow. On my 2.5 GHz Core 2 Duo it takes over half a second to convert the test file to HTML, including about 0.2s to start up and 0.38s to process the input data. In other words, this isn't the sort of thing you'd want to be using directly in a Rails view helper.
58
- - This has only been tested on \*nix systems.
59
- - Python 3 has not been tested.
68
+ RbST.python_path = "/usr/bin/env python3"
69
+ RbST.new("something").to_latex
70
+
71
+ For more information on reStructuredText, see the
72
+ [ReST documentation](http://docutils.sourceforge.net/rst.html).
60
73
 
61
74
  ## Note on Patches/Pull Requests
62
75
 
63
- - Fork the project.
64
- - Make your feature addition or bug fix.
65
- - Add tests for it. This is important so I don't break it in a future version unintentionally.
66
- - Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
67
- - Send me a pull request. Bonus points for topic branches.
76
+ - Fork the project.
77
+ - Make your feature addition or bug fix.
78
+ - Add tests for it. This is important so I don't break it in a future version
79
+ unintentionally.
80
+ - Commit, do not mess with rakefile, version, or history. (if you want to have
81
+ your own version, that is fine but bump version in a commit by itself I can
82
+ ignore when I pull)
83
+ - Send me a pull request. Bonus points for topic branches.
68
84
 
69
85
  ## Copyright
70
86
 
71
- Copyright (c) 2009-2012 William Melody. See LICENSE for details.
87
+ Copyright (c) 2009-2015 William Melody. See LICENSE for details.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "RbST"
8
- s.version = "0.4.0"
8
+ s.version = "0.5.1"
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"]
@@ -45,17 +45,23 @@ Gem::Specification.new do |s|
45
45
  s.specification_version = 3
46
46
 
47
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
- s.add_development_dependency(%q<mocha>, [">= 0"])
49
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
50
- s.add_development_dependency(%q<shoulda>, [">= 0"])
48
+ s.add_development_dependency('mocha', '~> 1.1', '> 1.1.0')
49
+ s.add_development_dependency('rake', '~> 10.4', '>= 10.4.2')
50
+ s.add_development_dependency('rdoc', '~> 4.2', '>= 4.2.0')
51
+ s.add_development_dependency('shoulda', '~> 3.5', '>= 3.5.0')
52
+ s.add_development_dependency('test-unit', '~> 3.0', '>= 3.0.9')
51
53
  else
52
- s.add_dependency(%q<mocha>, [">= 0"])
53
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
54
- s.add_dependency(%q<shoulda>, [">= 0"])
54
+ s.add_dependency(%q<mocha>, ["~> 1.1.0"])
55
+ s.add_dependency(%q<rake>, ["~> 10.4.2"])
56
+ s.add_dependency(%q<rdoc>, ["~> 4.2.0"])
57
+ s.add_dependency(%q<shoulda>, ["~> 3.5.0"])
58
+ s.add_dependency(%q<test-unit>, ["~> 3.0.9"])
55
59
  end
56
60
  else
57
- s.add_dependency(%q<mocha>, [">= 0"])
58
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
- s.add_dependency(%q<shoulda>, [">= 0"])
61
+ s.add_dependency(%q<mocha>, ["~> 1.1.0"])
62
+ s.add_dependency(%q<rake>, ["~> 10.4.2"])
63
+ s.add_dependency(%q<rdoc>, ["~> 4.2.0"])
64
+ s.add_dependency(%q<shoulda>, ["~> 3.5.0"])
65
+ s.add_dependency(%q<test-unit>, ["~> 3.0.9"])
60
66
  end
61
67
  end
@@ -1,24 +1,29 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  class RbST
4
-
5
- @@executable_path = File.expand_path(File.join(File.dirname(__FILE__), "rst2parts"))
4
+ @@python_path="python"
5
+ @@executable_path = File.expand_path(
6
+ File.join(File.dirname(__FILE__), "rst2parts")
7
+ )
6
8
  @@executables = {
7
9
  :html => File.join(@@executable_path, "rst2html.py"),
8
10
  :latex => File.join(@@executable_path, "rst2latex.py")
9
11
  }
10
-
11
- # Takes a string or file path plus any additional options and converts the input.
12
+
13
+ # Takes a string or file path plus any additional options and converts the
14
+ # input.
12
15
  def self.convert(*args)
13
16
  new(*args).convert
14
17
  end
15
18
 
16
- # Print LaTeX-Specific Options, General Docutils Options and reStructuredText Parser Options.
19
+ # Print LaTeX-Specific Options, General Docutils Options and reStructuredText
20
+ # Parser Options.
17
21
  def self.latex_options
18
22
  new.print_options(:latex)
19
23
  end
20
24
 
21
- # Print HTML-Specific Options, General Docutils Options and reStructuredText Parser Options.
25
+ # Print HTML-Specific Options, General Docutils Options and reStructuredText
26
+ # Parser Options.
22
27
  def self.html_options
23
28
  new.print_options(:html)
24
29
  end
@@ -35,7 +40,15 @@ class RbST
35
40
  # Return the executable hash.
36
41
  def self.executables; @@executables end
37
42
 
38
- # Takes a string or file path plus any additional options and creates a new converter object.
43
+ # Specify a python path or executable.
44
+ def self.python_path=(path_to_python)
45
+ @@python_path = path_to_python
46
+ end
47
+ # Return the python path.
48
+ def self.python_path; @@python_path end
49
+
50
+ # Takes a string or file path plus any additional options and creates a new
51
+ # converter object.
39
52
  def initialize(*args)
40
53
  target = args.shift
41
54
  @target = File.exists?(target) ? File.read(target) : target rescue target
@@ -44,7 +57,10 @@ class RbST
44
57
 
45
58
  def convert # :nodoc:
46
59
  @output_format ||= :html
47
- execute "python #{@@executables[@output_format]}" + convert_options
60
+ execute(
61
+ "#{@@python_path} #{@@executables[@output_format]}" +
62
+ convert_options
63
+ )
48
64
  end
49
65
  alias_method :to_s, :convert
50
66
 
@@ -62,19 +78,21 @@ class RbST
62
78
  convert
63
79
  end
64
80
 
65
- # Formats and prints the options from the docutils help in the way they'd be specified in RbST: strings, symbols and hashes.
81
+ # Formats and prints the options from the docutils help in the way they'd be
82
+ # specified in RbST: strings, symbols and hashes.
66
83
  def print_options(format)
67
- help = execute("python #{@@executables[format]} --help")
68
- # non-hyphenated long options to symbols
84
+ help = execute("#{@@python_path} #{@@executables[format]} --help")
85
+ # Convert non-hyphenated long options to symbols
69
86
  help.gsub!(/(\-\-)([A-Za-z0-9]+)([=|\s])/, ':\2\3')
70
- # hyphenated long options to quoted strings
87
+ # Convert hyphenated long options to quoted strings
71
88
  help.gsub!(/(\-\-)([\w|\-]+)(\n)?[^$|^=|\]]?/, '\'\2\'\3')
72
- # equal to hashrocket
89
+ # Convert equal signs to hashrocket
73
90
  help.gsub!(/\=/, ' => ')
74
- # hort options to symbols
91
+ # Convert short options to symbols
75
92
  help.gsub!(/([^\w])\-(\w)([^\w])/, '\1:\2\1')
76
- # short options with args get a hashrocket
93
+ # Convert short options with args get a hashrocket
77
94
  help.gsub!(/(:\w) </, '\1 => <')
95
+ # Print converted help text
78
96
  puts help
79
97
  end
80
98
 
@@ -6,6 +6,7 @@ try:
6
6
  except:
7
7
  pass
8
8
 
9
+ import codecs
9
10
  import sys
10
11
  from transform import transform
11
12
  from docutils.writers.html4css1 import Writer
@@ -14,4 +15,10 @@ def main():
14
15
  return transform(writer=Writer(), part='html_body')
15
16
 
16
17
  if __name__ == '__main__':
18
+ # Python 2 wants an encoded string for unicode, while Python 3 views an
19
+ # encoded string as bytes and asks for a string. Solution via:
20
+ # http://stackoverflow.com/a/24104423
21
+ if sys.version_info[0] < 3:
22
+ UTF8Writer = codecs.getwriter('utf8')
23
+ sys.stdout = UTF8Writer(sys.stdout)
17
24
  sys.stdout.write(main())
@@ -6,6 +6,8 @@ try:
6
6
  except:
7
7
  pass
8
8
 
9
+ import codecs
10
+ import sys
9
11
  from transform import transform
10
12
  from docutils.writers.latex2e import Writer
11
13
 
@@ -13,4 +15,10 @@ def main():
13
15
  return transform(writer=Writer(), part='whole')
14
16
 
15
17
  if __name__ == '__main__':
16
- print(main())
18
+ # Python 2 wants an encoded string for unicode, while Python 3 views an
19
+ # encoded string as bytes and asks for a string. Solution via:
20
+ # http://stackoverflow.com/a/24104423
21
+ if sys.version_info[0] < 3:
22
+ UTF8Writer = codecs.getwriter('utf8')
23
+ sys.stdout = UTF8Writer(sys.stdout)
24
+ sys.stdout.write(main())
@@ -23,7 +23,7 @@ def transform(writer=None, part=None):
23
23
 
24
24
  if len(args) == 1:
25
25
  try:
26
- content = open(args[0], 'r').read()
26
+ content = open(args[0], 'rb').read()
27
27
  except IOError:
28
28
  content = args[0]
29
29
  else:
@@ -36,5 +36,5 @@ def transform(writer=None, part=None):
36
36
  )
37
37
 
38
38
  if opts.part in parts:
39
- return parts[opts.part].encode(parts["encoding"])
40
- return ''
39
+ return parts[opts.part]
40
+ return u''
@@ -642,4 +642,3 @@ Title reference (book, etc.); standard default role
642
642
  \end{longtable*}
643
643
 
644
644
  \end{document}
645
-
@@ -11,12 +11,17 @@ class TestRbST < Test::Unit::TestCase
11
11
  File.join(File.dirname(__FILE__), 'files', "test.#{f}")
12
12
  )
13
13
  end
14
- @rst2parts_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'rst2parts'))
14
+ @rst2parts_path = File.expand_path(
15
+ File.join(File.dirname(__FILE__), '..', 'lib', 'rst2parts')
16
+ )
15
17
  end
16
18
 
17
19
  should "call bare rest2parts when passed no options" do
18
20
  converter = RbST.new(@rst_file)
19
- converter.expects(:execute).with("python #{@rst2parts_path}/rst2html.py").returns(true)
21
+ converter \
22
+ .expects(:execute) \
23
+ .with("python #{@rst2parts_path}/rst2html.py") \
24
+ .returns(true)
20
25
  assert converter.convert
21
26
  end
22
27
 
@@ -25,7 +30,10 @@ class TestRbST < Test::Unit::TestCase
25
30
  default_executables = RbST.executables
26
31
  RbST.executables = executables
27
32
  converter = RbST.new(@file)
28
- converter.expects(:execute).with("python #{executables[:html]}").returns(true)
33
+ converter \
34
+ .expects(:execute) \
35
+ .with("python #{executables[:html]}") \
36
+ .returns(true)
29
37
  assert converter.to_html
30
38
  RbST.executables = default_executables
31
39
  end
@@ -42,46 +50,141 @@ class TestRbST < Test::Unit::TestCase
42
50
 
43
51
  should "convert ReST to html" do
44
52
  html = RbST.new(@rst_file).to_html
45
- assert_equal html, File.read(@html_file)
53
+ assert_equal(
54
+ File.read(@html_file),
55
+ html
56
+ )
46
57
  end
47
58
 
48
59
  should "convert ReST to LaTeX" do
49
60
  latex = RbST.new(@rst_file).to_latex
50
- assert_equal latex, File.read(@latex_file)
61
+ assert_equal(
62
+ File.read(@latex_file),
63
+ latex
64
+ )
51
65
  end
52
66
 
53
67
  [:html, :latex].each do |f|
54
68
  should "accept options on #to_#{f}" do
55
69
  converter = RbST.new(@rst_file)
56
- converter.expects(:execute).with("python #{@rst2parts_path}/rst2#{f}.py --raw-enabled").returns(true)
70
+ converter \
71
+ .expects(:execute) \
72
+ .with("python #{@rst2parts_path}/rst2#{f}.py --raw-enabled") \
73
+ .returns(true)
57
74
  assert converter.send("to_#{f}", :raw_enabled)
58
75
  end
59
76
  end
60
77
 
61
78
  should "recognize strip_comments option" do
62
79
  html_with_comment = RbST.convert(".. comment")
63
- assert_equal html_with_comment, %Q{<div class=\"document\">\n<!-- comment -->\n</div>\n}
80
+ assert_equal(
81
+ html_with_comment,
82
+ %Q{<div class=\"document\">\n<!-- comment -->\n</div>\n}
83
+ )
64
84
  html_without_comment = RbST.convert(".. comment", 'strip-comments')
65
- assert_equal html_without_comment, %Q{<div class=\"document\">\n</div>\n}
85
+ assert_equal(
86
+ html_without_comment,
87
+ %Q{<div class=\"document\">\n</div>\n}
88
+ )
66
89
  end
67
90
 
68
91
  should "recognize cloak_email_addresses option" do
69
92
  html_with_uncloaked_email = RbST.convert("steve@mac.com")
70
- assert_equal %Q{<div class=\"document\">\n<p><a class=\"reference external\" href=\"mailto:steve&#64;mac.com\">steve&#64;mac.com</a></p>\n</div>\n}, html_with_uncloaked_email
93
+ assert_equal(
94
+ %Q{<div class=\"document\">\n<p><a class=\"reference external\" href=\"mailto:steve&#64;mac.com\">steve&#64;mac.com</a></p>\n</div>\n},
95
+ html_with_uncloaked_email
96
+ )
71
97
  html_with_cloaked_email = RbST.convert("steve@mac.com", 'cloak-email-addresses')
72
- assert_equal %Q{<div class=\"document\">\n<p><a class=\"reference external\" href=\"mailto:steve&#37;&#52;&#48;mac&#46;com\">steve<span>&#64;</span>mac<span>&#46;</span>com</a></p>\n</div>\n}, html_with_cloaked_email
98
+ assert_equal(
99
+ %Q{<div class=\"document\">\n<p><a class=\"reference external\" href=\"mailto:steve&#37;&#52;&#48;mac&#46;com\">steve<span>&#64;</span>mac<span>&#46;</span>com</a></p>\n</div>\n},
100
+ html_with_cloaked_email
101
+ )
73
102
  end
74
103
 
75
104
  should "recognize part option" do
76
105
  html_body = RbST.convert("hello world", :part => :html_body)
77
- assert_equal %Q{<div class=\"document\">\n<p>hello world</p>\n</div>\n}, html_body
106
+ assert_equal(
107
+ %Q{<div class=\"document\">\n<p>hello world</p>\n</div>\n},
108
+ html_body
109
+ )
78
110
  fragment = RbST.convert("hello world", :part => :fragment)
79
- assert_equal %Q{<p>hello world</p>\n}, fragment
111
+ assert_equal(
112
+ %Q{<p>hello world</p>\n},
113
+ fragment
114
+ )
80
115
  end
81
116
 
82
- should "convert unicode" do
83
- output = RbST.convert("Hello ☃", :part => :fragment)
84
- assert_equal %Q{<p>Hello ☃</p>\n}, output
117
+ should "convert to html with unicode" do
118
+ test_string = "Hello ☃".force_encoding("utf-8")
119
+ output = RbST.new(test_string).to_html(:part => :fragment)
120
+ assert_equal(
121
+ %Q{<p>#{test_string}</p>\n},
122
+ output
123
+ )
124
+ end
125
+
126
+ should "convert to latex with unicode" do
127
+ test_string = "Hello ☃".force_encoding("utf-8")
128
+ output = RbST.new(test_string).to_latex(:part => :body)
129
+ assert_equal(
130
+ %Q{\n#{test_string}\n},
131
+ output
132
+ )
133
+ end
134
+
135
+ should "execute with custom python path" do
136
+ RbST.python_path = "/usr/bin/env python3"
137
+ converter = RbST.new(@rst_file)
138
+ converter \
139
+ .expects(:execute) \
140
+ .with("/usr/bin/env python3 #{@rst2parts_path}/rst2html.py") \
141
+ .returns(true)
142
+ assert converter.convert
143
+ RbST.python_path = "python"
144
+ end
145
+
146
+ should "convert to html with python3" do
147
+ RbST.python_path = "/usr/bin/env python3"
148
+ test_string = "Hello ☃".force_encoding("utf-8")
149
+ output = RbST.new(test_string).to_html(:part => :fragment)
150
+ assert_equal(
151
+ %Q{<p>#{test_string}</p>\n},
152
+ output
153
+ )
154
+ RbST.python_path = "python"
155
+ end
156
+
157
+ should "convert to latex with python3" do
158
+ RbST.python_path = "/usr/bin/env python3"
159
+ test_string = "Hello ☃".force_encoding("utf-8")
160
+ output = RbST.new(test_string).to_latex(:part => :body)
161
+ assert_equal(
162
+ %Q{\n#{test_string}\n},
163
+ output
164
+ )
165
+ RbST.python_path = "python"
166
+ end
167
+
168
+ should "convert to html with python2" do
169
+ RbST.python_path = "/usr/bin/env python2"
170
+ test_string = "Hello ☃".force_encoding("utf-8")
171
+ output = RbST.new(test_string).to_html(:part => :fragment)
172
+ assert_equal(
173
+ %Q{<p>#{test_string}</p>\n},
174
+ output
175
+ )
176
+ RbST.python_path = "python"
177
+ end
178
+
179
+ should "convert to latex with python2" do
180
+ RbST.python_path = "/usr/bin/env python2"
181
+ test_string = "Hello ☃".force_encoding("utf-8")
182
+ output = RbST.new(test_string).to_latex(:part => :body)
183
+ assert_equal(
184
+ %Q{\n#{test_string}\n},
185
+ output
186
+ )
187
+ RbST.python_path = "python"
85
188
  end
86
189
 
87
190
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RbST
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Melody
@@ -14,44 +14,102 @@ dependencies:
14
14
  name: mocha
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ - - ">"
21
+ - !ruby/object:Gem::Version
22
+ version: 1.1.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - ">"
31
+ - !ruby/object:Gem::Version
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'
17
40
  - - ">="
18
41
  - !ruby/object:Gem::Version
19
- version: '0'
42
+ version: 10.4.2
20
43
  type: :development
21
44
  prerelease: false
22
45
  version_requirements: !ruby/object:Gem::Requirement
23
46
  requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '10.4'
24
50
  - - ">="
25
51
  - !ruby/object:Gem::Version
26
- version: '0'
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
  - - "~>"
32
58
  - !ruby/object:Gem::Version
33
- version: '3.12'
59
+ version: '4.2'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
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
  - - "~>"
39
68
  - !ruby/object:Gem::Version
40
- version: '3.12'
69
+ version: '4.2'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
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:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
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'
45
100
  - - ">="
46
101
  - !ruby/object:Gem::Version
47
- version: '0'
102
+ version: 3.0.9
48
103
  type: :development
49
104
  prerelease: false
50
105
  version_requirements: !ruby/object:Gem::Requirement
51
106
  requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.0'
52
110
  - - ">="
53
111
  - !ruby/object:Gem::Version
54
- version: '0'
112
+ version: 3.0.9
55
113
  description: A simple Ruby wrapper for processing reStructuredText via Python's Docutils
56
114
  email: hi@williammelody.com
57
115
  executables: []