From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/lib/rdoc/generator/darkfish.rb | 760 +++++++++++++++++++++ jni/ruby/lib/rdoc/generator/json_index.rb | 292 ++++++++ jni/ruby/lib/rdoc/generator/markup.rb | 169 +++++ jni/ruby/lib/rdoc/generator/pot.rb | 97 +++ .../lib/rdoc/generator/pot/message_extractor.rb | 67 ++ jni/ruby/lib/rdoc/generator/pot/po.rb | 83 +++ jni/ruby/lib/rdoc/generator/pot/po_entry.rb | 140 ++++ jni/ruby/lib/rdoc/generator/ri.rb | 30 + .../lib/rdoc/generator/template/darkfish/.document | 0 .../rdoc/generator/template/darkfish/_footer.rhtml | 5 + .../rdoc/generator/template/darkfish/_head.rhtml | 19 + .../template/darkfish/_sidebar_VCS_info.rhtml | 19 + .../template/darkfish/_sidebar_classes.rhtml | 9 + .../template/darkfish/_sidebar_extends.rhtml | 15 + .../template/darkfish/_sidebar_in_files.rhtml | 9 + .../template/darkfish/_sidebar_includes.rhtml | 15 + .../template/darkfish/_sidebar_installed.rhtml | 15 + .../template/darkfish/_sidebar_methods.rhtml | 12 + .../template/darkfish/_sidebar_navigation.rhtml | 11 + .../template/darkfish/_sidebar_pages.rhtml | 12 + .../template/darkfish/_sidebar_parent.rhtml | 11 + .../template/darkfish/_sidebar_search.rhtml | 14 + .../template/darkfish/_sidebar_sections.rhtml | 11 + .../darkfish/_sidebar_table_of_contents.rhtml | 18 + .../rdoc/generator/template/darkfish/class.rhtml | 174 +++++ .../rdoc/generator/template/darkfish/css/fonts.css | 167 +++++ .../rdoc/generator/template/darkfish/css/rdoc.css | 590 ++++++++++++++++ .../template/darkfish/fonts/Lato-Light.ttf | Bin 0 -> 94668 bytes .../template/darkfish/fonts/Lato-LightItalic.ttf | Bin 0 -> 94196 bytes .../template/darkfish/fonts/Lato-Regular.ttf | Bin 0 -> 96184 bytes .../template/darkfish/fonts/Lato-RegularItalic.ttf | Bin 0 -> 95316 bytes .../template/darkfish/fonts/SourceCodePro-Bold.ttf | Bin 0 -> 71200 bytes .../darkfish/fonts/SourceCodePro-Regular.ttf | Bin 0 -> 71692 bytes .../generator/template/darkfish/images/add.png | Bin 0 -> 733 bytes .../template/darkfish/images/arrow_up.png | Bin 0 -> 372 bytes .../generator/template/darkfish/images/brick.png | Bin 0 -> 452 bytes .../template/darkfish/images/brick_link.png | Bin 0 -> 764 bytes .../generator/template/darkfish/images/bug.png | Bin 0 -> 774 bytes .../template/darkfish/images/bullet_black.png | Bin 0 -> 211 bytes .../darkfish/images/bullet_toggle_minus.png | Bin 0 -> 207 bytes .../darkfish/images/bullet_toggle_plus.png | Bin 0 -> 209 bytes .../generator/template/darkfish/images/date.png | Bin 0 -> 626 bytes .../generator/template/darkfish/images/delete.png | Bin 0 -> 715 bytes .../generator/template/darkfish/images/find.png | Bin 0 -> 659 bytes .../template/darkfish/images/loadingAnimation.gif | Bin 0 -> 5886 bytes .../template/darkfish/images/macFFBgHack.png | Bin 0 -> 207 bytes .../generator/template/darkfish/images/package.png | Bin 0 -> 853 bytes .../template/darkfish/images/page_green.png | Bin 0 -> 621 bytes .../template/darkfish/images/page_white_text.png | Bin 0 -> 342 bytes .../template/darkfish/images/page_white_width.png | Bin 0 -> 309 bytes .../generator/template/darkfish/images/plugin.png | Bin 0 -> 591 bytes .../generator/template/darkfish/images/ruby.png | Bin 0 -> 592 bytes .../template/darkfish/images/tag_blue.png | Bin 0 -> 1880 bytes .../template/darkfish/images/tag_green.png | Bin 0 -> 613 bytes .../template/darkfish/images/transparent.png | Bin 0 -> 97 bytes .../generator/template/darkfish/images/wrench.png | Bin 0 -> 610 bytes .../template/darkfish/images/wrench_orange.png | Bin 0 -> 584 bytes .../generator/template/darkfish/images/zoom.png | Bin 0 -> 692 bytes .../rdoc/generator/template/darkfish/index.rhtml | 23 + .../generator/template/darkfish/js/darkfish.js | 161 +++++ .../rdoc/generator/template/darkfish/js/jquery.js | 4 + .../rdoc/generator/template/darkfish/js/search.js | 109 +++ .../rdoc/generator/template/darkfish/page.rhtml | 18 + .../template/darkfish/servlet_not_found.rhtml | 18 + .../generator/template/darkfish/servlet_root.rhtml | 63 ++ .../template/darkfish/table_of_contents.rhtml | 58 ++ .../rdoc/generator/template/json_index/.document | 1 + .../generator/template/json_index/js/navigation.js | 142 ++++ .../generator/template/json_index/js/searcher.js | 228 +++++++ 69 files changed, 3589 insertions(+) create mode 100644 jni/ruby/lib/rdoc/generator/darkfish.rb create mode 100644 jni/ruby/lib/rdoc/generator/json_index.rb create mode 100644 jni/ruby/lib/rdoc/generator/markup.rb create mode 100644 jni/ruby/lib/rdoc/generator/pot.rb create mode 100644 jni/ruby/lib/rdoc/generator/pot/message_extractor.rb create mode 100644 jni/ruby/lib/rdoc/generator/pot/po.rb create mode 100644 jni/ruby/lib/rdoc/generator/pot/po_entry.rb create mode 100644 jni/ruby/lib/rdoc/generator/ri.rb create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/.document create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_footer.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_head.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/class.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/css/fonts.css create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/css/rdoc.css create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/add.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/arrow_up.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/brick.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/brick_link.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/bug.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_black.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/date.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/delete.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/find.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/package.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/page_green.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_text.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_width.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/plugin.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/ruby.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_blue.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_green.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/transparent.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench_orange.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/images/zoom.png create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/index.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/js/darkfish.js create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/js/jquery.js create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/js/search.js create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/page.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/servlet_root.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml create mode 100644 jni/ruby/lib/rdoc/generator/template/json_index/.document create mode 100644 jni/ruby/lib/rdoc/generator/template/json_index/js/navigation.js create mode 100644 jni/ruby/lib/rdoc/generator/template/json_index/js/searcher.js (limited to 'jni/ruby/lib/rdoc/generator') diff --git a/jni/ruby/lib/rdoc/generator/darkfish.rb b/jni/ruby/lib/rdoc/generator/darkfish.rb new file mode 100644 index 0000000..0240404 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/darkfish.rb @@ -0,0 +1,760 @@ +# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*- + +require 'erb' +require 'fileutils' +require 'pathname' +require 'rdoc/generator/markup' + +## +# Darkfish RDoc HTML Generator +# +# $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $ +# +# == Author/s +# * Michael Granger (ged@FaerieMUD.org) +# +# == Contributors +# * Mahlon E. Smith (mahlon@martini.nu) +# * Eric Hodel (drbrain@segment7.net) +# +# == License +# +# Copyright (c) 2007, 2008, Michael Granger. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# * Neither the name of the author/s, nor the names of the project's +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# == Attributions +# +# Darkfish uses the {Silk Icons}[http://www.famfamfam.com/lab/icons/silk/] set +# by Mark James. + +class RDoc::Generator::Darkfish + + RDoc::RDoc.add_generator self + + include ERB::Util + + ## + # Stylesheets, fonts, etc. that are included in RDoc. + + BUILTIN_STYLE_ITEMS = # :nodoc: + %w[ + 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 + css/rdoc.css + ] + + ## + # Path to this file's parent directory. Used to find templates and other + # resources. + + GENERATOR_DIR = File.join 'rdoc', 'generator' + + ## + # Release Version + + VERSION = '3' + + ## + # Description of this generator + + DESCRIPTION = 'HTML generator, written by Michael Granger' + + ## + # The relative path to style sheets and javascript. By default this is set + # the same as the rel_prefix. + + attr_accessor :asset_rel_path + + ## + # The path to generate files into, combined with --op from the + # options for a full path. + + attr_reader :base_dir + + ## + # Classes and modules to be used by this generator, not necessarily + # displayed. See also #modsort + + attr_reader :classes + + ## + # No files will be written when dry_run is true. + + attr_accessor :dry_run + + ## + # When false the generate methods return a String instead of writing to a + # file. The default is true. + + attr_accessor :file_output + + ## + # Files to be displayed by this generator + + attr_reader :files + + ## + # The JSON index generator for this Darkfish generator + + attr_reader :json_index + + ## + # Methods to be displayed by this generator + + attr_reader :methods + + ## + # Sorted list of classes and modules to be displayed by this generator + + attr_reader :modsort + + ## + # The RDoc::Store that is the source of the generated content + + attr_reader :store + + ## + # The directory where the template files live + + attr_reader :template_dir # :nodoc: + + ## + # The output directory + + attr_reader :outputdir + + ## + # Initialize a few instance variables before we start + + def initialize store, options + @store = store + @options = options + + @asset_rel_path = '' + @base_dir = Pathname.pwd.expand_path + @dry_run = @options.dry_run + @file_output = true + @template_dir = Pathname.new options.template_dir + @template_cache = {} + + @classes = nil + @context = nil + @files = nil + @methods = nil + @modsort = nil + + @json_index = RDoc::Generator::JsonIndex.new self, options + end + + ## + # Output progress information if debugging is enabled + + def debug_msg *msg + return unless $DEBUG_RDOC + $stderr.puts(*msg) + end + + ## + # Directory where generated class HTML files live relative to the output + # dir. + + def class_dir + nil + end + + ## + # Directory where generated class HTML files live relative to the output + # dir. + + def file_dir + nil + end + + ## + # Create the directories the generated docs will live in if they don't + # already exist. + + def gen_sub_directories + @outputdir.mkpath + end + + ## + # Copy over the stylesheet into the appropriate place in the output + # directory. + + def write_style_sheet + debug_msg "Copying static files" + options = { :verbose => $DEBUG_RDOC, :noop => @dry_run } + + BUILTIN_STYLE_ITEMS.each do |item| + install_rdoc_static_file @template_dir + item, "./#{item}", options + end + + @options.template_stylesheets.each do |stylesheet| + FileUtils.cp stylesheet, '.', options + end + + Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path| + next if File.directory? path + next if File.basename(path) =~ /^\./ + + dst = Pathname.new(path).relative_path_from @template_dir + + install_rdoc_static_file @template_dir + path, dst, options + end + end + + ## + # Build the initial indices and output objects based on an array of TopLevel + # objects containing the extracted information. + + def generate + setup + + write_style_sheet + generate_index + generate_class_files + generate_file_files + generate_table_of_contents + @json_index.generate + @json_index.generate_gzipped + + copy_static + + rescue => e + debug_msg "%s: %s\n %s" % [ + e.class.name, e.message, e.backtrace.join("\n ") + ] + + raise + end + + ## + # Copies static files from the static_path into the output directory + + def copy_static + return if @options.static_path.empty? + + fu_options = { :verbose => $DEBUG_RDOC, :noop => @dry_run } + + @options.static_path.each do |path| + unless File.directory? path then + FileUtils.install path, @outputdir, fu_options.merge(:mode => 0644) + next + end + + Dir.chdir path do + Dir[File.join('**', '*')].each do |entry| + dest_file = @outputdir + entry + + if File.directory? entry then + FileUtils.mkdir_p entry, fu_options + else + FileUtils.install entry, dest_file, fu_options.merge(:mode => 0644) + end + end + end + end + end + + ## + # Return a list of the documented modules sorted by salience first, then + # by name. + + def get_sorted_module_list classes + classes.select do |klass| + klass.display? + end.sort + end + + ## + # Generate an index page which lists all the classes which are documented. + + def generate_index + setup + + template_file = @template_dir + 'index.rhtml' + return unless template_file.exist? + + debug_msg "Rendering the index page..." + + out_file = @base_dir + @options.op_dir + 'index.html' + rel_prefix = @outputdir.relative_path_from out_file.dirname + search_index_rel_prefix = rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + # suppress 1.9.3 warning + asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + + @title = @options.title + + render_template template_file, out_file do |io| binding end + rescue => e + error = RDoc::Error.new \ + "error generating index.html: #{e.message} (#{e.class})" + error.set_backtrace e.backtrace + + raise error + end + + ## + # Generates a class file for +klass+ + + def generate_class klass, template_file = nil + setup + + current = klass + + template_file ||= @template_dir + 'class.rhtml' + + debug_msg " working on %s (%s)" % [klass.full_name, klass.path] + out_file = @outputdir + klass.path + rel_prefix = @outputdir.relative_path_from out_file.dirname + search_index_rel_prefix = rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + # suppress 1.9.3 warning + asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + svninfo = svninfo = get_svninfo(current) + + @title = "#{klass.type} #{klass.full_name} - #{@options.title}" + + debug_msg " rendering #{out_file}" + render_template template_file, out_file do |io| binding end + end + + ## + # Generate a documentation file for each class and module + + def generate_class_files + setup + + template_file = @template_dir + 'class.rhtml' + template_file = @template_dir + 'classpage.rhtml' unless + template_file.exist? + return unless template_file.exist? + debug_msg "Generating class documentation in #{@outputdir}" + + current = nil + + @classes.each do |klass| + current = klass + + generate_class klass, template_file + end + rescue => e + error = RDoc::Error.new \ + "error generating #{current.path}: #{e.message} (#{e.class})" + error.set_backtrace e.backtrace + + raise error + end + + ## + # Generate a documentation file for each file + + def generate_file_files + setup + + page_file = @template_dir + 'page.rhtml' + fileinfo_file = @template_dir + 'fileinfo.rhtml' + + # for legacy templates + filepage_file = @template_dir + 'filepage.rhtml' unless + page_file.exist? or fileinfo_file.exist? + + return unless + page_file.exist? or fileinfo_file.exist? or filepage_file.exist? + + debug_msg "Generating file documentation in #{@outputdir}" + + out_file = nil + current = nil + + @files.each do |file| + current = file + + if file.text? and page_file.exist? then + generate_page file + next + end + + template_file = nil + out_file = @outputdir + file.path + debug_msg " working on %s (%s)" % [file.full_name, out_file] + rel_prefix = @outputdir.relative_path_from out_file.dirname + search_index_rel_prefix = rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + # suppress 1.9.3 warning + asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + + unless filepage_file then + if file.text? then + next unless page_file.exist? + template_file = page_file + @title = file.page_name + else + next unless fileinfo_file.exist? + template_file = fileinfo_file + @title = "File: #{file.base_name}" + end + end + + @title += " - #{@options.title}" + template_file ||= filepage_file + + render_template template_file, out_file do |io| binding end + end + rescue => e + error = + RDoc::Error.new "error generating #{out_file}: #{e.message} (#{e.class})" + error.set_backtrace e.backtrace + + raise error + end + + ## + # Generate a page file for +file+ + + def generate_page file + setup + + template_file = @template_dir + 'page.rhtml' + + out_file = @outputdir + file.path + debug_msg " working on %s (%s)" % [file.full_name, out_file] + rel_prefix = @outputdir.relative_path_from out_file.dirname + search_index_rel_prefix = rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + # suppress 1.9.3 warning + current = current = file + asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + + @title = "#{file.page_name} - #{@options.title}" + + debug_msg " rendering #{out_file}" + render_template template_file, out_file do |io| binding end + end + + ## + # Generates the 404 page for the RDoc servlet + + def generate_servlet_not_found message + setup + + template_file = @template_dir + 'servlet_not_found.rhtml' + return unless template_file.exist? + + debug_msg "Rendering the servlet 404 Not Found page..." + + rel_prefix = rel_prefix = '' + search_index_rel_prefix = rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + # suppress 1.9.3 warning + asset_rel_prefix = asset_rel_prefix = '' + + @title = 'Not Found' + + render_template template_file do |io| binding end + rescue => e + error = RDoc::Error.new \ + "error generating servlet_not_found: #{e.message} (#{e.class})" + error.set_backtrace e.backtrace + + raise error + end + + ## + # Generates the servlet root page for the RDoc servlet + + def generate_servlet_root installed + setup + + template_file = @template_dir + 'servlet_root.rhtml' + return unless template_file.exist? + + debug_msg 'Rendering the servlet root page...' + + rel_prefix = '.' + asset_rel_prefix = rel_prefix + search_index_rel_prefix = asset_rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + @title = 'Local RDoc Documentation' + + render_template template_file do |io| binding end + rescue => e + error = RDoc::Error.new \ + "error generating servlet_root: #{e.message} (#{e.class})" + error.set_backtrace e.backtrace + + raise error + end + + ## + # Generate an index page which lists all the classes which are documented. + + def generate_table_of_contents + setup + + template_file = @template_dir + 'table_of_contents.rhtml' + return unless template_file.exist? + + debug_msg "Rendering the Table of Contents..." + + out_file = @outputdir + 'table_of_contents.html' + rel_prefix = @outputdir.relative_path_from out_file.dirname + search_index_rel_prefix = rel_prefix + search_index_rel_prefix += @asset_rel_path if @file_output + + # suppress 1.9.3 warning + asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + + @title = "Table of Contents - #{@options.title}" + + render_template template_file, out_file do |io| binding end + rescue => e + error = RDoc::Error.new \ + "error generating table_of_contents.html: #{e.message} (#{e.class})" + error.set_backtrace e.backtrace + + raise error + end + + def install_rdoc_static_file source, destination, options # :nodoc: + return unless source.exist? + + begin + FileUtils.mkdir_p File.dirname(destination), options + + begin + FileUtils.ln source, destination, options + rescue Errno::EEXIST + FileUtils.rm destination + retry + end + rescue + FileUtils.cp source, destination, options + end + end + + ## + # Prepares for generation of output from the current directory + + def setup + return if instance_variable_defined? :@outputdir + + @outputdir = Pathname.new(@options.op_dir).expand_path @base_dir + + return unless @store + + @classes = @store.all_classes_and_modules.sort + @files = @store.all_files.sort + @methods = @classes.map { |m| m.method_list }.flatten.sort + @modsort = get_sorted_module_list @classes + end + + ## + # Return a string describing the amount of time in the given number of + # seconds in terms a human can understand easily. + + def time_delta_string seconds + return 'less than a minute' if seconds < 60 + return "#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}" if + seconds < 3000 # 50 minutes + return 'about one hour' if seconds < 5400 # 90 minutes + return "#{seconds / 3600} hours" if seconds < 64800 # 18 hours + return 'one day' if seconds < 86400 # 1 day + return 'about one day' if seconds < 172800 # 2 days + return "#{seconds / 86400} days" if seconds < 604800 # 1 week + return 'about one week' if seconds < 1209600 # 2 week + return "#{seconds / 604800} weeks" if seconds < 7257600 # 3 months + return "#{seconds / 2419200} months" if seconds < 31536000 # 1 year + return "#{seconds / 31536000} years" + end + + # %q$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $" + SVNID_PATTERN = / + \$Id:\s + (\S+)\s # filename + (\d+)\s # rev + (\d{4}-\d{2}-\d{2})\s # Date (YYYY-MM-DD) + (\d{2}:\d{2}:\d{2}Z)\s # Time (HH:MM:SSZ) + (\w+)\s # committer + \$$ + /x + + ## + # Try to extract Subversion information out of the first constant whose + # value looks like a subversion Id tag. If no matching constant is found, + # and empty hash is returned. + + def get_svninfo klass + constants = klass.constants or return {} + + constants.find { |c| c.value =~ SVNID_PATTERN } or return {} + + filename, rev, date, time, committer = $~.captures + commitdate = Time.parse "#{date} #{time}" + + return { + :filename => filename, + :rev => Integer(rev), + :commitdate => commitdate, + :commitdelta => time_delta_string(Time.now - commitdate), + :committer => committer, + } + end + + ## + # Creates a template from its components and the +body_file+. + # + # For backwards compatibility, if +body_file+ contains " + + + +#{head_file.read} + +#{body} + +#{footer_file.read} + TEMPLATE + end + + ## + # Renders the ERb contained in +file_name+ relative to the template + # directory and returns the result based on the current context. + + def render file_name + template_file = @template_dir + file_name + + template = template_for template_file, false, RDoc::ERBPartial + + template.filename = template_file.to_s + + template.result @context + end + + ## + # Load and render the erb template in the given +template_file+ and write + # it out to +out_file+. + # + # Both +template_file+ and +out_file+ should be Pathname-like objects. + # + # An io will be yielded which must be captured by binding in the caller. + + def render_template template_file, out_file = nil # :yield: io + io_output = out_file && !@dry_run && @file_output + erb_klass = io_output ? RDoc::ERBIO : ERB + + template = template_for template_file, true, erb_klass + + if io_output then + debug_msg "Outputting to %s" % [out_file.expand_path] + + out_file.dirname.mkpath + out_file.open 'w', 0644 do |io| + io.set_encoding @options.encoding if Object.const_defined? :Encoding + + @context = yield io + + template_result template, @context, template_file + end + else + @context = yield nil + + output = template_result template, @context, template_file + + debug_msg " would have written %d characters to %s" % [ + output.length, out_file.expand_path + ] if @dry_run + + output + end + end + + ## + # Creates the result for +template+ with +context+. If an error is raised a + # Pathname +template_file+ will indicate the file where the error occurred. + + def template_result template, context, template_file + template.filename = template_file.to_s + template.result context + rescue NoMethodError => e + raise RDoc::Error, "Error while evaluating %s: %s" % [ + template_file.expand_path, + e.message, + ], e.backtrace + end + + ## + # Retrieves a cache template for +file+, if present, or fills the cache. + + def template_for file, page = true, klass = ERB + template = @template_cache[file] + + return template if template + + if page then + template = assemble_template file + erbout = 'io' + else + template = file.read + template = template.encode @options.encoding if + Object.const_defined? :Encoding + + file_var = File.basename(file).sub(/\..*/, '') + + erbout = "_erbout_#{file_var}" + end + + template = klass.new template, nil, '<>', erbout + @template_cache[file] = template + template + end + +end + diff --git a/jni/ruby/lib/rdoc/generator/json_index.rb b/jni/ruby/lib/rdoc/generator/json_index.rb new file mode 100644 index 0000000..9d6f0d4 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/json_index.rb @@ -0,0 +1,292 @@ +require 'json' +require 'zlib' + +## +# The JsonIndex generator is designed to complement an HTML generator and +# produces a JSON search index. This generator is derived from sdoc by +# Vladimir Kolesnikov and contains verbatim code written by him. +# +# This generator is designed to be used with a regular HTML generator: +# +# class RDoc::Generator::Darkfish +# def initialize options +# # ... +# @base_dir = Pathname.pwd.expand_path +# +# @json_index = RDoc::Generator::JsonIndex.new self, options +# end +# +# def generate +# # ... +# @json_index.generate +# end +# end +# +# == Index Format +# +# The index is output as a JSON file assigned to the global variable +# +search_data+. The structure is: +# +# var search_data = { +# "index": { +# "searchIndex": +# ["a", "b", ...], +# "longSearchIndex": +# ["a", "a::b", ...], +# "info": [ +# ["A", "A", "A.html", "", ""], +# ["B", "A::B", "A::B.html", "", ""], +# ... +# ] +# } +# } +# +# The same item is described across the +searchIndex+, +longSearchIndex+ and +# +info+ fields. The +searchIndex+ field contains the item's short name, the +# +longSearchIndex+ field contains the full_name (when appropriate) and the +# +info+ field contains the item's name, full_name, path, parameters and a +# snippet of the item's comment. +# +# == LICENSE +# +# Copyright (c) 2009 Vladimir Kolesnikov +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +class RDoc::Generator::JsonIndex + + include RDoc::Text + + ## + # Where the search index lives in the generated output + + SEARCH_INDEX_FILE = File.join 'js', 'search_index.js' + + attr_reader :index # :nodoc: + + ## + # Creates a new generator. +parent_generator+ is used to determine the + # class_dir and file_dir of links in the output index. + # + # +options+ are the same options passed to the parent generator. + + def initialize parent_generator, options + @parent_generator = parent_generator + @store = parent_generator.store + @options = options + + @template_dir = File.expand_path '../template/json_index', __FILE__ + @base_dir = @parent_generator.base_dir + + @classes = nil + @files = nil + @index = nil + end + + ## + # Builds the JSON index as a Hash. + + def build_index + reset @store.all_files.sort, @store.all_classes_and_modules.sort + + index_classes + index_methods + index_pages + + { :index => @index } + end + + ## + # Output progress information if debugging is enabled + + def debug_msg *msg + return unless $DEBUG_RDOC + $stderr.puts(*msg) + end + + ## + # Writes the JSON index to disk + + def generate + debug_msg "Generating JSON index" + + debug_msg " writing search index to %s" % SEARCH_INDEX_FILE + data = build_index + + return if @options.dry_run + + out_dir = @base_dir + @options.op_dir + index_file = out_dir + SEARCH_INDEX_FILE + + FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC + + index_file.open 'w', 0644 do |io| + io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding + io.write 'var search_data = ' + + JSON.dump data, io, 0 + end + + Dir.chdir @template_dir do + Dir['**/*.js'].each do |source| + dest = File.join out_dir, source + + FileUtils.install source, dest, :mode => 0644, :verbose => $DEBUG_RDOC + end + end + 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 + debug_msg " generating class search index" + + documented = @classes.uniq.select do |klass| + klass.document_self_or_methods + end + + documented.each do |klass| + debug_msg " #{klass.full_name}" + record = klass.search_record + @index[:searchIndex] << search_string(record.shift) + @index[:longSearchIndex] << search_string(record.shift) + @index[:info] << record + end + end + + ## + # Adds methods to the index + + def index_methods + debug_msg " generating method search index" + + list = @classes.uniq.map do |klass| + klass.method_list + end.flatten.sort_by do |method| + [method.name, method.parent.full_name] + end + + list.each do |method| + debug_msg " #{method.full_name}" + record = method.search_record + @index[:searchIndex] << "#{search_string record.shift}()" + @index[:longSearchIndex] << "#{search_string record.shift}()" + @index[:info] << record + end + end + + ## + # Adds pages to the index + + def index_pages + debug_msg " generating pages search index" + + pages = @files.select do |file| + file.text? + end + + pages.each do |page| + debug_msg " #{page.page_name}" + record = page.search_record + @index[:searchIndex] << search_string(record.shift) + @index[:longSearchIndex] << '' + record.shift + @index[:info] << record + end + end + + ## + # The directory classes are written to + + def class_dir + @parent_generator.class_dir + end + + ## + # The directory files are written to + + def file_dir + @parent_generator.file_dir + end + + def reset files, classes # :nodoc: + @files = files + @classes = classes + + @index = { + :searchIndex => [], + :longSearchIndex => [], + :info => [] + } + end + + ## + # Removes whitespace and downcases +string+ + + def search_string string + string.downcase.gsub(/\s/, '') + end + +end + diff --git a/jni/ruby/lib/rdoc/generator/markup.rb b/jni/ruby/lib/rdoc/generator/markup.rb new file mode 100644 index 0000000..788e5a4 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/markup.rb @@ -0,0 +1,169 @@ +## +# Handle common RDoc::Markup tasks for various CodeObjects +# +# This module is loaded by generators. It allows RDoc's CodeObject tree to +# avoid loading generator code to improve startup time for +ri+. + +module RDoc::Generator::Markup + + ## + # Generates a relative URL from this object's path to +target_path+ + + def aref_to(target_path) + RDoc::Markup::ToHtml.gen_relative_url path, target_path + end + + ## + # Generates a relative URL from +from_path+ to this object's path + + def as_href(from_path) + RDoc::Markup::ToHtml.gen_relative_url from_path, path + end + + ## + # Handy wrapper for marking up this object's comment + + def description + markup @comment + end + + ## + # Creates an RDoc::Markup::ToHtmlCrossref formatter + + def formatter + return @formatter if defined? @formatter + + options = @store.rdoc.options + this = RDoc::Context === self ? self : @parent + + @formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this + @formatter.code_object = self + @formatter + end + + ## + # Build a webcvs URL starting for the given +url+ with +full_path+ appended + # as the destination path. If +url+ contains '%s' +full_path+ will be + # will replace the %s using sprintf on the +url+. + + def cvs_url(url, full_path) + if /%s/ =~ url then + sprintf url, full_path + else + url + full_path + end + end + +end + +class RDoc::CodeObject + + include RDoc::Generator::Markup + +end + +class RDoc::MethodAttr + + @add_line_numbers = false + + class << self + ## + # Allows controlling whether #markup_code adds line numbers to + # the source code. + + attr_accessor :add_line_numbers + end + + ## + # Prepend +src+ with line numbers. Relies on the first line of a source + # code listing having: + # + # # File xxxxx, line dddd + # + # If it has this comment then line numbers are added to +src+ and the , + # line dddd portion of the comment is removed. + + def add_line_numbers(src) + return unless src.sub!(/\A(.*)(, line (\d+))/, '\1') + first = $3.to_i - 1 + last = first + src.count("\n") + size = last.to_s.length + + line = first + src.gsub!(/^/) do + res = if line == first then + " " * (size + 1) + else + "%2$*1$d " % [size, line] + end + + line += 1 + res + end + end + + ## + # Turns the method's token stream into HTML. + # + # Prepends line numbers if +add_line_numbers+ is true. + + def markup_code + return '' unless @token_stream + + src = RDoc::TokenStream.to_html @token_stream + + # dedent the source + indent = src.length + lines = src.lines.to_a + lines.shift if src =~ /\A.*#\ *File/i # remove '# File' comment + lines.each do |line| + if line =~ /^ *(?=\S)/ + n = $&.length + indent = n if n < indent + break if n == 0 + end + end + src.gsub!(/^#{' ' * indent}/, '') if indent > 0 + + add_line_numbers(src) if RDoc::MethodAttr.add_line_numbers + + src + end + +end + +class RDoc::ClassModule + + ## + # Handy wrapper for marking up this class or module's comment + + def description + markup @comment_location + end + +end + +class RDoc::Context::Section + + include RDoc::Generator::Markup + +end + +class RDoc::TopLevel + + ## + # Returns a URL for this source file on some web repository. Use the -W + # command line option to set. + + def cvs_url + url = @store.rdoc.options.webcvs + + if /%s/ =~ url then + url % @relative_name + else + url + @relative_name + end + end + +end + diff --git a/jni/ruby/lib/rdoc/generator/pot.rb b/jni/ruby/lib/rdoc/generator/pot.rb new file mode 100644 index 0000000..db6f3a0 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/pot.rb @@ -0,0 +1,97 @@ +## +# Generates a POT file. +# +# Here is a translator work flow with the generator. +# +# == Create .pot +# +# You create .pot file by pot formatter: +# +# % rdoc --format pot +# +# It generates doc/rdoc.pot. +# +# == Create .po +# +# You create .po file from doc/rdoc.pot. This operation is needed only +# the first time. This work flow assumes that you are a translator +# for Japanese. +# +# You create locale/ja/rdoc.po from doc/rdoc.pot. You can use msginit +# provided by GNU gettext or rmsginit provided by gettext gem. This +# work flow uses gettext gem because it is more portable than GNU +# gettext for Rubyists. Gettext gem is implemented by pure Ruby. +# +# % gem install gettext +# % mkdir -p locale/ja +# % rmsginit --input doc/rdoc.pot --output locale/ja/rdoc.po --locale ja +# +# Translate messages in .po +# +# You translate messages in .po by a PO file editor. po-mode.el exists +# for Emacs users. There are some GUI tools such as GTranslator. +# There are some Web services such as POEditor and Tansifex. You can +# edit by your favorite text editor because .po is a text file. +# Generate localized documentation +# +# You can generate localized documentation with locale/ja/rdoc.po: +# +# % rdoc --locale ja +# +# You can find documentation in Japanese in doc/. Yay! +# +# == Update translation +# +# You need to update translation when your application is added or +# modified messages. +# +# You can update .po by the following command lines: +# +# % rdoc --format pot +# % rmsgmerge --update locale/ja/rdoc.po doc/rdoc.pot +# +# You edit locale/ja/rdoc.po to translate new messages. + +class RDoc::Generator::POT + + RDoc::RDoc.add_generator self + + ## + # Description of this generator + + DESCRIPTION = 'creates .pot file' + + ## + # Set up a new .pot generator + + def initialize store, options #:not-new: + @options = options + @store = store + end + + ## + # Writes .pot to disk. + + def generate + po = extract_messages + pot_path = 'rdoc.pot' + File.open(pot_path, "w") do |pot| + pot.print(po.to_s) + end + end + + def class_dir + nil + end + + private + def extract_messages + extractor = MessageExtractor.new(@store) + extractor.extract + end + + autoload :MessageExtractor, 'rdoc/generator/pot/message_extractor' + autoload :PO, 'rdoc/generator/pot/po' + autoload :POEntry, 'rdoc/generator/pot/po_entry' + +end diff --git a/jni/ruby/lib/rdoc/generator/pot/message_extractor.rb b/jni/ruby/lib/rdoc/generator/pot/message_extractor.rb new file mode 100644 index 0000000..ceabc52 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/pot/message_extractor.rb @@ -0,0 +1,67 @@ +## +# Extracts message from RDoc::Store + +class RDoc::Generator::POT::MessageExtractor + + ## + # Creates a message extractor for +store+. + + def initialize store + @store = store + @po = RDoc::Generator::POT::PO.new + end + + ## + # Extracts messages from +store+, stores them into + # RDoc::Generator::POT::PO and returns it. + + def extract + @store.all_classes_and_modules.each do |klass| + extract_from_klass(klass) + end + @po + end + + private + + def extract_from_klass klass + extract_text(klass.comment_location, klass.full_name) + + klass.each_section do |section, constants, attributes| + extract_text(section.title ,"#{klass.full_name}: section title") + section.comments.each do |comment| + extract_text(comment, "#{klass.full_name}: #{section.title}") + end + end + + klass.each_constant do |constant| + extract_text(constant.comment, constant.full_name) + end + + klass.each_attribute do |attribute| + extract_text(attribute.comment, attribute.full_name) + end + + klass.each_method do |method| + extract_text(method.comment, method.full_name) + end + end + + def extract_text text, comment, location = nil + return if text.nil? + + options = { + :extracted_comment => comment, + :references => [location].compact, + } + i18n_text = RDoc::I18n::Text.new(text) + i18n_text.extract_messages do |part| + @po.add(entry(part[:paragraph], options)) + end + end + + def entry msgid, options + RDoc::Generator::POT::POEntry.new(msgid, options) + end + +end diff --git a/jni/ruby/lib/rdoc/generator/pot/po.rb b/jni/ruby/lib/rdoc/generator/pot/po.rb new file mode 100644 index 0000000..6a6b582 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/pot/po.rb @@ -0,0 +1,83 @@ +## +# Generates a PO format text + +class RDoc::Generator::POT::PO + + ## + # Creates an object that represents PO format. + + def initialize + @entries = {} + add_header + end + + ## + # Adds a PO entry to the PO. + + def add entry + existing_entry = @entries[entry.msgid] + if existing_entry + entry = existing_entry.merge(entry) + end + @entries[entry.msgid] = entry + end + + ## + # Returns PO format text for the PO. + + def to_s + po = '' + sort_entries.each do |entry| + po << "\n" unless po.empty? + po << entry.to_s + end + po + end + + private + + def add_header + add(header_entry) + end + + def header_entry + comment = <<-COMMENT +SOME DESCRIPTIVE TITLE. +Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +This file is distributed under the same license as the PACKAGE package. +FIRST AUTHOR , YEAR. + COMMENT + + content = <<-CONTENT +Project-Id-Version: PACKAGE VERSEION +Report-Msgid-Bugs-To: +PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE +Last-Translator: FULL NAME +Language-Team: LANGUAGE +Language: +MIME-Version: 1.0 +Content-Type: text/plain; charset=CHARSET +Content-Transfer-Encoding: 8bit +Plural-Forms: nplurals=INTEGER; plural=EXPRESSION; + CONTENT + + options = { + :msgstr => content, + :translator_comment => comment, + :flags => ['fuzzy'], + } + RDoc::Generator::POT::POEntry.new('', options) + end + + def sort_entries + headers, messages = @entries.values.partition do |entry| + entry.msgid.empty? + end + # TODO: sort by location + sorted_messages = messages.sort_by do |entry| + entry.msgid + end + headers + sorted_messages + end + +end diff --git a/jni/ruby/lib/rdoc/generator/pot/po_entry.rb b/jni/ruby/lib/rdoc/generator/pot/po_entry.rb new file mode 100644 index 0000000..d4cef59 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/pot/po_entry.rb @@ -0,0 +1,140 @@ +## +# A PO entry in PO + +class RDoc::Generator::POT::POEntry + + # The msgid content + attr_reader :msgid + + # The msgstr content + attr_reader :msgstr + + # The comment content created by translator (PO editor) + attr_reader :translator_comment + + # The comment content extracted from source file + attr_reader :extracted_comment + + # The locations where the PO entry is extracted + attr_reader :references + + # The flags of the PO entry + attr_reader :flags + + ## + # Creates a PO entry for +msgid+. Other valus can be specified by + # +options+. + + def initialize msgid, options = {} + @msgid = msgid + @msgstr = options[:msgstr] || "" + @translator_comment = options[:translator_comment] + @extracted_comment = options[:extracted_comment] + @references = options[:references] || [] + @flags = options[:flags] || [] + end + + ## + # Returns the PO entry in PO format. + + def to_s + entry = '' + entry << format_translator_comment + entry << format_extracted_comment + entry << format_references + entry << format_flags + entry << <<-ENTRY +msgid #{format_message(@msgid)} +msgstr #{format_message(@msgstr)} + ENTRY + end + + ## + # Merges the PO entry with +other_entry+. + + def merge other_entry + options = { + :extracted_comment => merge_string(@extracted_comment, + other_entry.extracted_comment), + :translator_comment => merge_string(@translator_comment, + other_entry.translator_comment), + :references => merge_array(@references, + other_entry.references), + :flags => merge_array(@flags, + other_entry.flags), + } + self.class.new(@msgid, options) + end + + private + + def format_comment mark, comment + return '' unless comment + return '' if comment.empty? + + formatted_comment = '' + comment.each_line do |line| + formatted_comment << "#{mark} #{line}" + end + formatted_comment << "\n" unless formatted_comment.end_with?("\n") + formatted_comment + end + + def format_translator_comment + format_comment('#', @translator_comment) + end + + def format_extracted_comment + format_comment('#.', @extracted_comment) + end + + def format_references + return '' if @references.empty? + + formatted_references = '' + @references.sort.each do |file, line| + formatted_references << "\#: #{file}:#{line}\n" + end + formatted_references + end + + def format_flags + return '' if @flags.empty? + + formatted_flags = flags.join(",") + "\#, #{formatted_flags}\n" + end + + def format_message message + return "\"#{escape(message)}\"" unless message.include?("\n") + + formatted_message = '""' + message.each_line do |line| + formatted_message << "\n" + formatted_message << "\"#{escape(line)}\"" + end + formatted_message + end + + def escape string + string.gsub(/["\\\t\n]/) do |special_character| + case special_character + when "\t" + "\\t" + when "\n" + "\\n" + else + "\\#{special_character}" + end + end + end + + def merge_string string1, string2 + [string1, string2].compact.join("\n") + end + + def merge_array array1, array2 + (array1 + array2).uniq + end + +end diff --git a/jni/ruby/lib/rdoc/generator/ri.rb b/jni/ruby/lib/rdoc/generator/ri.rb new file mode 100644 index 0000000..b9c4141 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/ri.rb @@ -0,0 +1,30 @@ +## +# Generates ri data files + +class RDoc::Generator::RI + + RDoc::RDoc.add_generator self + + ## + # Description of this generator + + DESCRIPTION = 'creates ri data files' + + ## + # Set up a new ri generator + + def initialize store, options #:not-new: + @options = options + @store = store + @store.path = '.' + end + + ## + # Writes the parsed data store to disk for use by ri. + + def generate + @store.save + end + +end + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/.document b/jni/ruby/lib/rdoc/generator/template/darkfish/.document new file mode 100644 index 0000000..e69de29 diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_footer.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_footer.rhtml new file mode 100644 index 0000000..fe5822c --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_footer.rhtml @@ -0,0 +1,5 @@ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_head.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_head.rhtml new file mode 100644 index 0000000..70f1c18 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_head.rhtml @@ -0,0 +1,19 @@ + + +<%= h @title %> + + + + + + + + +<% if @options.template_stylesheets.flatten.any? then %> +<% @options.template_stylesheets.flatten.each do |stylesheet| %> + +<% end %> +<% end %> + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml new file mode 100644 index 0000000..e889f80 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml @@ -0,0 +1,19 @@ +<% if !svninfo.empty? then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml new file mode 100644 index 0000000..fe54d83 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml @@ -0,0 +1,9 @@ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml new file mode 100644 index 0000000..2bd8efe --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml @@ -0,0 +1,15 @@ +<% unless klass.extends.empty? then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml new file mode 100644 index 0000000..0ba1d2b --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml @@ -0,0 +1,9 @@ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml new file mode 100644 index 0000000..d141098 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml @@ -0,0 +1,15 @@ +<% unless klass.includes.empty? then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml new file mode 100644 index 0000000..1285bfd --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml @@ -0,0 +1,15 @@ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml new file mode 100644 index 0000000..45df08d --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml @@ -0,0 +1,12 @@ +<% unless klass.method_list.empty? then %> + + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml new file mode 100644 index 0000000..d7f3308 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml @@ -0,0 +1,11 @@ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml new file mode 100644 index 0000000..5f39825 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml @@ -0,0 +1,12 @@ +<% simple_files = @files.select { |f| f.text? } %> +<% unless simple_files.empty? then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml new file mode 100644 index 0000000..cc04852 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml @@ -0,0 +1,11 @@ +<% if klass.type == 'class' then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml new file mode 100644 index 0000000..9c49b31 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml @@ -0,0 +1,14 @@ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml new file mode 100644 index 0000000..15ff78b --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml @@ -0,0 +1,11 @@ +<% unless klass.sections.length == 1 then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml new file mode 100644 index 0000000..b58e6b3 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml @@ -0,0 +1,18 @@ +<% comment = if current.respond_to? :comment_location then + current.comment_location + else + current.comment + end + table = current.parse(comment).table_of_contents + + if table.length > 1 then %> + +<% end %> diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/class.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/class.rhtml new file mode 100644 index 0000000..b497000 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/class.rhtml @@ -0,0 +1,174 @@ + + + +
+

+ <%= klass.type %> <%= klass.full_name %> +

+ +
+ <%= klass.description %> +
+ + <% klass.each_section do |section, constants, attributes| %> + <% constants = constants.select { |const| const.display? } %> + <% attributes = attributes.select { |attr| attr.display? } %> +
+ <% if section.title then %> +
+

+ <%= section.title %> +

+ + ↑ top + +
+ <% end %> + + <% if section.comment then %> +
+ <%= section.description %> +
+ <% end %> + + <% unless constants.empty? then %> +
+
+

Constants

+
+
+ <% constants.each do |const| %> +
<%= const.name %> + <% if const.comment then %> +
<%= const.description.strip %> + <% else %> +
(Not documented) + <% end %> + <% end %> +
+
+ <% end %> + + <% unless attributes.empty? then %> +
+
+

Attributes

+
+ + <% attributes.each do |attrib| %> +
+
+ <%= h attrib.name %>[<%= attrib.rw %>] +
+ +
+ <% if attrib.comment then %> + <%= attrib.description.strip %> + <% else %> +

(Not documented) + <% end %> +

+
+ <% end %> +
+ <% end %> + + <% klass.methods_by_type(section).each do |type, visibilities| + next if visibilities.empty? + visibilities.each do |visibility, methods| + next if methods.empty? %> +
+
+

<%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods

+
+ + <% methods.each do |method| %> +
"> + <% if method.call_seq then %> + <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %> +
+ + <%= h(call_seq.strip. + gsub( /^\w+\./m, '')). + gsub(/(.*)[-=]>/, '\1→') %> + + <% if i == 0 and method.token_stream then %> + click to toggle source + <% end %> +
+ <% end %> + <% else %> +
+ <%= h method.name %><%= method.param_seq %> + <% if method.token_stream then %> + click to toggle source + <% end %> +
+ <% end %> + +
+ <% if method.comment then %> + <%= method.description.strip %> + <% else %> +

(Not documented) + <% end %> + <% if method.calls_super then %> +

+ Calls superclass method + <%= + method.superclass_method ? + method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil + %> +
+ <% end %> + + <% if method.token_stream then %> +
+
<%= method.markup_code %>
+
+ <% end %> +
+ + <% unless method.aliases.empty? then %> +
+ Also aliased as: <%= method.aliases.map do |aka| + if aka.parent then # HACK lib/rexml/encodings + %{#{h aka.name}} + else + h aka.name + end + end.join ", " %> +
+ <% end %> + + <% if method.is_alias_for then %> + + <% end %> +
+ + <% end %> +
+ <% end + end %> +
+<% end %> +
diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/css/fonts.css b/jni/ruby/lib/rdoc/generator/template/darkfish/css/fonts.css new file mode 100644 index 0000000..e9e7211 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/css/fonts.css @@ -0,0 +1,167 @@ +/* + * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + * with Reserved Font Name "Source". All Rights Reserved. Source is a + * trademark of Adobe Systems Incorporated in the United States and/or other + * countries. + * + * This Font Software is licensed under the SIL Open Font License, Version + * 1.1. + * + * This license is copied below, and is also available with a FAQ at: + * http://scripts.sil.org/OFL + */ + +@font-face { + font-family: "Source Code Pro"; + font-style: normal; + font-weight: 400; + src: local("Source Code Pro"), + local("SourceCodePro-Regular"), + url("fonts/SourceCodePro-Regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Source Code Pro"; + font-style: normal; + font-weight: 700; + src: local("Source Code Pro Bold"), + local("SourceCodePro-Bold"), + url("fonts/SourceCodePro-Bold.ttf") format("truetype"); +} + +/* + * Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com), + * with Reserved Font Name Lato. + * + * This Font Software is licensed under the SIL Open Font License, Version + * 1.1. + * + * This license is copied below, and is also available with a FAQ at: + * http://scripts.sil.org/OFL + */ + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 300; + src: local("Lato Light"), + local("Lato-Light"), + url("fonts/Lato-Light.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 300; + src: local("Lato Light Italic"), + local("Lato-LightItalic"), + url("fonts/Lato-LightItalic.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 700; + src: local("Lato Regular"), + local("Lato-Regular"), + url("fonts/Lato-Regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 700; + src: local("Lato Italic"), + local("Lato-Italic"), + url("fonts/Lato-RegularItalic.ttf") format("truetype"); +} + +/* + * ----------------------------------------------------------- + * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + * ----------------------------------------------------------- + * + * PREAMBLE + * The goals of the Open Font License (OFL) are to stimulate worldwide + * development of collaborative font projects, to support the font creation + * efforts of academic and linguistic communities, and to provide a free and + * open framework in which fonts may be shared and improved in partnership + * with others. + * + * The OFL allows the licensed fonts to be used, studied, modified and + * redistributed freely as long as they are not sold by themselves. The + * fonts, including any derivative works, can be bundled, embedded, + * redistributed and/or sold with any software provided that any reserved + * names are not used by derivative works. The fonts and derivatives, + * however, cannot be released under any other type of license. The + * requirement for fonts to remain under this license does not apply + * to any document created using the fonts or their derivatives. + * + * DEFINITIONS + * "Font Software" refers to the set of files released by the Copyright + * Holder(s) under this license and clearly marked as such. This may + * include source files, build scripts and documentation. + * + * "Reserved Font Name" refers to any names specified as such after the + * copyright statement(s). + * + * "Original Version" refers to the collection of Font Software components as + * distributed by the Copyright Holder(s). + * + * "Modified Version" refers to any derivative made by adding to, deleting, + * or substituting -- in part or in whole -- any of the components of the + * Original Version, by changing formats or by porting the Font Software to a + * new environment. + * + * "Author" refers to any designer, engineer, programmer, technical + * writer or other person who contributed to the Font Software. + * + * PERMISSION & CONDITIONS + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of the Font Software, to use, study, copy, merge, embed, modify, + * redistribute, and sell modified and unmodified copies of the Font + * Software, subject to the following conditions: + * + * 1) Neither the Font Software nor any of its individual components, + * in Original or Modified Versions, may be sold by itself. + * + * 2) Original or Modified Versions of the Font Software may be bundled, + * redistributed and/or sold with any software, provided that each copy + * contains the above copyright notice and this license. These can be + * included either as stand-alone text files, human-readable headers or + * in the appropriate machine-readable metadata fields within text or + * binary files as long as those fields can be easily viewed by the user. + * + * 3) No Modified Version of the Font Software may use the Reserved Font + * Name(s) unless explicit written permission is granted by the corresponding + * Copyright Holder. This restriction only applies to the primary font name as + * presented to the users. + * + * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + * Software shall not be used to promote, endorse or advertise any + * Modified Version, except to acknowledge the contribution(s) of the + * Copyright Holder(s) and the Author(s) or with their explicit written + * permission. + * + * 5) The Font Software, modified or unmodified, in part or in whole, + * must be distributed entirely under this license, and must not be + * distributed under any other license. The requirement for fonts to + * remain under this license does not apply to any document created + * using the Font Software. + * + * TERMINATION + * This license becomes null and void if any of the above conditions are + * not met. + * + * DISCLAIMER + * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM + * OTHER DEALINGS IN THE FONT SOFTWARE. + */ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/css/rdoc.css b/jni/ruby/lib/rdoc/generator/template/darkfish/css/rdoc.css new file mode 100644 index 0000000..2f4dca7 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/css/rdoc.css @@ -0,0 +1,590 @@ +/* + * "Darkfish" Rdoc CSS + * $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* vim: ft=css et sw=2 ts=2 sts=2 */ +/* Base Green is: #6C8C22 */ + +* { padding: 0; margin: 0; } + +body { + background: #fafafa; + font-family: Lato, sans-serif; + font-weight: 300; +} + +h1 span, +h2 span, +h3 span, +h4 span, +h5 span, +h6 span { + position: relative; + + display: none; + padding-left: 1em; + line-height: 0; + vertical-align: baseline; + font-size: 10px; +} + +h1 span { top: -1.3em; } +h2 span { top: -1.2em; } +h3 span { top: -1.0em; } +h4 span { top: -0.8em; } +h5 span { top: -0.5em; } +h6 span { top: -0.5em; } + +h1:hover span, +h2:hover span, +h3:hover span, +h4:hover span, +h5:hover span, +h6:hover span { + display: inline; +} + +:link, +:visited { + color: #6C8C22; + text-decoration: none; +} + +:link:hover, +:visited:hover { + border-bottom: 1px dotted #6C8C22; +} + +code, +pre { + font-family: "Source Code Pro", Monaco, monospace; +} + +/* @group Generic Classes */ + +.initially-hidden { + display: none; +} + +#search-field { + width: 98%; + background: white; + border: none; + height: 1.5em; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + text-align: left; +} +#search-field:focus { + background: #f1edba; +} +#search-field:-moz-placeholder, +#search-field::-webkit-input-placeholder { + font-weight: bold; + color: #666; +} + +.missing-docs { + font-size: 120%; + background: white url(images/wrench_orange.png) no-repeat 4px center; + color: #ccc; + line-height: 2em; + border: 1px solid #d00; + opacity: 1; + padding-left: 20px; + text-indent: 24px; + letter-spacing: 3px; + font-weight: bold; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} + +.target-section { + border: 2px solid #dcce90; + border-left-width: 8px; + padding: 0 1em; + background: #fff3c2; +} + +/* @end */ + +/* @group Index Page, Standalone file pages */ +.table-of-contents ul { + margin: 1em; + list-style: none; +} + +.table-of-contents ul ul { + margin-top: 0.25em; +} + +.table-of-contents ul :link, +.table-of-contents ul :visited { + font-size: 16px; +} + +.table-of-contents li { + margin-bottom: 0.25em; +} + +.table-of-contents li .toc-toggle { + width: 16px; + height: 16px; + background: url(images/add.png) no-repeat; +} + +.table-of-contents li .toc-toggle.open { + background: url(images/delete.png) no-repeat; +} + +/* @end */ + +/* @group Top-Level Structure */ + +nav { + float: left; + width: 260px; + font-family: Helvetica, sans-serif; + font-size: 14px; +} + +main { + display: block; + margin: 0 2em 5em 260px; + padding-left: 20px; + min-width: 340px; + font-size: 16px; +} + +main h1, +main h2, +main h3, +main h4, +main h5, +main h6 { + font-family: Helvetica, sans-serif; +} + +.table-of-contents main { + margin-left: 2em; +} + +#validator-badges { + clear: both; + margin: 1em 1em 2em; + font-size: smaller; +} + +/* @end */ + +/* @group navigation */ +nav { + margin-bottom: 1em; +} + +nav .nav-section { + margin-top: 2em; + border-top: 2px solid #aaa; + font-size: 90%; + overflow: hidden; +} + +nav h2 { + margin: 0; + padding: 2px 8px 2px 8px; + background-color: #e8e8e8; + color: #555; + font-size: 125%; + text-align: center; +} + +nav h3, +#table-of-contents-navigation { + margin: 0; + padding: 2px 8px 2px 8px; + text-align: right; + background-color: #e8e8e8; + color: #555; +} + +nav ul, +nav dl, +nav p { + padding: 4px 8px 0; + list-style: none; +} + +#project-navigation .nav-section { + margin: 0; + border-top: 0; +} + +#home-section h2 { + text-align: center; +} + +#table-of-contents-navigation { + font-size: 1.2em; + font-weight: bold; + text-align: center; +} + +#search-section { + margin-top: 0; + border-top: 0; +} + +#search-field-wrapper { + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + padding: 3px 8px; + background-color: #e8e8e8; + color: #555; +} + +ul.link-list li { + white-space: nowrap; + line-height: 1.4em; +} + +ul.link-list .type { + font-size: 8px; + text-transform: uppercase; + color: white; + background: #969696; + padding: 2px 4px; + -webkit-border-radius: 5px; +} + +.calls-super { + background: url(images/arrow_up.png) no-repeat right center; +} + +/* @end */ + +/* @group Documentation Section */ +main { + color: #333; +} + +main > h1:first-child, +main > h2:first-child, +main > h3:first-child, +main > h4:first-child, +main > h5:first-child, +main > h6:first-child { + margin-top: 0px; +} + +main sup { + vertical-align: super; + font-size: 0.8em; +} + +/* The heading with the class name */ +main h1[class] { + margin-top: 0; + margin-bottom: 1em; + font-size: 2em; + color: #6C8C22; +} + +main h1 { + margin: 2em 0 0.5em; + font-size: 1.7em; +} + +main h2 { + margin: 2em 0 0.5em; + font-size: 1.5em; +} + +main h3 { + margin: 2em 0 0.5em; + font-size: 1.2em; +} + +main h4 { + margin: 2em 0 0.5em; + font-size: 1.1em; +} + +main h5 { + margin: 2em 0 0.5em; + font-size: 1em; +} + +main h6 { + margin: 2em 0 0.5em; + font-size: 1em; +} + +main p { + margin: 0 0 0.5em; + line-height: 1.4em; +} + +main pre { + margin: 1.2em 0.5em; + padding: 1em; + font-size: 0.8em; +} + +main hr { + margin: 1.5em 1em; + border: 2px solid #ddd; +} + +main blockquote { + margin: 0 2em 1.2em 1.2em; + padding-left: 0.5em; + border-left: 2px solid #ddd; +} + +main ol, +main ul { + margin: 1em 2em; +} + +main li > p { + margin-bottom: 0.5em; +} + +main dl { + margin: 1em 0.5em; +} + +main dt { + margin-bottom: 0.5em; + font-weight: bold; +} + +main dd { + margin: 0 1em 1em 0.5em; +} + +main header h2 { + margin-top: 2em; + border-width: 0; + border-top: 4px solid #bbb; + font-size: 130%; +} + +main header h3 { + margin: 2em 0 1.5em; + border-width: 0; + border-top: 3px solid #bbb; + font-size: 120%; +} + +.documentation-section-title { + position: relative; +} +.documentation-section-title .section-click-top { + position: absolute; + top: 6px; + left: 12px; + font-size: 10px; + color: #9b9877; + visibility: hidden; + padding-left: 0.5px; +} + +.documentation-section-title:hover .section-click-top { + visibility: visible; +} + +.constants-list > dl { + margin: 1em 0 2em; + border: 0; +} + +.constants-list > dl dt { + margin-bottom: 0.75em; + padding-left: 0; + font-family: "Source Code Pro", Monaco, monospace; + font-size: 110%; +} + +.constants-list > dl dt a { + color: inherit; +} + +.constants-list > dl dd { + margin: 0 0 2em 0; + padding: 0; + color: #666; +} + +.documentation-section h2 { + position: relative; +} + +.documentation-section h2 a { + position: absolute; + top: 8px; + right: 10px; + font-size: 12px; + color: #9b9877; + visibility: hidden; +} + +.documentation-section h2:hover a { + visibility: visible; +} + +/* @group Method Details */ + +main .method-source-code { + display: none; +} + +main .method-description .method-calls-super { + color: #333; + font-weight: bold; +} + +main .method-detail { + margin-bottom: 2.5em; + cursor: pointer; +} + +main .method-detail:target { + margin-left: -10px; + border-left: 10px solid #f1edba; +} + +main .method-heading { + position: relative; + font-family: "Source Code Pro", Monaco, monospace; + font-size: 110%; + font-weight: bold; + color: #333; +} +main .method-heading :link, +main .method-heading :visited { + color: inherit; +} +main .method-click-advice { + position: absolute; + top: 2px; + right: 5px; + font-size: 12px; + color: #9b9877; + visibility: hidden; + padding-right: 20px; + line-height: 20px; + background: url(images/zoom.png) no-repeat right top; +} +main .method-heading:hover .method-click-advice { + visibility: visible; +} + +main .method-alias .method-heading { + color: #666; +} + +main .method-description, +main .aliases { + margin-top: 0.75em; + color: #333; +} + +main .aliases { + padding-top: 4px; + font-style: italic; + cursor: default; +} +main .method-description ul { + margin-left: 1.5em; +} + +main #attribute-method-details .method-detail:hover { + background-color: transparent; + cursor: default; +} +main .attribute-access-type { + text-transform: uppercase; + padding: 0 1em; +} +/* @end */ + +/* @end */ + +/* @group Source Code */ + +pre { + margin: 0.5em 0; + border: 1px dashed #999; + padding: 0.5em; + background: #262626; + color: white; + overflow: auto; +} + +.ruby-constant { color: #7fffd4; background: transparent; } +.ruby-keyword { color: #00ffff; background: transparent; } +.ruby-ivar { color: #eedd82; background: transparent; } +.ruby-operator { color: #00ffee; background: transparent; } +.ruby-identifier { color: #ffdead; background: transparent; } +.ruby-node { color: #ffa07a; background: transparent; } +.ruby-comment { color: #dc0000; background: transparent; } +.ruby-regexp { color: #ffa07a; background: transparent; } +.ruby-value { color: #7fffd4; background: transparent; } + +/* @end */ + + +/* @group search results */ +#search-results { + font-family: Lato, sans-serif; + font-weight: 300; +} + +#search-results .search-match { + font-family: Helvetica, sans-serif; + font-weight: normal; +} + +#search-results .search-selected { + background: #e8e8e8; + border-bottom: 1px solid transparent; +} + +#search-results li { + list-style: none; + border-bottom: 1px solid #aaa; + margin-bottom: 0.5em; +} + +#search-results li:last-child { + border-bottom: none; + margin-bottom: 0; +} + +#search-results li p { + padding: 0; + margin: 0.5em; +} + +#search-results .search-namespace { + font-weight: bold; +} + +#search-results li em { + background: yellow; + font-style: normal; +} + +#search-results pre { + margin: 0.5em; + font-family: "Source Code Pro", Monaco, monospace; +} + +/* @end */ + diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf new file mode 100644 index 0000000..b49dd43 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf new file mode 100644 index 0000000..7959fef Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf new file mode 100644 index 0000000..839cd58 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf new file mode 100644 index 0000000..bababa0 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf new file mode 100644 index 0000000..61e3090 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf new file mode 100644 index 0000000..85686d9 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/add.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/add.png new file mode 100644 index 0000000..6332fef Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/add.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/arrow_up.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/arrow_up.png new file mode 100644 index 0000000..1ebb193 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/arrow_up.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/brick.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/brick.png new file mode 100644 index 0000000..7851cf3 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/brick.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/brick_link.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/brick_link.png new file mode 100644 index 0000000..9ebf013 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/brick_link.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/bug.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bug.png new file mode 100644 index 0000000..2d5fb90 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bug.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_black.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_black.png new file mode 100644 index 0000000..5761970 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_black.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png new file mode 100644 index 0000000..b47ce55 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png new file mode 100644 index 0000000..9ab4a89 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/date.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/date.png new file mode 100644 index 0000000..783c833 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/date.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/delete.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/delete.png new file mode 100644 index 0000000..08f2493 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/delete.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/find.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/find.png new file mode 100644 index 0000000..1547479 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/find.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif b/jni/ruby/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif new file mode 100644 index 0000000..82290f4 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png new file mode 100644 index 0000000..c6473b3 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/package.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/package.png new file mode 100644 index 0000000..da3c2a2 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/package.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_green.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_green.png new file mode 100644 index 0000000..de8e003 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_green.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_text.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_text.png new file mode 100644 index 0000000..813f712 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_text.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_width.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_width.png new file mode 100644 index 0000000..1eb8809 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/page_white_width.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/plugin.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/plugin.png new file mode 100644 index 0000000..6187b15 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/plugin.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/ruby.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/ruby.png new file mode 100644 index 0000000..f763a16 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/ruby.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_blue.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_blue.png new file mode 100644 index 0000000..3f02b5f Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_blue.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_green.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_green.png new file mode 100644 index 0000000..83ec984 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/tag_green.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/transparent.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/transparent.png new file mode 100644 index 0000000..d665e17 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/transparent.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench.png new file mode 100644 index 0000000..5c8213f Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench_orange.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench_orange.png new file mode 100644 index 0000000..565a933 Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/wrench_orange.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/images/zoom.png b/jni/ruby/lib/rdoc/generator/template/darkfish/images/zoom.png new file mode 100644 index 0000000..908612e Binary files /dev/null and b/jni/ruby/lib/rdoc/generator/template/darkfish/images/zoom.png differ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/index.rhtml b/jni/ruby/lib/rdoc/generator/template/darkfish/index.rhtml new file mode 100644 index 0000000..7d1c748 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/index.rhtml @@ -0,0 +1,23 @@ + + + +
+<% if @options.main_page and + main_page = @files.find { |f| f.full_name == @options.main_page } then %> +<%= main_page.description %> +<% else %> +

This is the API documentation for <%= @title %>. +<% end %> +

+ diff --git a/jni/ruby/lib/rdoc/generator/template/darkfish/js/darkfish.js b/jni/ruby/lib/rdoc/generator/template/darkfish/js/darkfish.js new file mode 100644 index 0000000..b789a65 --- /dev/null +++ b/jni/ruby/lib/rdoc/generator/template/darkfish/js/darkfish.js @@ -0,0 +1,161 @@ +/** + * + * Darkfish Page Functions + * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* Provide console simulation for firebug-less environments */ +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +}; + + +/** + * Unwrap the first element that matches the given @expr@ from the targets and return them. + */ +$.fn.unwrap = function( expr ) { + return this.each( function() { + $(this).parents( expr ).eq( 0 ).after( this ).remove(); + }); +}; + + +function showSource( e ) { + var target = e.target; + var codeSections = $(target). + parents('.method-detail'). + find('.method-source-code'); + + $(target). + parents('.method-detail'). + find('.method-source-code'). + slideToggle(); +}; + +function hookSourceViews() { + $('.method-heading').click( showSource ); +}; + +function hookSearch() { + var input = $('#search-field').eq(0); + var result = $('#search-results').eq(0); + $(result).show(); + + var search_section = $('#search-section').get(0); + $(search_section).show(); + + var search = new Search(search_data, input, result); + + search.renderItem = function(result) { + var li = document.createElement('li'); + var html = ''; + + // TODO add relative path to