File tree Expand file tree Collapse file tree 3 files changed +38
-12
lines changed Expand file tree Collapse file tree 3 files changed +38
-12
lines changed Original file line number Diff line number Diff line change 1717 * Fixed `rdoc --ri-site`. Bug #193 by Michal Papis.
1818 * RDoc no longer attempts to parse binary files. Bug #189 by postmodern,
1919 Bug #190 by Christoffer Lervåg, Bug #195 by Aaron Patterson
20+ * `rdoc --pipe` output now contains <code></code> for markdown compliance.
2021
2122=== 4.0.0 / 2013-02-24
2223
Original file line number Diff line number Diff line change @@ -186,19 +186,26 @@ def accept_paragraph paragraph
186186 def accept_verbatim verbatim
187187 text = verbatim . text . rstrip
188188
189- @res << if verbatim . ruby? or parseable? text then
190- begin
191- tokens = RDoc ::RubyLex . tokenize text , @options
192-
193- html = RDoc ::TokenStream . to_html tokens
194-
195- "\n <pre class=\" ruby\" >#{ html } </pre>\n "
196- rescue RDoc ::RubyLex ::Error
197- "\n <pre>#{ CGI . escapeHTML text } </pre>\n "
189+ klass = nil
190+
191+ content = if verbatim . ruby? or parseable? text then
192+ begin
193+ tokens = RDoc ::RubyLex . tokenize text , @options
194+ klass = ' class="ruby"'
195+
196+ RDoc ::TokenStream . to_html tokens
197+ rescue RDoc ::RubyLex ::Error
198+ CGI . escapeHTML text
199+ end
200+ else
201+ CGI . escapeHTML text
198202 end
199- else
200- "\n <pre>#{ CGI . escapeHTML text } </pre>\n "
201- end
203+
204+ if @options . pipe then
205+ @res << "\n <pre><code>#{ CGI . escapeHTML text } </code></pre>\n "
206+ else
207+ @res << "\n <pre#{ klass } >#{ content } </pre>\n "
208+ end
202209 end
203210
204211 ##
Original file line number Diff line number Diff line change @@ -422,6 +422,24 @@ def test_accept_verbatim_parseable_error
422422 assert_equal expected , @to . res . join
423423 end
424424
425+ def test_accept_verbatim_pipe
426+ @options . pipe = true
427+
428+ verb = @RM ::Verbatim . new ( "1 + 1\n " )
429+ verb . format = :ruby
430+
431+ @to . start_accepting
432+ @to . accept_verbatim verb
433+
434+ expected = <<-EXPECTED
435+
436+ <pre><code>1 + 1
437+ </code></pre>
438+ EXPECTED
439+
440+ assert_equal expected , @to . res . join
441+ end
442+
425443 def test_accept_verbatim_ruby
426444 verb = @RM ::Verbatim . new ( "1 + 1\n " )
427445 verb . format = :ruby
You can’t perform that action at this time.
0 commit comments