diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-28 07:41:19 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-28 07:41:19 +0000 |
commit | 45011d08e13878ba7593cc4aa3d112d689b9b95e (patch) | |
tree | f0008a69899f3fc93db8a688da57e72c82d84527 /lib/rdoc/servlet.rb | |
parent | 013521e55742a07fbc5a4b264862b2da21168b89 (diff) | |
download | ruby-45011d08e13878ba7593cc4aa3d112d689b9b95e.tar.gz |
* lib/rdoc/servlet.rb: Add support for serving documentation from a
subdirectory.
* lib/rdoc/generator/darkfish.rb: ditto
* test/rdoc/test_rdoc_servlet.rb: Test for above
* test/rdoc/test_rdoc_servlet.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/servlet.rb')
-rw-r--r-- | lib/rdoc/servlet.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index a4aafeb252..d308288029 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -17,11 +17,13 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet new server, stores, @cache, *options end - def initialize server, stores, cache + def initialize server, stores, cache, mount_path = nil super server - @stores = stores - @cache = cache + @cache = cache + @mount_path = mount_path + @stores = stores + @options = RDoc::Options.new @options.op_dir = '.' @@ -59,6 +61,8 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet end def do_GET req, res + req.path.sub!(/^#{Regexp.escape @mount_path}/o, '') if @mount_path + case req.path when '/' then root req, res @@ -128,7 +132,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet <title>Error - #{ERB::Util.html_escape e.class}</title> -<link type="text/css" media="screen" href="/rdoc.css" rel="stylesheet"> +<link type="text/css" media="screen" href="#{@mouth_path}/rdoc.css" rel="stylesheet"> </head> <body> <h1>Error</h1> |