aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/generator
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-07 01:22:37 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-07 01:22:37 +0000
commit4260aa1dc399e1bb4a2147409ed1139112cfefb8 (patch)
tree72b378fdcef83d532147bb6deeafe2ad55134f3e /lib/rdoc/generator
parent7d2d6d0a2f600943ab484238b4722036151376a5 (diff)
downloadruby-4260aa1dc399e1bb4a2147409ed1139112cfefb8.tar.gz
* lib/rdoc: Update to RDoc 4.2.0.
* test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/generator')
-rw-r--r--lib/rdoc/generator/darkfish.rb5
-rw-r--r--lib/rdoc/generator/json_index.rb44
-rw-r--r--lib/rdoc/generator/template/darkfish/_head.rhtml4
-rw-r--r--lib/rdoc/generator/template/darkfish/css/fonts.css (renamed from lib/rdoc/generator/template/darkfish/fonts.css)0
-rw-r--r--lib/rdoc/generator/template/darkfish/css/rdoc.css (renamed from lib/rdoc/generator/template/darkfish/rdoc.css)0
5 files changed, 49 insertions, 4 deletions
diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb
index bd37b60668..024040466d 100644
--- a/lib/rdoc/generator/darkfish.rb
+++ b/lib/rdoc/generator/darkfish.rb
@@ -62,14 +62,14 @@ class RDoc::Generator::Darkfish
BUILTIN_STYLE_ITEMS = # :nodoc:
%w[
- fonts.css
+ css/fonts.css
fonts/Lato-Light.ttf
fonts/Lato-LightItalic.ttf
fonts/Lato-Regular.ttf
fonts/Lato-RegularItalic.ttf
fonts/SourceCodePro-Bold.ttf
fonts/SourceCodePro-Regular.ttf
- rdoc.css
+ css/rdoc.css
]
##
@@ -246,6 +246,7 @@ class RDoc::Generator::Darkfish
generate_file_files
generate_table_of_contents
@json_index.generate
+ @json_index.generate_gzipped
copy_static
diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb
index c303b2effb..9d6f0d4356 100644
--- a/lib/rdoc/generator/json_index.rb
+++ b/lib/rdoc/generator/json_index.rb
@@ -1,4 +1,5 @@
require 'json'
+require 'zlib'
##
# The JsonIndex generator is designed to complement an HTML generator and
@@ -153,6 +154,49 @@ class RDoc::Generator::JsonIndex
end
##
+ # Compress the search_index.js file using gzip
+
+ def generate_gzipped
+ debug_msg "Compressing generated JSON index"
+ out_dir = @base_dir + @options.op_dir
+
+ search_index_file = out_dir + SEARCH_INDEX_FILE
+ outfile = out_dir + "#{search_index_file}.gz"
+
+ debug_msg "Reading the JSON index file from %s" % search_index_file
+ search_index = search_index_file.read
+
+ debug_msg "Writing gzipped search index to %s" % outfile
+
+ Zlib::GzipWriter.open(outfile) do |gz|
+ gz.mtime = File.mtime(search_index_file)
+ gz.orig_name = search_index_file.to_s
+ gz.write search_index
+ gz.close
+ end
+
+ # GZip the rest of the js files
+ Dir.chdir @template_dir do
+ Dir['**/*.js'].each do |source|
+ dest = out_dir + source
+ outfile = out_dir + "#{dest}.gz"
+
+ debug_msg "Reading the original js file from %s" % dest
+ data = dest.read
+
+ debug_msg "Writing gzipped file to %s" % outfile
+
+ Zlib::GzipWriter.open(outfile) do |gz|
+ gz.mtime = File.mtime(dest)
+ gz.orig_name = dest.to_s
+ gz.write data
+ gz.close
+ end
+ end
+ end
+ end
+
+ ##
# Adds classes and modules to the index
def index_classes
diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml
index c87ba95096..70f1c188d6 100644
--- a/lib/rdoc/generator/template/darkfish/_head.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_head.rhtml
@@ -9,8 +9,8 @@
<script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
<script src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
-<link href="<%= asset_rel_prefix %>/fonts.css" rel="stylesheet">
-<link href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
<% if @options.template_stylesheets.flatten.any? then %>
<% @options.template_stylesheets.flatten.each do |stylesheet| %>
<link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
diff --git a/lib/rdoc/generator/template/darkfish/fonts.css b/lib/rdoc/generator/template/darkfish/css/fonts.css
index e9e721183b..e9e721183b 100644
--- a/lib/rdoc/generator/template/darkfish/fonts.css
+++ b/lib/rdoc/generator/template/darkfish/css/fonts.css
diff --git a/lib/rdoc/generator/template/darkfish/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css
index 2f4dca7e08..2f4dca7e08 100644
--- a/lib/rdoc/generator/template/darkfish/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css