File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed
lib/rdoc/generator/template/darkfish Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 12
12
<%- end . each do |n , files | -%>
13
13
<%- f = files . shift -%>
14
14
<%- if files . empty? -%>
15
- < li > < a href ="<%= rel_prefix %> / <%= f . path %> "> <%= h f . page_name %> </ a >
15
+ < li > < a href ="<%= rel_prefix %> / <%= h f . path %> "> <%= h f . page_name %> </ a >
16
16
<%- next -%>
17
17
<%- end -%>
18
18
< li > < details <% if dir == n %> open <% end %> > < summary > <%
19
19
if n == f . page_name
20
- %> < a href ="<%= rel_prefix %> / <%= f . path %> "> <%= h n %> </ a > <%
20
+ %> < a href ="<%= rel_prefix %> / <%= h f . path %> "> <%= h n %> </ a > <%
21
21
else
22
22
%> <%= h n %> <% files . unshift ( f )
23
23
end %> </ summary >
24
24
< ul class ="link-list ">
25
25
<%- files . each do |f | -%>
26
- < li > < a href ="<%= rel_prefix %> / <%= f . path %> "> <%= h f . page_name %> </ a >
26
+ < li > < a href ="<%= rel_prefix %> / <%= h f . path %> "> <%= h f . page_name %> </ a >
27
27
<%- end -%>
28
28
</ ul > </ details >
29
29
<%- end -%>
Original file line number Diff line number Diff line change 8
8
< ul >
9
9
<%- simple_files . sort . each do |file | -%>
10
10
< li class ="file ">
11
- < a href ="<%= file . path %> "> <%= h file . page_name %> </ a >
11
+ < a href ="<%= h file . path %> "> <%= h file . page_name %> </ a >
12
12
<%
13
13
# HACK table_of_contents should not exist on Document
14
14
table = file . parse ( file . comment ) . table_of_contents
15
15
unless table . empty? then %>
16
16
< ul >
17
17
<%- table . each do |heading | -%>
18
- < li > < a href ="<%= file . path %> # <%= heading . aref %> "> <%= heading . plain_html %> </ a >
18
+ < li > < a href ="<%= h file . path %> # <%= heading . aref %> "> <%= heading . plain_html %> </ a >
19
19
<%- end -%>
20
20
</ ul >
21
21
<%- end -%>
Original file line number Diff line number Diff line change @@ -233,6 +233,20 @@ def test_generated_method_with_html_tag_yield
233
233
assert_includes method_name , '{ |%<<script>alert("atui")</script>>, yield_arg| ... }'
234
234
end
235
235
236
+ def test_generated_filename_with_html_tag
237
+ @store . add_file '"><em>should be escaped'
238
+ doc = @store . all_files . last
239
+ doc . parser = RDoc ::Parser ::Simple
240
+
241
+ @g . generate
242
+
243
+ Dir . glob ( "*.html" , base : @tmpdir ) do |html |
244
+ File . read ( File . join ( @tmpdir , html ) ) . scan ( /.*should be escaped.*/ ) do |line |
245
+ assert_not_include line , "<em>" , html
246
+ end
247
+ end
248
+ end
249
+
236
250
def test_template_stylesheets
237
251
css = Tempfile . create ( %W' hoge .css ' , Dir . mktmpdir ( 'tmp' , '.' ) )
238
252
File . write ( css , '' )
You can’t perform that action at this time.
0 commit comments