Skip to content

Commit f43b131

Browse files
authored
Merge pull request #708 from aycabta/support-nesting-text-page-url
Support nesting text page URL
2 parents 18abd1c + d73b915 commit f43b131

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/rdoc/servlet.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,15 @@ def do_GET req, res
145145
# +generator+ is used to create the page.
146146

147147
def documentation_page store, generator, path, req, res
148-
name = path.sub(/.html$/, '').gsub '/', '::'
148+
text_name = path.sub /.html$/, ''
149+
name = text_name.gsub '/', '::'
149150

150151
if klass = store.find_class_or_module(name) then
151152
res.body = generator.generate_class klass
152153
elsif page = store.find_text_page(name.sub(/_([^_]*)$/, '.\1')) then
153154
res.body = generator.generate_page page
155+
elsif page = store.find_text_page(text_name.sub(/_([^_]*)$/, '.\1')) then
156+
res.body = generator.generate_page page
154157
else
155158
not_found generator, req, res
156159
end

test/test_rdoc_servlet.rb

+12
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ def test_documentation_page_page
232232
assert_match %r%<body [^>]+ class="file">%, @res.body
233233
end
234234

235+
def test_documentation_page_page_with_nesting
236+
store = RDoc::Store.new
237+
238+
generator = @s.generator_for store
239+
240+
readme = store.add_file 'nesting/README.rdoc', parser: RDoc::Parser::Simple
241+
242+
@s.documentation_page store, generator, 'nesting/README_rdoc.html', @req, @res
243+
244+
assert_equal 200, @res.status
245+
end
246+
235247
def test_documentation_source
236248
store, path = @s.documentation_source '/ruby/Object.html'
237249

0 commit comments

Comments
 (0)