RbST 0.5.1 → 0.6.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
- SHA1:
3
- metadata.gz: e4300ed0df2f3d9e19a5b3af60d29c6b97b8cf28
4
- data.tar.gz: d2219182d61736eb21747b4fd91549bf3e9c9506
2
+ SHA256:
3
+ metadata.gz: cb040f492fea5af5b1c799491eba7dc9d443c84bdcb1442021e2f6269b6e2975
4
+ data.tar.gz: e763016d684b56fb669531eeff5f8c9c283011832f5eb75efd7ccf042577be59
5
5
  SHA512:
6
- metadata.gz: 6363108ae317b6d0decbde9fc16d8266716f23aa1157f53ac5dd6b5a680ff71d39b1c8ff2131b9af7adabd2290584b4a17a47630bb57058b767e213d45e71fd8
7
- data.tar.gz: be8f6a799bf142600b11b4f8d302668ee01b5fe3786b83e4f29d6289594a6d8f47e682a8aeccb771e84841270bb8643459ebc56be48ea7fe8696507900a0b5e3
6
+ metadata.gz: 6a85b3598d54dc0ba2fd9d7bcb1a2e9e242a3829c84e7482cd8496f710faf72701aeaed737b638525a9514b021588ba687764ddf99022c867b4f85ab55d01c16
7
+ data.tar.gz: 1a045128fb2c883db9df03df7ac5397544831c8529bf40cc040f417973ab6ff16d454604930ee06b2d1f32e59f83e1ce11fab8baeed03d94134911694833c7ed
data/.document CHANGED
@@ -1,4 +1,4 @@
1
- README.markdown
1
+ README.md
2
2
  lib/**/*.rb
3
3
  bin/*
4
4
  features/**/*.feature
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "http://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'http://rubygems.org'
2
4
  # Add dependencies required to use your gem here.
3
5
  # Example:
4
6
  # gem "activesupport", ">= 2.3.5"
@@ -6,9 +8,44 @@ source "http://rubygems.org"
6
8
  # Add dependencies to develop your gem here.
7
9
  # Include everything needed to run rake, tests, features, etc.
8
10
  group :development, :test do
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"
11
+ # minitest
12
+ #
13
+ # minitest provides a complete suite of testing facilities supporting TDD,
14
+ # BDD, mocking, and benchmarking.
15
+ #
16
+ # https://rubygems.org/gems/minitest
17
+ # https://github.com/seattlerb/minitest
18
+ gem 'minitest'
19
+ # mocha
20
+ #
21
+ # Mocking and stubbing library with JMock/SchMock syntax, which allows
22
+ # mocking and stubbing of methods on real (non-mock) classes.
23
+ #
24
+ # https://rubygems.org/gems/mocha
25
+ # http://gofreerange.com/mocha/docs/
26
+ # https://github.com/freerange/mocha
27
+ gem 'mocha'
28
+ # rake
29
+ #
30
+ # Rake is a Make-like program implemented in Ruby.
31
+ #
32
+ # https://rubygems.org/gems/rake
33
+ # https://github.com/ruby/rake
34
+ gem 'rake'
35
+ # rdoc
36
+ #
37
+ # RDoc produces HTML and command-line documentation for Ruby projects.
38
+ #
39
+ # https://rubygems.org/gems/rdoc
40
+ # http://docs.seattlerb.org/rdoc/
41
+ # https://github.com/rdoc/rdoc
42
+ gem 'rdoc'
43
+ # rubocop
44
+ #
45
+ # Automatic Ruby code style checking tool. Aims to enforce the
46
+ # community-driven Ruby Style Guide.
47
+ #
48
+ # https://rubygems.org/gems/rubocop
49
+ # https://github.com/bbatsov/rubocop
50
+ gem 'rubocop'
14
51
  end
@@ -1,39 +1,37 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
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)
15
- metaclass (~> 0.0.1)
16
- power_assert (0.2.2)
17
- rake (10.4.2)
18
- rdoc (4.2.0)
19
- shoulda (3.5.0)
20
- shoulda-context (~> 1.0, >= 1.0.1)
21
- shoulda-matchers (>= 1.4.1, < 3.0)
22
- shoulda-context (1.2.1)
23
- shoulda-matchers (2.8.0)
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)
4
+ ast (2.4.0)
5
+ jaro_winkler (1.5.4)
6
+ minitest (5.14.0)
7
+ mocha (1.11.2)
8
+ parallel (1.19.1)
9
+ parser (2.7.0.4)
10
+ ast (~> 2.4.0)
11
+ rainbow (3.0.0)
12
+ rake (13.0.1)
13
+ rdoc (6.2.1)
14
+ rexml (3.2.4)
15
+ rubocop (0.80.1)
16
+ jaro_winkler (~> 1.5.1)
17
+ parallel (~> 1.10)
18
+ parser (>= 2.7.0.1)
19
+ rainbow (>= 2.2.2, < 4.0)
20
+ rexml
21
+ ruby-progressbar (~> 1.7)
22
+ unicode-display_width (>= 1.4.0, < 1.7)
23
+ ruby-progressbar (1.10.1)
24
+ unicode-display_width (1.6.1)
30
25
 
31
26
  PLATFORMS
32
27
  ruby
33
28
 
34
29
  DEPENDENCIES
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)
30
+ minitest
31
+ mocha
32
+ rake
33
+ rdoc
34
+ rubocop
35
+
36
+ BUNDLED WITH
37
+ 2.1.4
@@ -8,40 +8,51 @@ 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
 
11
- gem install RbST
11
+ ```bash
12
+ gem install RbST
13
+ ```
12
14
 
13
15
  ## Usage
14
16
 
15
- require 'rbst'
16
- ...
17
- @html = RbST.new('/some/file.rst').to_html
18
- # or
19
- @latex = RbST.new('*hello*').to_latex
17
+ ```ruby
18
+ require 'rbst'
19
+ @html = RbST.new('/some/file.rst').to_html
20
+ # or
21
+ @latex = RbST.new('*hello*').to_latex
22
+ ```
20
23
 
21
24
  This takes the reStructuredText formatted file and converts it to either HTML
22
25
  or LaTeX. The first argument can be either a file or a string.
23
26
 
24
27
  You can also use the `convert` class method to output HTML:
25
28
 
26
- puts RbST.convert('/some/file.rst')
29
+ ```ruby
30
+ puts RbST.convert('/some/file.rst')
31
+ ```
27
32
 
28
33
  Arguments can be passed to `#to_html`, `#to_latex`, `new` or `convert`,
29
34
  accepting symbols or strings for options without arguments and hashes of
30
35
  strings or symbols for options with arguments.
31
36
 
32
- puts RbST.new(".. a comment").to_html('strip-comments')
33
- # => '<div class="document">\n</div>'
37
+ ```ruby
38
+ puts RbST.new(".. a comment").to_html('strip-comments')
39
+ # => '<div class="document">\n</div>'
40
+ ```
34
41
 
35
42
  Options passed as string use hyphens while symbols use underscores. For
36
43
  instance, the above could also be written as:
37
44
 
38
- puts RbST.new(".. a comment").to_html(:strip_comments)
39
- # => '<div class="document">\n</div>'
45
+ ```ruby
46
+ puts RbST.new(".. a comment").to_html(:strip_comments)
47
+ # => '<div class="document">\n</div>'
48
+ ```
40
49
 
41
50
  Document parts can also be specified with the `:parts` option.
42
51
 
43
- puts RbST.new("hello world").to_html(:part => :fragment)
44
- # => '<p>hello world</p>'
52
+ ```ruby
53
+ puts RbST.new("hello world").to_html(:part => :fragment)
54
+ # => '<p>hello world</p>'
55
+ ```
45
56
 
46
57
  By default, RbST uses the `html_body` part for HTML and the `whole` part
47
58
  for LaTeX.
@@ -54,19 +65,23 @@ processing one or both of the output formats. If so, just specify the full
54
65
  path to the custom script for the format by passing a hash to the
55
66
  `RbST.executables=` method:
56
67
 
57
- RbST.executables = {:html => "/some/other/path/2html.py"}
68
+ ```ruby
69
+ RbST.executables = {:html => "/some/other/path/2html.py"}
58
70
 
59
- # uses custom executable for outputting html
60
- RbST.new("something").to_html
71
+ # uses custom executable for outputting html
72
+ RbST.new("something").to_html
61
73
 
62
- # uses default executable for latex since a custom one wasn't specified
63
- RbST.new("something else").to_latex
74
+ # uses default executable for latex since a custom one wasn't specified
75
+ RbST.new("something else").to_latex
76
+ ```
64
77
 
65
78
  Similarly, if you want to explicitly specify which python executable to
66
79
  use, set the path with the `RbST.python_path=` method:
67
80
 
68
- RbST.python_path = "/usr/bin/env python3"
69
- RbST.new("something").to_latex
81
+ ```ruby
82
+ RbST.python_path = "/usr/bin/env python3"
83
+ RbST.new("something").to_latex
84
+ ```
70
85
 
71
86
  For more information on reStructuredText, see the
72
87
  [ReST documentation](http://docutils.sourceforge.net/rst.html).
@@ -84,4 +99,4 @@ For more information on reStructuredText, see the
84
99
 
85
100
  ## Copyright
86
101
 
87
- Copyright (c) 2009-2015 William Melody. See LICENSE for details.
102
+ Copyright (c) 2009 William Melody. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
5
  begin
6
6
  Bundler.setup(:default, :development)
7
7
  rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
8
+ warn e.message
9
+ warn 'Run `bundle install` to install missing gems'
10
10
  exit e.status_code
11
11
  end
12
12
  require 'rake'
@@ -18,11 +18,11 @@ Rake::TestTask.new(:test) do |test|
18
18
  test.verbose = true
19
19
  end
20
20
 
21
- task :default => :test
21
+ task default: :test
22
22
 
23
23
  require 'rdoc/task'
24
24
  Rake::RDocTask.new do |rdoc|
25
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
25
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
26
26
 
27
27
  rdoc.rdoc_dir = 'rdoc'
28
28
  rdoc.title = "RbST #{version}"
@@ -1,67 +1,43 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
5
2
 
6
3
  Gem::Specification.new do |s|
7
- s.name = "RbST"
8
- s.version = "0.5.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["William Melody"]
12
- s.date = "2015-02-08"
4
+ s.name = 'RbST'
5
+ s.version = '0.6.0'
6
+ s.licenses = ['MIT']
7
+ s.summary = "A simple Ruby wrapper for processing reStructuredText via Python's Docutils"
13
8
  s.description = "A simple Ruby wrapper for processing reStructuredText via Python's Docutils"
14
- s.email = "hi@williammelody.com"
9
+ s.authors = ['William Melody']
10
+ s.email = 'hi@williammelody.com'
11
+ s.date = '2020-03-18'
15
12
  s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.markdown"
13
+ 'LICENSE',
14
+ 'README.md'
18
15
  ]
19
16
  s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE",
24
- "README.markdown",
25
- "Rakefile",
26
- "RbST.gemspec",
27
- "lib/rbst.rb",
28
- "lib/rst2parts/__init__.py",
29
- "lib/rst2parts/rst2html.py",
30
- "lib/rst2parts/rst2latex.py",
31
- "lib/rst2parts/transform.py",
32
- "test/files/test.html",
33
- "test/files/test.latex",
34
- "test/files/test.rst",
35
- "test/helper.rb",
36
- "test/test_rbst.rb"
17
+ '.document',
18
+ 'Gemfile',
19
+ 'Gemfile.lock',
20
+ 'LICENSE',
21
+ 'README.md',
22
+ 'Rakefile',
23
+ 'RbST.gemspec',
24
+ 'lib/rbst.rb',
25
+ 'lib/rst2parts/__init__.py',
26
+ 'lib/rst2parts/rst2html.py',
27
+ 'lib/rst2parts/rst2latex.py',
28
+ 'lib/rst2parts/transform.py',
29
+ 'test/files/test.html',
30
+ 'test/files/test.latex',
31
+ 'test/files/test.rst',
32
+ 'test/helper.rb',
33
+ 'test/test_rbst.rb'
37
34
  ]
38
- s.homepage = "http://github.com/alphabetum/rbst"
39
- s.licenses = ["MIT"]
40
- s.require_paths = ["lib"]
41
- s.rubygems_version = "1.8.24"
42
- s.summary = "A simple Ruby wrapper for processing reStructuredText via Python's Docutils"
43
-
44
- if s.respond_to? :specification_version then
45
- s.specification_version = 3
46
-
47
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
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')
53
- else
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"])
59
- end
60
- else
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"])
66
- end
35
+ s.homepage = 'http://github.com/xwmx/rbst'
36
+ s.require_paths = ['lib']
37
+ s.add_development_dependency('minitest', '~> 5')
38
+ s.add_development_dependency('mocha', '~> 1', '>= 0')
39
+ s.add_development_dependency('rake', '~> 12', '>= 12.3.3')
40
+ s.add_development_dependency('rdoc', '~> 6', '>= 0')
41
+ s.add_development_dependency('rubocop', '~> 0', '>= 0.49.0')
42
+ s.required_ruby_version = '>= 2.3'
67
43
  end
@@ -1,13 +1,13 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  class RbST
4
- @@python_path="python"
4
+ @@python_path = 'python'
5
5
  @@executable_path = File.expand_path(
6
- File.join(File.dirname(__FILE__), "rst2parts")
6
+ File.join(File.dirname(__FILE__), 'rst2parts')
7
7
  )
8
8
  @@executables = {
9
- :html => File.join(@@executable_path, "rst2html.py"),
10
- :latex => File.join(@@executable_path, "rst2latex.py")
9
+ html: File.join(@@executable_path, 'rst2html.py'),
10
+ latex: File.join(@@executable_path, 'rst2latex.py')
11
11
  }
12
12
 
13
13
  # Takes a string or file path plus any additional options and converts the
@@ -33,25 +33,32 @@ class RbST
33
33
  # which should contain a full path to the alternative executable.
34
34
  def self.executables=(exec_paths = {})
35
35
  if exec_paths.empty? || (exec_paths.keys & [:html, :latex]).empty?
36
- raise ArgumentError, "Custom executable format must be :html or :latex"
36
+ raise ArgumentError, 'Custom executable format must be :html or :latex'
37
37
  end
38
+
38
39
  @@executables = @@executables.merge(exec_paths)
39
40
  end
41
+
40
42
  # Return the executable hash.
41
- def self.executables; @@executables end
43
+ def self.executables
44
+ @@executables
45
+ end
42
46
 
43
47
  # Specify a python path or executable.
44
48
  def self.python_path=(path_to_python)
45
49
  @@python_path = path_to_python
46
50
  end
51
+
47
52
  # Return the python path.
48
- def self.python_path; @@python_path end
53
+ def self.python_path
54
+ @@python_path
55
+ end
49
56
 
50
57
  # Takes a string or file path plus any additional options and creates a new
51
58
  # converter object.
52
59
  def initialize(*args)
53
60
  target = args.shift
54
- @target = File.exists?(target) ? File.read(target) : target rescue target
61
+ @target = File.exist?(target) ? File.read(target) : target rescue target
55
62
  @options = args
56
63
  end
57
64
 
@@ -85,7 +92,8 @@ class RbST
85
92
  # Convert non-hyphenated long options to symbols
86
93
  help.gsub!(/(\-\-)([A-Za-z0-9]+)([=|\s])/, ':\2\3')
87
94
  # Convert hyphenated long options to quoted strings
88
- help.gsub!(/(\-\-)([\w|\-]+)(\n)?[^$|^=|\]]?/, '\'\2\'\3')
95
+ help.gsub!(/(\-\-)([\w|\-]+)(\n)?[^=|\]]?/, '\'\2\'\3')
96
+
89
97
  # Convert equal signs to hashrocket
90
98
  help.gsub!(/\=/, ' => ')
91
99
  # Convert short options to symbols
@@ -96,32 +104,34 @@ class RbST
96
104
  puts help
97
105
  end
98
106
 
99
- protected
107
+ protected
100
108
 
101
- def execute(command)
102
- output = ''
103
- IO.popen(command, "w+") do |f|
104
- f.puts @target
105
- f.close_write
106
- output = f.read
109
+ def execute(command)
110
+ output = ''
111
+ IO.popen(command, 'w+') do |f|
112
+ f.puts @target
113
+ f.close_write
114
+ output = f.read
115
+ end
116
+ output
107
117
  end
108
- output
109
- end
110
118
 
111
- def convert_options
112
- @options.inject('') do |string, opt|
113
- string + if opt.respond_to?(:each_pair)
114
- convert_opts_with_args(opt)
115
- else
116
- opt.to_s.length == 1 ? " -#{opt}" : " --#{opt.to_s.gsub(/_/, '-')}"
119
+ def convert_options
120
+ @options.inject('') do |string, opt|
121
+ string + if opt.respond_to?(:each_pair)
122
+ convert_opts_with_args(opt)
123
+ elsif opt.to_s.length == 1
124
+ " -#{opt}"
125
+ else
126
+ " --#{opt.to_s.gsub(/_/, '-')}"
127
+ end
117
128
  end
118
129
  end
119
- end
120
130
 
121
- def convert_opts_with_args(opt)
122
- opt.inject('') do |string, (flag, val)|
123
- flag = flag.to_s.gsub(/_/, '-')
124
- string + (flag.length == 1 ? " -#{flag} #{val}" : " --#{flag}=#{val}")
131
+ def convert_opts_with_args(opt)
132
+ opt.inject('') do |string, (flag, val)|
133
+ flag = flag.to_s.gsub(/_/, '-')
134
+ string + (flag.length == 1 ? " -#{flag} #{val}" : " --#{flag}=#{val}")
135
+ end
125
136
  end
126
- end
127
137
  end
@@ -4,7 +4,7 @@
4
4
  <col class="docinfo-name" />
5
5
  <col class="docinfo-content" />
6
6
  <tbody valign="top">
7
- <tr class="field"><th class="docinfo-name">Info:</th><td class="field-body">See &lt;<a class="reference external" href="http://docutils.sf.net/rst.html">http://docutils.sf.net/rst.html</a>&gt; for introductory docs.</td>
7
+ <tr class="info field"><th class="docinfo-name">Info:</th><td class="field-body">See &lt;<a class="reference external" href="http://docutils.sf.net/rst.html">http://docutils.sf.net/rst.html</a>&gt; for introductory docs.</td>
8
8
  </tr>
9
9
  <tr><th class="docinfo-name">Author:</th>
10
10
  <td>David Goodger &lt;<a class="reference external" href="mailto:goodger&#64;python.org">goodger&#64;python.org</a>&gt;</td></tr>
@@ -12,7 +12,7 @@
12
12
  <td>2006-01-23</td></tr>
13
13
  <tr><th class="docinfo-name">Revision:</th>
14
14
  <td>4321</td></tr>
15
- <tr class="field"><th class="docinfo-name">Description:</th><td class="field-body">This is a &quot;docinfo block&quot;, or bibliographic field list</td>
15
+ <tr class="description field"><th class="docinfo-name">Description:</th><td class="field-body">This is a &quot;docinfo block&quot;, or bibliographic field list</td>
16
16
  </tr>
17
17
  </tbody>
18
18
  </table>
@@ -1,10 +1,10 @@
1
1
  \documentclass[a4paper]{article}
2
2
  % generated by Docutils <http://docutils.sourceforge.net/>
3
- \usepackage{fixltx2e} % LaTeX patches, \textsubscript
4
3
  \usepackage{cmap} % fix search and cut-and-paste in Acrobat
5
4
  \usepackage{ifthen}
6
5
  \usepackage[T1]{fontenc}
7
6
  \usepackage[utf8]{inputenc}
7
+ \usepackage{alltt}
8
8
  \usepackage{graphicx}
9
9
  \usepackage{multirow}
10
10
  \setcounter{secnumdepth}{0}
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  % docinfo (width of docinfo table)
32
- \DUprovidelength{\DUdocinfowidth}{0.9\textwidth}
32
+ \DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
33
33
 
34
34
  % fieldlist environment
35
35
  \ifthenelse{\isundefined{\DUfieldlist}}{
@@ -84,9 +84,14 @@
84
84
  % titlereference role
85
85
  \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
86
86
 
87
+ % character width in monospaced font
88
+ \newlength{\ttemwidth}
89
+ \settowidth{\ttemwidth}{\ttfamily M}
90
+
87
91
  % hyperlinks:
88
92
  \ifthenelse{\isundefined{\hypersetup}}{
89
93
  \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
94
+ \usepackage{bookmark}
90
95
  \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
91
96
  }{}
92
97
  \hypersetup{
@@ -94,15 +99,12 @@
94
99
  pdfauthor={David Goodger <goodger@python.org>}
95
100
  }
96
101
 
97
- %%% Title Data
98
- \title{\phantomsection%
99
- The \href{http://docutils.sf.net/rst.html}{reStructuredText} Cheat Sheet: Syntax Reminders%
102
+ %%% Body
103
+ \begin{document}
104
+ \title{The \href{http://docutils.sf.net/rst.html}{reStructuredText} Cheat Sheet: Syntax Reminders%
100
105
  \label{the-restructuredtext-cheat-sheet-syntax-reminders}}
101
106
  \author{}
102
107
  \date{}
103
-
104
- %%% Body
105
- \begin{document}
106
108
  \maketitle
107
109
 
108
110
  % Docinfo
@@ -143,34 +145,38 @@ Grid table:
143
145
 
144
146
  Paragraphs are flush-left,
145
147
  separated by blank lines.
146
- %
147
- \begin{quote}
148
148
 
149
+ \begin{quote}
149
150
  Block quotes are indented.
150
-
151
151
  \end{quote}
152
152
  & \multirow{2}{0.42\DUtablewidth}{%
153
153
  Literal block, preceded by \textquotedbl{}::\textquotedbl{}:
154
154
 
155
- {\ttfamily \raggedright \noindent
155
+ \begin{minipage}{8\ttemwidth}
156
+ \begin{alltt}
156
157
  Indented
157
- }
158
+ \end{alltt}
159
+ \end{minipage}
158
160
 
159
161
  or:
160
162
 
161
- {\ttfamily \raggedright \noindent
162
- >~Quoted
163
- }
163
+ \begin{minipage}{8\ttemwidth}
164
+ \begin{alltt}
165
+ > Quoted
166
+ \end{alltt}
167
+ \end{minipage}
164
168
  } \\
165
169
  \cline{1-1}
166
170
 
167
- {\ttfamily \raggedright \noindent
168
- >{}>{}>~print~'Doctest~block'\\
169
- Doctest~block
170
- }
171
+ \begin{minipage}{25\ttemwidth}
172
+ \begin{alltt}
173
+ >>> print 'Doctest block'
174
+ Doctest block
175
+ \end{alltt}
176
+ \end{minipage}
171
177
  & \\
172
178
  \hline
173
- \multicolumn{2}{|p{0.81\DUtablewidth}|}{
179
+ \multicolumn{2}{|p{0.81\DUtablewidth}|}{%
174
180
  \begin{DUlineblock}{0em}
175
181
  \item[] Line blocks preserve line breaks \& indents. {[}new in 0.3.6{]}
176
182
  \item[]
@@ -208,35 +214,27 @@ Examples
208
214
  \endlastfoot
209
215
 
210
216
  Bullet list
211
- & %
217
+ &
212
218
  \begin{itemize}
213
-
214
219
  \item items begin with \textquotedbl{}-\textquotedbl{}, \textquotedbl{}+\textquotedbl{}, or \textquotedbl{}*\textquotedbl{}
215
-
216
220
  \end{itemize}
217
221
  \\
218
222
  \hline
219
223
 
220
224
  Enumerated list
221
- & \newcounter{listcnt0}
222
- \begin{list}{\arabic{listcnt0}.}
223
- {
224
- \usecounter{listcnt0}
225
- \setlength{\rightmargin}{\leftmargin}
226
- }
227
-
225
+ &
226
+ \begin{enumerate}
228
227
  \item items use any variation of \textquotedbl{}1.\textquotedbl{}, \textquotedbl{}A)\textquotedbl{}, and \textquotedbl{}(i)\textquotedbl{}
229
228
 
230
229
  \item also auto-enumerated
231
- \end{list}
230
+ \end{enumerate}
232
231
  \\
233
232
  \hline
234
233
 
235
234
  Definition list
236
- & %
235
+ &
237
236
  \begin{description}
238
237
  \item[{Term is flush-left}] \leavevmode (\textbf{optional classifier})
239
-
240
238
  Definition is indented, no blank line between
241
239
 
242
240
  \end{description}
@@ -244,21 +242,18 @@ Definition is indented, no blank line between
244
242
  \hline
245
243
 
246
244
  Field list
247
- & %
245
+ &
248
246
  \begin{DUfieldlist}
249
247
  \item[{field name:}]
250
248
  field body
251
-
252
249
  \end{DUfieldlist}
253
250
  \\
254
251
  \hline
255
252
 
256
253
  Option list
257
- & %
254
+ &
258
255
  \begin{DUoptionlist}
259
-
260
256
  \item[-o] at least 2 spaces between option \& description
261
-
262
257
  \end{DUoptionlist}
263
258
  \\
264
259
  \hline
@@ -1,20 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler'
3
5
  begin
4
6
  Bundler.setup(:default, :development)
5
7
  rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
+ warn e.message
9
+ warn 'Run `bundle install` to install missing gems'
8
10
  exit e.status_code
9
11
  end
10
- require 'test/unit'
11
- require 'shoulda'
12
- require 'mocha/setup'
12
+ require 'minitest/autorun'
13
+ require 'minitest/pride'
14
+ require 'mocha/minitest'
13
15
 
14
16
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
17
  $LOAD_PATH.unshift(File.dirname(__FILE__))
16
18
  require 'rbst'
17
-
18
- class Test::Unit::TestCase
19
- end
20
-
@@ -1,9 +1,8 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'helper'
4
- require 'mocha'
5
4
 
6
- class TestRbST < Test::Unit::TestCase
5
+ describe RbST do
7
6
  def setup
8
7
  [:rst, :html, :latex].each do |f|
9
8
  instance_variable_set(
@@ -16,7 +15,7 @@ class TestRbST < Test::Unit::TestCase
16
15
  )
17
16
  end
18
17
 
19
- should "call bare rest2parts when passed no options" do
18
+ it 'should call bare rest2parts when passed no options' do
20
19
  converter = RbST.new(@rst_file)
21
20
  converter \
22
21
  .expects(:execute) \
@@ -25,11 +24,11 @@ class TestRbST < Test::Unit::TestCase
25
24
  assert converter.convert
26
25
  end
27
26
 
28
- should "convert with custom executable" do
29
- executables = {:html => "/some/path/2html.py"}
27
+ it 'should convert with custom executable' do
28
+ executables = { html: '/some/path/2html.py' }
30
29
  default_executables = RbST.executables
31
30
  RbST.executables = executables
32
- converter = RbST.new(@file)
31
+ converter = RbST.new(@rst_file)
33
32
  converter \
34
33
  .expects(:execute) \
35
34
  .with("python #{executables[:html]}") \
@@ -38,8 +37,8 @@ class TestRbST < Test::Unit::TestCase
38
37
  RbST.executables = default_executables
39
38
  end
40
39
 
41
- should "raise error when passed bad executable key" do
42
- executables = {:markdown => "/some/path/2markdown.py"}
40
+ it 'should raise error when passed bad executable key' do
41
+ executables = { markdown: '/some/path/2markdown.py' }
43
42
  begin
44
43
  RbST.executables = executables
45
44
  flunk
@@ -48,7 +47,7 @@ class TestRbST < Test::Unit::TestCase
48
47
  end
49
48
  end
50
49
 
51
- should "convert ReST to html" do
50
+ it 'should convert ReST to html' do
52
51
  html = RbST.new(@rst_file).to_html
53
52
  assert_equal(
54
53
  File.read(@html_file),
@@ -56,7 +55,7 @@ class TestRbST < Test::Unit::TestCase
56
55
  )
57
56
  end
58
57
 
59
- should "convert ReST to LaTeX" do
58
+ it 'should convert ReST to LaTeX' do
60
59
  latex = RbST.new(@rst_file).to_latex
61
60
  assert_equal(
62
61
  File.read(@latex_file),
@@ -65,7 +64,7 @@ class TestRbST < Test::Unit::TestCase
65
64
  end
66
65
 
67
66
  [:html, :latex].each do |f|
68
- should "accept options on #to_#{f}" do
67
+ it "should accept options on #to_#{f}" do
69
68
  converter = RbST.new(@rst_file)
70
69
  converter \
71
70
  .expects(:execute) \
@@ -75,116 +74,124 @@ class TestRbST < Test::Unit::TestCase
75
74
  end
76
75
  end
77
76
 
78
- should "recognize strip_comments option" do
79
- html_with_comment = RbST.convert(".. comment")
77
+ it 'should recognize strip_comments option' do
78
+ html_with_comment = RbST.convert('.. comment')
80
79
  assert_equal(
81
80
  html_with_comment,
82
- %Q{<div class=\"document\">\n<!-- comment -->\n</div>\n}
81
+ %|<div class=\"document\">\n<!-- comment -->\n</div>\n|
83
82
  )
84
- html_without_comment = RbST.convert(".. comment", 'strip-comments')
83
+ html_without_comment = RbST.convert('.. comment', 'strip-comments')
85
84
  assert_equal(
86
85
  html_without_comment,
87
- %Q{<div class=\"document\">\n</div>\n}
86
+ %|<div class=\"document\">\n</div>\n|
88
87
  )
89
88
  end
90
89
 
91
- should "recognize cloak_email_addresses option" do
92
- html_with_uncloaked_email = RbST.convert("steve@mac.com")
90
+ it 'should recognize cloak_email_addresses option' do
91
+ html_with_uncloaked_email = RbST.convert('steve@mac.com')
93
92
  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},
93
+ %|<div class=\"document\">\n<p>| +
94
+ %|<a class=\"reference external\" href=\"mailto:steve&#64;mac.com\">| +
95
+ %|steve&#64;mac.com</a>| +
96
+ %|</p>\n</div>\n|,
95
97
  html_with_uncloaked_email
96
98
  )
97
- html_with_cloaked_email = RbST.convert("steve@mac.com", 'cloak-email-addresses')
99
+ html_with_cloaked_email = RbST.convert(
100
+ 'steve@mac.com', 'cloak-email-addresses'
101
+ )
98
102
  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},
103
+ %|<div class=\"document\">\n<p>| +
104
+ %|<a class=\"reference external\" | +
105
+ %|href=\"mailto:steve&#37;&#52;&#48;mac&#46;com\">| +
106
+ %|steve<span>&#64;</span>mac<span>&#46;</span>com| +
107
+ %|</a></p>\n</div>\n|,
100
108
  html_with_cloaked_email
101
109
  )
102
110
  end
103
111
 
104
- should "recognize part option" do
105
- html_body = RbST.convert("hello world", :part => :html_body)
112
+ it 'should recognize part option' do
113
+ html_body = RbST.convert('hello world', part: :html_body)
106
114
  assert_equal(
107
- %Q{<div class=\"document\">\n<p>hello world</p>\n</div>\n},
115
+ %|<div class=\"document\">\n<p>hello world</p>\n</div>\n|,
108
116
  html_body
109
117
  )
110
- fragment = RbST.convert("hello world", :part => :fragment)
118
+ fragment = RbST.convert('hello world', part: :fragment)
111
119
  assert_equal(
112
- %Q{<p>hello world</p>\n},
120
+ %|<p>hello world</p>\n|,
113
121
  fragment
114
122
  )
115
123
  end
116
124
 
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)
125
+ it 'should convert to html with unicode' do
126
+ test_string = 'Hello ☃'
127
+ output = RbST.new(test_string).to_html(part: :fragment)
120
128
  assert_equal(
121
- %Q{<p>#{test_string}</p>\n},
129
+ %|<p>#{test_string}</p>\n|,
122
130
  output
123
131
  )
124
132
  end
125
133
 
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)
134
+ it 'should convert to latex with unicode' do
135
+ test_string = 'Hello ☃'
136
+ output = RbST.new(test_string).to_latex(part: :body)
129
137
  assert_equal(
130
- %Q{\n#{test_string}\n},
138
+ %|\n#{test_string}\n|,
131
139
  output
132
140
  )
133
141
  end
134
142
 
135
- should "execute with custom python path" do
136
- RbST.python_path = "/usr/bin/env python3"
143
+ it 'should execute with custom python path' do
144
+ RbST.python_path = '/usr/bin/env python3'
137
145
  converter = RbST.new(@rst_file)
138
146
  converter \
139
147
  .expects(:execute) \
140
148
  .with("/usr/bin/env python3 #{@rst2parts_path}/rst2html.py") \
141
149
  .returns(true)
142
150
  assert converter.convert
143
- RbST.python_path = "python"
151
+ RbST.python_path = 'python'
144
152
  end
145
153
 
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)
154
+ it 'should convert to html with python3' do
155
+ RbST.python_path = '/usr/bin/env python3'
156
+ test_string = 'Hello ☃'
157
+ output = RbST.new(test_string).to_html(part: :fragment)
150
158
  assert_equal(
151
- %Q{<p>#{test_string}</p>\n},
159
+ %|<p>#{test_string}</p>\n|,
152
160
  output
153
161
  )
154
- RbST.python_path = "python"
162
+ RbST.python_path = 'python'
155
163
  end
156
164
 
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)
165
+ it 'should convert to latex with python3' do
166
+ RbST.python_path = '/usr/bin/env python3'
167
+ test_string = 'Hello ☃'
168
+ output = RbST.new(test_string).to_latex(part: :body)
161
169
  assert_equal(
162
- %Q{\n#{test_string}\n},
170
+ %|\n#{test_string}\n|,
163
171
  output
164
172
  )
165
- RbST.python_path = "python"
173
+ RbST.python_path = 'python'
166
174
  end
167
175
 
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)
176
+ it 'should convert to html with python2' do
177
+ RbST.python_path = '/usr/bin/env python2'
178
+ test_string = 'Hello ☃'
179
+ output = RbST.new(test_string).to_html(part: :fragment)
172
180
  assert_equal(
173
- %Q{<p>#{test_string}</p>\n},
181
+ %|<p>#{test_string}</p>\n|,
174
182
  output
175
183
  )
176
- RbST.python_path = "python"
184
+ RbST.python_path = 'python'
177
185
  end
178
186
 
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)
187
+ it 'should convert to latex with python2' do
188
+ RbST.python_path = '/usr/bin/env python2'
189
+ test_string = 'Hello ☃'
190
+ output = RbST.new(test_string).to_latex(part: :body)
183
191
  assert_equal(
184
- %Q{\n#{test_string}\n},
192
+ %|\n#{test_string}\n|,
185
193
  output
186
194
  )
187
- RbST.python_path = "python"
195
+ RbST.python_path = 'python'
188
196
  end
189
-
190
197
  end
metadata CHANGED
@@ -1,128 +1,122 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RbST
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.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: 2015-02-08 00:00:00.000000000 Z
11
+ date: 2020-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: mocha
14
+ name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
20
- - - ">"
21
- - !ruby/object:Gem::Version
22
- version: 1.1.0
19
+ version: '5'
23
20
  type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.1'
30
- - - ">"
31
- - !ruby/object:Gem::Version
32
- version: 1.1.0
26
+ version: '5'
33
27
  - !ruby/object:Gem::Dependency
34
- name: rake
28
+ name: mocha
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '10.4'
33
+ version: '1'
40
34
  - - ">="
41
35
  - !ruby/object:Gem::Version
42
- version: 10.4.2
36
+ version: '0'
43
37
  type: :development
44
38
  prerelease: false
45
39
  version_requirements: !ruby/object:Gem::Requirement
46
40
  requirements:
47
41
  - - "~>"
48
42
  - !ruby/object:Gem::Version
49
- version: '10.4'
43
+ version: '1'
50
44
  - - ">="
51
45
  - !ruby/object:Gem::Version
52
- version: 10.4.2
46
+ version: '0'
53
47
  - !ruby/object:Gem::Dependency
54
- name: rdoc
48
+ name: rake
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '4.2'
53
+ version: '12'
60
54
  - - ">="
61
55
  - !ruby/object:Gem::Version
62
- version: 4.2.0
56
+ version: 12.3.3
63
57
  type: :development
64
58
  prerelease: false
65
59
  version_requirements: !ruby/object:Gem::Requirement
66
60
  requirements:
67
61
  - - "~>"
68
62
  - !ruby/object:Gem::Version
69
- version: '4.2'
63
+ version: '12'
70
64
  - - ">="
71
65
  - !ruby/object:Gem::Version
72
- version: 4.2.0
66
+ version: 12.3.3
73
67
  - !ruby/object:Gem::Dependency
74
- name: shoulda
68
+ name: rdoc
75
69
  requirement: !ruby/object:Gem::Requirement
76
70
  requirements:
77
71
  - - "~>"
78
72
  - !ruby/object:Gem::Version
79
- version: '3.5'
73
+ version: '6'
80
74
  - - ">="
81
75
  - !ruby/object:Gem::Version
82
- version: 3.5.0
76
+ version: '0'
83
77
  type: :development
84
78
  prerelease: false
85
79
  version_requirements: !ruby/object:Gem::Requirement
86
80
  requirements:
87
81
  - - "~>"
88
82
  - !ruby/object:Gem::Version
89
- version: '3.5'
83
+ version: '6'
90
84
  - - ">="
91
85
  - !ruby/object:Gem::Version
92
- version: 3.5.0
86
+ version: '0'
93
87
  - !ruby/object:Gem::Dependency
94
- name: test-unit
88
+ name: rubocop
95
89
  requirement: !ruby/object:Gem::Requirement
96
90
  requirements:
97
91
  - - "~>"
98
92
  - !ruby/object:Gem::Version
99
- version: '3.0'
93
+ version: '0'
100
94
  - - ">="
101
95
  - !ruby/object:Gem::Version
102
- version: 3.0.9
96
+ version: 0.49.0
103
97
  type: :development
104
98
  prerelease: false
105
99
  version_requirements: !ruby/object:Gem::Requirement
106
100
  requirements:
107
101
  - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: '3.0'
103
+ version: '0'
110
104
  - - ">="
111
105
  - !ruby/object:Gem::Version
112
- version: 3.0.9
106
+ version: 0.49.0
113
107
  description: A simple Ruby wrapper for processing reStructuredText via Python's Docutils
114
108
  email: hi@williammelody.com
115
109
  executables: []
116
110
  extensions: []
117
111
  extra_rdoc_files:
118
112
  - LICENSE
119
- - README.markdown
113
+ - README.md
120
114
  files:
121
115
  - ".document"
122
116
  - Gemfile
123
117
  - Gemfile.lock
124
118
  - LICENSE
125
- - README.markdown
119
+ - README.md
126
120
  - Rakefile
127
121
  - RbST.gemspec
128
122
  - lib/rbst.rb
@@ -135,7 +129,7 @@ files:
135
129
  - test/files/test.rst
136
130
  - test/helper.rb
137
131
  - test/test_rbst.rb
138
- homepage: http://github.com/alphabetum/rbst
132
+ homepage: http://github.com/xwmx/rbst
139
133
  licenses:
140
134
  - MIT
141
135
  metadata: {}
@@ -147,16 +141,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
141
  requirements:
148
142
  - - ">="
149
143
  - !ruby/object:Gem::Version
150
- version: '0'
144
+ version: '2.3'
151
145
  required_rubygems_version: !ruby/object:Gem::Requirement
152
146
  requirements:
153
147
  - - ">="
154
148
  - !ruby/object:Gem::Version
155
149
  version: '0'
156
150
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.4.5
151
+ rubygems_version: 3.1.2
159
152
  signing_key:
160
- specification_version: 3
153
+ specification_version: 4
161
154
  summary: A simple Ruby wrapper for processing reStructuredText via Python's Docutils
162
155
  test_files: []