File tree Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 5
5
Travis D. Warlick, Jr.
6
6
* Image paths at HTTPS URLs are now turned into +<img>+ tags. Pull
7
7
Request #60 by James Mead
8
+ * Markup defined by RDoc::Markup#add_special inside a <tt><tt></tt> is no
9
+ longer converted.
8
10
9
11
=== 3.9.2 / 2011-08-11
10
12
Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ test/test_rdoc_include.rb
136
136
test/test_rdoc_markup.rb
137
137
test/test_rdoc_markup_attribute_manager.rb
138
138
test/test_rdoc_markup_document.rb
139
+ test/test_rdoc_markup_formatter.rb
139
140
test/test_rdoc_markup_indented_paragraph.rb
140
141
test/test_rdoc_markup_paragraph.rb
141
142
test/test_rdoc_markup_parser.rb
Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ def convert_flow(flow)
88
88
##
89
89
# Converts added specials. See RDoc::Markup#add_special
90
90
91
- def convert_special ( special )
91
+ def convert_special special
92
+ return special . text if in_tt?
93
+
92
94
handled = false
93
95
94
96
RDoc ::Markup ::Attribute . each_name_of special . type do |name |
Original file line number Diff line number Diff line change
1
+ require 'rubygems'
2
+ require 'minitest/autorun'
3
+ require 'rdoc'
4
+ require 'rdoc/markup'
5
+ require 'rdoc/markup/formatter'
6
+
7
+ class TestRDocMarkupFormatter < MiniTest ::Unit ::TestCase
8
+
9
+ class ToTest < RDoc ::Markup ::Formatter
10
+
11
+ def initialize markup
12
+ super
13
+
14
+ add_tag :TT , '<tt>' , '</tt>'
15
+ end
16
+
17
+ def accept_paragraph paragraph
18
+ @res << attributes ( paragraph . text )
19
+ end
20
+
21
+ def attributes text
22
+ convert_flow @am . flow text . dup
23
+ end
24
+
25
+ def handle_special_CAPS special
26
+ "handled #{ special . text } "
27
+ end
28
+
29
+ def start_accepting
30
+ @res = ""
31
+ end
32
+
33
+ def end_accepting
34
+ @res
35
+ end
36
+
37
+ end
38
+
39
+ def setup
40
+ @markup = RDoc ::Markup . new
41
+ @markup . add_special ( /[A-Z]+/ , :CAPS )
42
+
43
+ @to = ToTest . new @markup
44
+
45
+ @caps = RDoc ::Markup ::Attribute . bitmap_for :CAPS
46
+ @special = RDoc ::Markup ::Attribute . bitmap_for :_SPECIAL_
47
+ @tt = RDoc ::Markup ::Attribute . bitmap_for :TT
48
+ end
49
+
50
+ def test_convert_tt_special
51
+ converted = @to . convert '<tt>AAA</tt>'
52
+
53
+ assert_equal '<tt>AAA</tt>' , converted
54
+ end
55
+
56
+ end
57
+
You can’t perform that action at this time.
0 commit comments