RbST 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,6 +43,12 @@ By default, RbST uses the `html_body` part for HTML and the `whole` part for LaT
43
43
 
44
44
  Available options can be viewed using the `RbST.html_options` and `RbST.latex_options` class methods.
45
45
 
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:
47
+
48
+ 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
+
46
52
  For more information on reStructuredText, see the
47
53
  [ReST documentation](http://docutils.sourceforge.net/rst.html).
48
54
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{RbST}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
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{2010-03-29}
12
+ s.date = %q{2010-05-12}
13
13
  s.description = %q{A simple Ruby wrapper for processing reStructuredText via Python's Docutils}
14
14
  s.email = %q{wmelody@gmail.com}
15
15
  s.extra_rdoc_files = [
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -2,6 +2,12 @@ require 'open3'
2
2
 
3
3
  class RbST
4
4
 
5
+ @@executable_path = File.expand_path(File.join(File.dirname(__FILE__), "rst2parts"))
6
+ @@executables = {
7
+ :html => File.join(@@executable_path, "rst2html.py"),
8
+ :latex => File.join(@@executable_path, "rst2latex.py")
9
+ }
10
+
5
11
  # Takes a string or file path plus any additional options and converts the input.
6
12
  def self.convert(*args)
7
13
  new(*args).convert
@@ -17,6 +23,18 @@ class RbST
17
23
  new.print_options(:html)
18
24
  end
19
25
 
26
+ # Specify custom executables to use instead of the default rst2latex.py and
27
+ # rst2html.py scripts. Takes a hash with two possible keys, :html and :latex,
28
+ # which should contain a full path to the alternative executable.
29
+ def self.executables=(exec_paths = {})
30
+ if exec_paths.empty? || (exec_paths.keys & [:html, :latex]).empty?
31
+ raise ArgumentError, "Custom executable format must be :html or :latex"
32
+ end
33
+ @@executables = @@executables.merge(exec_paths)
34
+ end
35
+ # Return the executable hash.
36
+ def self.executables; @@executables end
37
+
20
38
  # Takes a string or file path plus any additional options and creates a new converter object.
21
39
  def initialize(*args)
22
40
  target = args.shift
@@ -26,7 +44,7 @@ class RbST
26
44
 
27
45
  def convert # :nodoc:
28
46
  @output_format ||= :html
29
- execute "python #{RbST.executable(@output_format)}" + convert_options
47
+ execute "python #{@@executables[@output_format]}" + convert_options
30
48
  end
31
49
  alias_method :to_s, :convert
32
50
 
@@ -46,7 +64,7 @@ class RbST
46
64
 
47
65
  # Formats and prints the options from the docutils help in the way they'd be specified in RbST: strings, symbols and hashes.
48
66
  def print_options(format)
49
- help = execute("python #{RbST.executable(format)} --help")
67
+ help = execute("python #{@@executables[format]} --help")
50
68
  # non-hyphenated long options to symbols
51
69
  help.gsub!(/(\-\-)([A-Za-z0-9]+)([=|\s])/, ':\2\3')
52
70
  # hyphenated long options to quoted strings
@@ -60,11 +78,7 @@ class RbST
60
78
  puts help
61
79
  end
62
80
 
63
- private
64
-
65
- def self.executable(writer = :html)
66
- File.expand_path(File.join(File.dirname(__FILE__), "rst2parts", "rst2#{writer}.py"))
67
- end
81
+ protected
68
82
 
69
83
  def execute(command)
70
84
  output = ''
@@ -175,7 +175,7 @@ used to separate indentation contexts)</td>
175
175
  <div class="section" id="inline-markup">
176
176
  <h1>Inline Markup</h1>
177
177
  <p><em>emphasis</em>; <strong>strong emphasis</strong>; <cite>interpreted text</cite>; <em>interpreted text
178
- with role</em>; <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span> <span class="pre">text</span></tt>; standalone hyperlink,
178
+ with role</em>; <tt class="docutils literal">inline literal text</tt>; standalone hyperlink,
179
179
  <a class="reference external" href="http://docutils.sourceforge.net">http://docutils.sourceforge.net</a>; named reference, <a class="reference external" href="http://docutils.sf.net/rst.html">reStructuredText</a>;
180
180
  <a class="reference external" href="http://docutils.sf.net/docs/ref/rst/restructuredtext.html">anonymous reference</a>; footnote reference, <a class="footnote-reference" href="#id1" id="id3">[1]</a>; citation reference,
181
181
  <a class="citation-reference" href="#cit2002" id="id4">[CIT2002]</a>; like an inline directive; <span class="target" id="inline-internal-target">inline internal target</span>.</p>
@@ -199,25 +199,25 @@ with role</em>; <tt class="docutils literal"><span class="pre">inline</span> <sp
199
199
  &quot;error&quot;, &quot;hint&quot;, &quot;important&quot;, &quot;note&quot;, &quot;tip&quot;, &quot;warning&quot;</td>
200
200
  </tr>
201
201
  <tr><td>admonition</td>
202
- <td>Generic titled admonition: <tt class="docutils literal"><span class="pre">..</span> <span class="pre">admonition::</span> <span class="pre">By</span> <span class="pre">The</span> <span class="pre">Way</span></tt></td>
202
+ <td>Generic titled admonition: <tt class="docutils literal">.. admonition:: By The Way</tt></td>
203
203
  </tr>
204
204
  <tr><td>image</td>
205
- <td><tt class="docutils literal"><span class="pre">..</span> <span class="pre">image::</span> <span class="pre">picture.png</span></tt>; many options possible</td>
205
+ <td><tt class="docutils literal">.. image:: picture.png</tt>; many options possible</td>
206
206
  </tr>
207
207
  <tr><td>figure</td>
208
208
  <td>Like &quot;image&quot;, but with optional caption and legend</td>
209
209
  </tr>
210
210
  <tr><td>topic</td>
211
- <td><tt class="docutils literal"><span class="pre">..</span> <span class="pre">topic::</span> <span class="pre">Title</span></tt>; like a mini section</td>
211
+ <td><tt class="docutils literal">.. topic:: Title</tt>; like a mini section</td>
212
212
  </tr>
213
213
  <tr><td>sidebar</td>
214
- <td><tt class="docutils literal"><span class="pre">..</span> <span class="pre">sidebar::</span> <span class="pre">Title</span></tt>; like a mini parallel document</td>
214
+ <td><tt class="docutils literal">.. sidebar:: Title</tt>; like a mini parallel document</td>
215
215
  </tr>
216
216
  <tr><td>parsed-literal</td>
217
217
  <td>A literal block with parsed inline markup</td>
218
218
  </tr>
219
219
  <tr><td>rubric</td>
220
- <td><tt class="docutils literal"><span class="pre">..</span> <span class="pre">rubric::</span> <span class="pre">Informal</span> <span class="pre">Heading</span></tt></td>
220
+ <td><tt class="docutils literal">.. rubric:: Informal Heading</tt></td>
221
221
  </tr>
222
222
  <tr><td>epigraph</td>
223
223
  <td>Block quote with class=&quot;epigraph&quot;</td>
@@ -306,7 +306,7 @@ with role</em>; <tt class="docutils literal"><span class="pre">inline</span> <sp
306
306
  <td>Equivalent to <em>emphasis</em></td>
307
307
  </tr>
308
308
  <tr><td>literal</td>
309
- <td>Equivalent to <tt class="docutils literal"><span class="pre">literal</span></tt> but processes backslash escapes</td>
309
+ <td>Equivalent to <tt class="docutils literal">literal</tt> but processes backslash escapes</td>
310
310
  </tr>
311
311
  <tr><td>PEP</td>
312
312
  <td>Reference to a numbered Python Enhancement Proposal</td>
@@ -1,124 +1,158 @@
1
- \documentclass[10pt,a4paper,english]{article}
1
+ % generated by Docutils <http://docutils.sourceforge.net/>
2
+ \documentclass[a4paper,english]{article}
3
+ \usepackage{fixltx2e} % LaTeX patches, \textsubscript
4
+ \usepackage{cmap} % fix search and cut-and-paste in PDF
2
5
  \usepackage{babel}
3
- \usepackage{ae}
4
- \usepackage{aeguill}
5
- \usepackage{shortvrb}
6
- \usepackage{ucs}
7
- \usepackage[utf8x]{inputenc}
8
- \usepackage{tabularx}
9
- \usepackage{longtable}
10
- \setlength{\extrarowheight}{2pt}
11
- \usepackage{amsmath}
6
+ \usepackage[T1]{fontenc}
7
+ \usepackage[utf8]{inputenc}
8
+ \usepackage{ifthen}
12
9
  \usepackage{graphicx}
13
- \usepackage{color}
14
10
  \usepackage{multirow}
15
- \usepackage{ifthen}
16
- \usepackage[DIV12]{typearea}
17
- % generated by Docutils <http://docutils.sourceforge.net/>
18
- \newlength{\admonitionwidth}
19
- \setlength{\admonitionwidth}{0.9\textwidth}
20
- \newlength{\docinfowidth}
21
- \setlength{\docinfowidth}{0.9\textwidth}
22
- \newlength{\locallinewidth}
23
- \newcommand{\optionlistlabel}[1]{\bf #1 \hfill}
24
- \newenvironment{optionlist}[1]
25
- {\begin{list}{}
26
- {\setlength{\labelwidth}{#1}
27
- \setlength{\rightmargin}{1cm}
28
- \setlength{\leftmargin}{\rightmargin}
29
- \addtolength{\leftmargin}{\labelwidth}
30
- \addtolength{\leftmargin}{\labelsep}
31
- \renewcommand{\makelabel}{\optionlistlabel}}
32
- }{\end{list}}
33
- \newlength{\lineblockindentation}
34
- \setlength{\lineblockindentation}{2.5em}
35
- \newenvironment{lineblock}[1]
36
- {\begin{list}{}
37
- {\setlength{\partopsep}{\parskip}
38
- \addtolength{\partopsep}{\baselineskip}
39
- \topsep0pt\itemsep0.15\baselineskip\parsep0pt
40
- \leftmargin#1}
41
- \raggedright}
42
- {\end{list}}
43
- % begin: floats for footnotes tweaking.
44
- \setlength{\floatsep}{0.5em}
45
- \setlength{\textfloatsep}{\fill}
46
- \addtolength{\textfloatsep}{3em}
47
- \renewcommand{\textfraction}{0.5}
48
- \renewcommand{\topfraction}{0.5}
49
- \renewcommand{\bottomfraction}{0.5}
50
- \setcounter{totalnumber}{50}
51
- \setcounter{topnumber}{50}
52
- \setcounter{bottomnumber}{50}
53
- % end floats for footnotes
54
- % some commands, that could be overwritten in the style file.
55
- \newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}
56
- \newcommand{\titlereference}[1]{\textsl{#1}}
57
- % end of "some commands"
11
+ \usepackage{longtable}
12
+ \usepackage{array}
13
+ \setlength{\extrarowheight}{2pt}
14
+ \newlength{\DUtablewidth} % internal use in tables
15
+ \usepackage{tabularx}
16
+
17
+ %%% User specified packages and stylesheets
18
+
19
+ %%% Fallback definitions for Docutils-specific commands
20
+
21
+ % providelength (provide a length variable and set default, if it is new)
22
+ \providecommand*{\DUprovidelength}[2]{
23
+ \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
24
+ }
25
+
26
+ % docinfo (width of docinfo table)
27
+ \DUprovidelength{\DUdocinfowidth}{0.9\textwidth}
28
+
29
+ % fieldlist environment
30
+ \ifthenelse{\isundefined{\DUfieldlist}}{
31
+ \newenvironment{DUfieldlist}%
32
+ {\quote\description}
33
+ {\enddescription\endquote}
34
+ }{}
35
+ % numeric or symbol footnotes with hyperlinks
36
+ \providecommand*{\DUfootnotemark}[3]{%
37
+ \raisebox{1em}{\hypertarget{#1}{}}%
38
+ \hyperlink{#2}{\textsuperscript{#3}}%
39
+ }
40
+ \providecommand{\DUfootnotetext}[4]{%
41
+ \begingroup%
42
+ \renewcommand{\thefootnote}{%
43
+ \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
44
+ \protect\hyperlink{#2}{#3}}%
45
+ \footnotetext{#4}%
46
+ \endgroup%
47
+ }
48
+
49
+ % lineblock environment
50
+ \DUprovidelength{\DUlineblockindent}{2.5em}
51
+ \ifthenelse{\isundefined{\DUlineblock}}{
52
+ \newenvironment{DUlineblock}[1]{%
53
+ \list{}{\setlength{\partopsep}{\parskip}
54
+ \addtolength{\partopsep}{\baselineskip}
55
+ \setlength{\topsep}{0pt}
56
+ \setlength{\itemsep}{0.15\baselineskip}
57
+ \setlength{\parsep}{0pt}
58
+ \setlength{\leftmargin}{#1}}
59
+ \raggedright
60
+ }
61
+ {\endlist}
62
+ }{}
63
+
64
+ % optionlist environment
65
+ \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
66
+ \DUprovidelength{\DUoptionlistindent}{3cm}
67
+ \ifthenelse{\isundefined{\DUoptionlist}}{
68
+ \newenvironment{DUoptionlist}{%
69
+ \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
70
+ \setlength{\rightmargin}{1cm}
71
+ \setlength{\leftmargin}{\rightmargin}
72
+ \addtolength{\leftmargin}{\labelwidth}
73
+ \addtolength{\leftmargin}{\labelsep}
74
+ \renewcommand{\makelabel}{\DUoptionlistlabel}}
75
+ }
76
+ {\endlist}
77
+ }{}
78
+
79
+ % titlereference role
80
+ \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
81
+
82
+ % hyperlinks:
58
83
  \ifthenelse{\isundefined{\hypersetup}}{
59
- \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
84
+ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
60
85
  }{}
61
- \title{The reStructuredText Cheat Sheet: Syntax Reminders}
62
- \author{}
63
- \date{}
64
86
  \hypersetup{
65
- pdftitle={The reStructuredText Cheat Sheet: Syntax Reminders},
66
- pdfauthor={David Goodger {\textless}goodger@python.org{\textgreater}}
87
+ pdftitle={The reStructuredText Cheat Sheet: Syntax Reminders},
88
+ pdfauthor={David Goodger <goodger@python.org>}
67
89
  }
68
- \raggedbottom
90
+
91
+ %%% Body
69
92
  \begin{document}
93
+
94
+ % Document title
95
+ \title{The reStructuredText Cheat Sheet: Syntax Reminders%
96
+ \phantomsection%
97
+ \label{the-restructuredtext-cheat-sheet-syntax-reminders}}
98
+ \author{}
99
+ \date{}
70
100
  \maketitle
71
- %___________________________________________________________________________
101
+
102
+ % Docinfo
72
103
  \begin{center}
73
- \begin{tabularx}{\docinfowidth}{lX}
104
+ \begin{tabularx}{\DUdocinfowidth}{lX}
74
105
  \textbf{Info}: &
75
- See {\textless}http://docutils.sf.net/rst.html{\textgreater} for introductory docs. \\
106
+ See <\href{http://docutils.sf.net/rst.html}{http://docutils.sf.net/rst.html}> for introductory docs.
107
+ \\
76
108
  \textbf{Author}: &
77
- David Goodger {\textless}\href{mailto:goodger@python.org}{goodger@python.org}{\textgreater} \\
109
+ David Goodger <\href{mailto:goodger@python.org}{goodger@python.org}> \\
78
110
  \textbf{Date}: &
79
111
  2006-01-23 \\
80
112
  \textbf{Revision}: &
81
113
  4321 \\
82
114
  \textbf{Description}: &
83
- This is a ``docinfo block'', or bibliographic field list \\
115
+ This is a ``docinfo block'', or bibliographic field list
116
+ \\
84
117
  \end{tabularx}
85
118
  \end{center}
86
119
 
87
- \setlength{\locallinewidth}{\linewidth}
88
-
89
-
90
-
91
120
 
92
121
  %___________________________________________________________________________
93
122
 
94
- \hypertarget{section-structure}{}
95
- \pdfbookmark[0]{Section Structure}{section-structure}
96
- \section*{Section Structure}
97
- \label{section-structure}
123
+ \section*{Section Structure%
124
+ \phantomsection%
125
+ \addcontentsline{toc}{section}{Section Structure}%
126
+ \label{section-structure}%
127
+ }
98
128
 
99
- Section titles are underlined or overlined {\&} underlined.
129
+ Section titles are underlined or overlined \& underlined.
100
130
 
101
131
 
102
132
  %___________________________________________________________________________
103
133
 
104
- \hypertarget{body-elements}{}
105
- \pdfbookmark[0]{Body Elements}{body-elements}
106
- \section*{Body Elements}
107
- \label{body-elements}
134
+ \section*{Body Elements%
135
+ \phantomsection%
136
+ \addcontentsline{toc}{section}{Body Elements}%
137
+ \label{body-elements}%
138
+ }
108
139
 
109
140
  Grid table:
110
141
 
111
142
  \leavevmode
112
- \begin{longtable}[c]{|p{0.389\locallinewidth}|p{0.424\locallinewidth}|}
143
+ \setlength{\DUtablewidth}{\linewidth}
144
+ \begin{longtable}[c]{|p{0.389\DUtablewidth}|p{0.424\DUtablewidth}|}
113
145
  \hline
114
146
 
115
147
  Paragraphs are flush-left,
116
148
  separated by blank lines.
149
+ %
117
150
  \begin{quote}
118
151
 
119
152
  Block quotes are indented.
153
+
120
154
  \end{quote}
121
- & \multirow{2}{0.42\locallinewidth}{
155
+ & \multirow{2}{0.42\DUtablewidth}{%
122
156
  Literal block, preceded by ``::'':
123
157
 
124
158
  {\ttfamily \raggedright \noindent
@@ -132,19 +166,22 @@ or:
132
166
  }
133
167
  } \\
134
168
  \cline{1-1}
135
- \begin{verbatim}>>> print 'Doctest block'
136
- Doctest block\end{verbatim}
169
+
170
+ {\ttfamily \raggedright \noindent
171
+ >{}>{}>~print~'Doctest~block'\\
172
+ Doctest~block
173
+ }
137
174
  & \\
138
175
  \hline
139
176
  \multicolumn{2}{|l|}{
140
- \begin{lineblock}{0em}
141
- \item[] Line blocks preserve line breaks {\&} indents. {[}new in 0.3.6{]}
142
- \item[]
143
- \begin{lineblock}{\lineblockindentation}
177
+ \begin{DUlineblock}{0em}
178
+ \item[] Line blocks preserve line breaks \& indents. {[}new in 0.3.6{]}
179
+ \item[]
180
+ \begin{DUlineblock}{\DUlineblockindent}
144
181
  \item[] Useful for addresses, verse, and adornment-free lists; long
145
182
  lines can be wrapped with continuation lines.
146
- \end{lineblock}
147
- \end{lineblock}
183
+ \end{DUlineblock}
184
+ \end{DUlineblock}
148
185
  } \\
149
186
  \hline
150
187
  \end{longtable}
@@ -152,20 +189,33 @@ lines can be wrapped with continuation lines.
152
189
  Simple tables:
153
190
 
154
191
  \leavevmode
155
- \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.714\locallinewidth}|}
192
+ \setlength{\DUtablewidth}{\linewidth}
193
+ \begin{longtable}[c]{|p{0.203\DUtablewidth}|p{0.714\DUtablewidth}|}
194
+ \hline
195
+ \textbf{%
196
+ List Type
197
+ } & \textbf{%
198
+ Examples
199
+ } \\
200
+ \hline
201
+ \endfirsthead
156
202
  \hline
157
- \textbf{
203
+ \textbf{%
158
204
  List Type
159
- } & \textbf{
205
+ } & \textbf{%
160
206
  Examples
161
207
  } \\
162
208
  \hline
163
209
  \endhead
210
+ \multicolumn{2}{c}{\hfill ... continued on next page} \\
211
+ \endfoot
212
+ \endlastfoot
164
213
 
165
214
  Bullet list
166
- & \begin{itemize}
167
- \item {}
168
- items begin with ``-'', ``+'', or ``*''
215
+ & %
216
+ \begin{itemize}
217
+
218
+ \item items begin with ``-'', ``+'', or ``*''
169
219
 
170
220
  \end{itemize}
171
221
  \\
@@ -178,18 +228,17 @@ Enumerated list
178
228
  \usecounter{listcnt0}
179
229
  \setlength{\rightmargin}{\leftmargin}
180
230
  }
181
- \item {}
182
- items use any variation of ``1.'', ``A)'', and ``(i)''
183
231
 
184
- \item {}
185
- also auto-enumerated
232
+ \item items use any variation of ``1.'', ``A)'', and ``(i)''
186
233
 
234
+ \item also auto-enumerated
187
235
  \end{list}
188
236
  \\
189
237
  \hline
190
238
 
191
239
  Definition list
192
- & \begin{description}
240
+ & %
241
+ \begin{description}
193
242
  \item[{Term is flush-left}] \leavevmode (\textbf{optional classifier})
194
243
 
195
244
  Definition is indented, no blank line between
@@ -199,54 +248,67 @@ Definition is indented, no blank line between
199
248
  \hline
200
249
 
201
250
  Field list
202
- & \begin{quote}
203
- \begin{description}
204
- \item [field name:]
251
+ & %
252
+ \begin{DUfieldlist}
253
+ \item[{field name:}]
205
254
  field body
206
255
 
207
-
208
- \end{description}
209
- \end{quote}
256
+ \end{DUfieldlist}
210
257
  \\
211
258
  \hline
212
259
 
213
260
  Option list
214
- & \begin{optionlist}{3cm}
215
- \item [-o]
216
- at least 2 spaces between option {\&} description
217
- \end{optionlist}
261
+ & %
262
+ \begin{DUoptionlist}
263
+
264
+ \item[-o] at least 2 spaces between option \& description
265
+
266
+ \end{DUoptionlist}
218
267
  \\
219
268
  \hline
220
269
  \end{longtable}
221
270
 
222
271
  \leavevmode
223
- \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.714\locallinewidth}|}
272
+ \setlength{\DUtablewidth}{\linewidth}
273
+ \begin{longtable}[c]{|p{0.203\DUtablewidth}|p{0.714\DUtablewidth}|}
274
+ \hline
275
+ \textbf{%
276
+ Explicit Markup
277
+ } & \textbf{%
278
+ Examples (visible in the \href{cheatsheet.txt}{text source})
279
+ } \\
280
+ \hline
281
+ \endfirsthead
224
282
  \hline
225
- \textbf{
283
+ \textbf{%
226
284
  Explicit Markup
227
- } & \textbf{
285
+ } & \textbf{%
228
286
  Examples (visible in the \href{cheatsheet.txt}{text source})
229
287
  } \\
230
288
  \hline
231
289
  \endhead
290
+ \multicolumn{2}{c}{\hfill ... continued on next page} \\
291
+ \endfoot
292
+ \endlastfoot
232
293
 
233
294
  Footnote
234
- & \begin{figure}[b]\hypertarget{id1}$^{1}$
235
- Manually numbered or {[}{\#}{]} auto-numbered
236
- (even {[}{\#}labelled{]}) or {[}*{]} auto-symbol
237
- \end{figure}
295
+ & %
296
+ \DUfootnotetext{id1}{id3}{1}{
297
+ Manually numbered or {[}\#{]} auto-numbered
298
+ (even {[}\#labelled{]}) or {[}*{]} auto-symbol
299
+ }
238
300
  \\
239
301
  \hline
240
302
 
241
303
  Citation
242
- & \begin{figure}[b]\hypertarget{cit2002}[CIT2002]
304
+ & \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
243
305
  A citation.
244
306
  \end{figure}
245
307
  \\
246
308
  \hline
247
309
 
248
310
  Hyperlink Target
249
- & \hypertarget{internal-target}{} \\
311
+ & \\
250
312
  \hline
251
313
 
252
314
  Anonymous Target
@@ -264,13 +326,14 @@ Substitution Def
264
326
  \hline
265
327
 
266
328
  Comment
267
- & % is anything else
329
+ &
330
+ % is anything else
268
331
  \\
269
332
  \hline
270
333
 
271
334
  Empty Comment
272
335
  &
273
- (``..'' on a line by itself, with blank lines before {\&} after,
336
+ (``..'' on a line by itself, with blank lines before \& after,
274
337
  used to separate indentation contexts)
275
338
  \\
276
339
  \hline
@@ -279,37 +342,52 @@ used to separate indentation contexts)
279
342
 
280
343
  %___________________________________________________________________________
281
344
 
282
- \hypertarget{inline-markup}{}
283
- \pdfbookmark[0]{Inline Markup}{inline-markup}
284
- \section*{Inline Markup}
285
- \label{inline-markup}
345
+ \section*{Inline Markup%
346
+ \phantomsection%
347
+ \addcontentsline{toc}{section}{Inline Markup}%
348
+ \label{inline-markup}%
349
+ }
286
350
 
287
- \emph{emphasis}; \textbf{strong emphasis}; \titlereference{interpreted text}; \emph{interpreted text
351
+ \emph{emphasis}; \textbf{strong emphasis}; \DUroletitlereference{interpreted text}; \emph{interpreted text
288
352
  with role}; \texttt{inline literal text}; standalone hyperlink,
289
353
  \href{http://docutils.sourceforge.net}{http://docutils.sourceforge.net}; named reference, \href{http://docutils.sf.net/rst.html}{reStructuredText};
290
- \href{http://docutils.sf.net/docs/ref/rst/restructuredtext.html}{anonymous reference}; footnote reference,\raisebox{.5em}[0em]{\scriptsize\hyperlink{id1}{1}}; citation reference,
291
- [\hyperlink{cit2002}{CIT2002}]; like an inline directive; \hypertarget{inline-internal-target}{inline internal target}.
354
+ \href{http://docutils.sf.net/docs/ref/rst/restructuredtext.html}{anonymous reference}; footnote reference,\DUfootnotemark{id3}{id1}{1}; citation reference,
355
+ [\hyperlink{cit2002}{CIT2002}]; like an inline directive; %
356
+ \phantomsection\label{inline-internal-target}inline internal target.
292
357
 
293
358
 
294
359
  %___________________________________________________________________________
295
360
 
296
- \hypertarget{directive-quick-reference}{}
297
- \pdfbookmark[0]{Directive Quick Reference}{directive-quick-reference}
298
- \section*{Directive Quick Reference}
299
- \label{directive-quick-reference}
361
+ \section*{Directive Quick Reference%
362
+ \phantomsection%
363
+ \addcontentsline{toc}{section}{Directive Quick Reference}%
364
+ \label{directive-quick-reference}%
365
+ }
300
366
 
301
- See {\textless}\href{http://docutils.sf.net/docs/ref/rst/directives.html}{http://docutils.sf.net/docs/ref/rst/directives.html}{\textgreater} for full info.
367
+ See <\href{http://docutils.sf.net/docs/ref/rst/directives.html}{http://docutils.sf.net/docs/ref/rst/directives.html}> for full info.
302
368
 
303
369
  \leavevmode
304
- \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.714\locallinewidth}|}
370
+ \setlength{\DUtablewidth}{\linewidth}
371
+ \begin{longtable}[c]{|p{0.203\DUtablewidth}|p{0.714\DUtablewidth}|}
305
372
  \hline
306
- \textbf{
373
+ \textbf{%
307
374
  Directive Name
308
- } & \textbf{
375
+ } & \textbf{%
376
+ Description (Docutils version added to, in {[}brackets{]})
377
+ } \\
378
+ \hline
379
+ \endfirsthead
380
+ \hline
381
+ \textbf{%
382
+ Directive Name
383
+ } & \textbf{%
309
384
  Description (Docutils version added to, in {[}brackets{]})
310
385
  } \\
311
386
  \hline
312
387
  \endhead
388
+ \multicolumn{2}{c}{\hfill ... continued on next page} \\
389
+ \endfoot
390
+ \endlastfoot
313
391
 
314
392
  attention
315
393
  &
@@ -496,23 +574,36 @@ Set the metadata document title {[}0.3.10{]}
496
574
 
497
575
  %___________________________________________________________________________
498
576
 
499
- \hypertarget{interpreted-text-role-quick-reference}{}
500
- \pdfbookmark[0]{Interpreted Text Role Quick Reference}{interpreted-text-role-quick-reference}
501
- \section*{Interpreted Text Role Quick Reference}
502
- \label{interpreted-text-role-quick-reference}
577
+ \section*{Interpreted Text Role Quick Reference%
578
+ \phantomsection%
579
+ \addcontentsline{toc}{section}{Interpreted Text Role Quick Reference}%
580
+ \label{interpreted-text-role-quick-reference}%
581
+ }
503
582
 
504
- See {\textless}\href{http://docutils.sf.net/docs/ref/rst/roles.html}{http://docutils.sf.net/docs/ref/rst/roles.html}{\textgreater} for full info.
583
+ See <\href{http://docutils.sf.net/docs/ref/rst/roles.html}{http://docutils.sf.net/docs/ref/rst/roles.html}> for full info.
505
584
 
506
585
  \leavevmode
507
- \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.726\locallinewidth}|}
586
+ \setlength{\DUtablewidth}{\linewidth}
587
+ \begin{longtable}[c]{|p{0.203\DUtablewidth}|p{0.726\DUtablewidth}|}
588
+ \hline
589
+ \textbf{%
590
+ Role Name
591
+ } & \textbf{%
592
+ Description
593
+ } \\
594
+ \hline
595
+ \endfirsthead
508
596
  \hline
509
- \textbf{
597
+ \textbf{%
510
598
  Role Name
511
- } & \textbf{
599
+ } & \textbf{%
512
600
  Description
513
601
  } \\
514
602
  \hline
515
603
  \endhead
604
+ \multicolumn{2}{c}{\hfill ... continued on next page} \\
605
+ \endfoot
606
+ \endlastfoot
516
607
 
517
608
  emphasis
518
609
  &
@@ -18,6 +18,26 @@ class TestRbST < Test::Unit::TestCase
18
18
  assert converter.convert
19
19
  end
20
20
 
21
+ should "convert with custom executable" do
22
+ executables = {:html => "/some/path/2html.py"}
23
+ default_executables = RbST.executables
24
+ RbST.executables = executables
25
+ converter = RbST.new(@file)
26
+ converter.expects(:execute).with("python #{executables[:html]}").returns(true)
27
+ assert converter.to_html
28
+ RbST.executables = default_executables
29
+ end
30
+
31
+ should "raise error when passed bad executable key" do
32
+ executables = {:markdown => "/some/path/2markdown.py"}
33
+ begin
34
+ RbST.executables = executables
35
+ flunk
36
+ rescue ArgumentError
37
+ assert true
38
+ end
39
+ end
40
+
21
41
  should "convert ReST to html" do
22
42
  html = RbST.new(@rst_file).to_html
23
43
  assert_equal html, File.read(@html_file)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - William Melody
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-29 00:00:00 -05:00
17
+ date: 2010-05-12 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency