diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-27 04:28:14 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-27 04:28:14 +0000 |
commit | 1c279a7d2753949c725754e1302f791b76358114 (patch) | |
tree | 36aa3bdde250e564445eba5f2e25fcb96bcb6cef | |
parent | c72f0daa877808e4fa5018b3191ca09d4b97c03d (diff) |
* lib/rdoc*: Updated to RDoc 4.0 (pre-release)
* bin/rdoc: ditto
* test/rdoc: ditto
* NEWS: Updated with RDoc 4.0 information
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
233 files changed, 44982 insertions, 5063 deletions
@@ -1,3 +1,10 @@ +Tue Nov 27 13:27:46 2012 Eric Hodel <drbrain@segment7.net> + + * lib/rdoc*: Updated to RDoc 4.0 (pre-release) + * bin/rdoc: ditto + * test/rdoc*: ditto + * NEWS: Updated with RDoc 4.0 information + Tue Nov 27 12:17:11 2012 Koichi Sasada <ko1@atdot.net> * thread.c (rb_thread_terminate_all): retry broadcast only when @@ -272,6 +272,17 @@ with all sufficient information, see the ChangeLog file. http://rake.rubyforge.org/doc/release_notes/rake-0_9_4_rdoc.html for a list of changes in rake 0.9.3 and 0.9.4. +* rdoc + * rdoc has been updated to version 4.0 + + This version is largely backwards-compatible with previous rdoc versions. + The most notable change is an update to the ri data format (ri data must + be regenerated for gems shared across rdoc versions). Further API changes + are internal and won't affect most users. + + See https://github.com/rdoc/rdoc/blob/master/History.rdoc for a list of + changes in rdoc 4.0. + * resolv * new methods: * Resolv::DNS#timeouts= @@ -5,8 +5,6 @@ # # Copyright (c) 2003 Dave Thomas # Released under the same terms as Ruby -# -# $Revision$ begin gem 'rdoc' @@ -20,6 +18,10 @@ require 'rdoc/rdoc' begin r = RDoc::RDoc.new r.document ARGV +rescue Errno::ENOSPC + $stderr.puts 'Ran out of space creating documentation' + $stderr.puts + $stderr.puts 'Please free up some space and try again' rescue SystemExit raise rescue Exception => e diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c index 7a1cacaf9f..bbf5c5f109 100644 --- a/ext/nkf/nkf-utf8/utf8tbl.c +++ b/ext/nkf/nkf-utf8/utf8tbl.c @@ -1,7 +1,7 @@ /* * utf8tbl.c - Convertion Table for nkf * - * $Id: utf8tbl.c,v 1.23 2008/02/07 19:25:29 naruse Exp $ + * $Id$ */ #include "config.h" diff --git a/lib/rdoc.rb b/lib/rdoc.rb index aaa1aaa092..5c2df18a0d 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -1,86 +1,55 @@ $DEBUG_RDOC = nil -# :main: README.txt +# :main: README.rdoc ## -# RDoc is a Ruby documentation system which contains RDoc::RDoc for generating -# documentation, RDoc::RI for interactive documentation and RDoc::Markup for -# text markup. +# RDoc produces documentation for Ruby source files by parsing the source and +# extracting the definition for classes, modules, methods, includes and +# requires. It associates these with optional documentation contained in an +# immediately preceding comment block then renders the result using an output +# formatter. # -# RDoc::RDoc produces documentation for Ruby source files. It works similarly -# to JavaDoc, parsing the source and extracting the definition for classes, -# modules, methods, includes and requires. It associates these with optional -# documentation contained in an immediately preceding comment block then -# renders the result using an output formatter. -# -# RDoc::Markup that converts plain text into various output formats. The -# markup library is used to interpret the comment blocks that RDoc uses to -# document methods, classes, and so on. -# -# RDoc::RI implements the +ri+ command-line tool which displays on-line -# documentation for ruby classes, methods, etc. +ri+ features several output -# formats and an interactive mode (<tt>ri -i</tt>). See <tt>ri --help</tt> -# for further details. +# For a simple introduction to writing or generating documentation using RDoc +# see the README. # # == Roadmap # -# * If you want to use RDoc to create documentation for your Ruby source files, -# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line -# usage. -# * If you want to write documentation for Ruby files see RDoc::Parser::Ruby -# * If you want to write documentation for extensions written in C see -# RDoc::Parser::C -# * If you want to generate documentation using <tt>rake</tt> see RDoc::Task. -# * If you want to drive RDoc programmatically, see RDoc::RDoc. -# * If you want to use the library to format text blocks into HTML, look at -# RDoc::Markup. -# * If you want to make an RDoc plugin such as a generator or directive -# handler see RDoc::RDoc. -# * If you want to write your own output generator see RDoc::Generator. -# -# == Summary +# If you think you found a bug in RDoc see DEVELOPERS@Bugs # -# Once installed, you can create documentation using the +rdoc+ command +# If you want to use RDoc to create documentation for your Ruby source files, +# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line usage. # -# % rdoc [options] [names...] +# If you want to set the default markup format see +# RDoc::Markup@Supported+Formats # -# For an up-to-date option summary, type +# If you want to store rdoc configuration in your gem (such as the default +# markup format) see RDoc::Options@Saved+Options # -# % rdoc --help +# If you want to write documentation for Ruby files see RDoc::Parser::Ruby # -# A typical use might be to generate documentation for a package of Ruby -# source (such as RDoc itself). +# If you want to write documentation for extensions written in C see +# RDoc::Parser::C # -# % rdoc +# If you want to generate documentation using <tt>rake</tt> see RDoc::Task. # -# This command generates documentation for all the Ruby and C source -# files in and below the current directory. These will be stored in a -# documentation tree starting in the subdirectory +doc+. +# If you want to drive RDoc programmatically, see RDoc::RDoc. # -# You can make this slightly more useful for your readers by having the -# index page contain the documentation for the primary file. In our -# case, we could type +# If you want to use the library to format text blocks into HTML or other +# formats, look at RDoc::Markup. # -# % rdoc --main README.txt +# If you want to make an RDoc plugin such as a generator or directive handler +# see RDoc::RDoc. # -# You'll find information on the various formatting tricks you can use -# in comment blocks in the documentation this generates. +# If you want to write your own output generator see RDoc::Generator. # -# RDoc uses file extensions to determine how to process each file. File names -# ending +.rb+ and +.rbw+ are assumed to be Ruby source. Files -# ending +.c+ are parsed as C files. All other files are assumed to -# contain just Markup-style markup (with or without leading '#' comment -# markers). If directory names are passed to RDoc, they are scanned -# recursively for C and Ruby source files only. +# If you want an overview of how RDoc works see DEVELOPERS # -# == Other stuff +# == Credits # # RDoc is currently being maintained by Eric Hodel <drbrain@segment7.net>. # # Dave Thomas <dave@pragmaticprogrammer.com> is the original author of RDoc. # -# == Credits -# # * The Ruby parser in rdoc/parse.rb is based heavily on the outstanding # work of Keiju ISHITSUKA of Nippon Rational Inc, who produced the Ruby # parser for irb and the rtags package. @@ -92,19 +61,10 @@ module RDoc class Error < RuntimeError; end - def self.const_missing const_name # :nodoc: - if const_name.to_s == 'RDocError' then - warn "RDoc::RDocError is deprecated" - return Error - end - - super - end - ## # RDoc version you are using - VERSION = '3.9.4' + VERSION = '4.0' ## # Method visibilities @@ -143,5 +103,80 @@ module RDoc METHOD_MODIFIERS = GENERAL_MODIFIERS + %w[arg args yield yields notnew not-new not_new doc] + ## + # Loads the best available YAML library. + + def self.load_yaml + begin + gem 'psych' + rescue Gem::LoadError + end + + begin + require 'psych' + rescue ::LoadError + ensure + require 'yaml' + end + end + + autoload :RDoc, 'rdoc/rdoc' + + autoload :TestCase, 'rdoc/test_case' + + autoload :CrossReference, 'rdoc/cross_reference' + autoload :ERBIO, 'rdoc/erbio' + autoload :ERBPartial, 'rdoc/erb_partial' + autoload :Encoding, 'rdoc/encoding' + autoload :Generator, 'rdoc/generator' + autoload :Options, 'rdoc/options' + autoload :Parser, 'rdoc/parser' + autoload :Servlet, 'rdoc/servlet' + autoload :RI, 'rdoc/ri' + autoload :Stats, 'rdoc/stats' + autoload :Store, 'rdoc/store' + autoload :Task, 'rdoc/task' + autoload :Text, 'rdoc/text' + + autoload :Markdown, 'rdoc/markdown' + autoload :Markup, 'rdoc/markup' + autoload :RD, 'rdoc/rd' + autoload :TomDoc, 'rdoc/tom_doc' + + autoload :KNOWN_CLASSES, 'rdoc/known_classes' + + autoload :RubyLex, 'rdoc/ruby_lex' + autoload :RubyToken, 'rdoc/ruby_token' + autoload :TokenStream, 'rdoc/token_stream' + + autoload :Comment, 'rdoc/comment' + + # code objects + # + # We represent the various high-level code constructs that appear in Ruby + # programs: classes, modules, methods, and so on. + autoload :CodeObject, 'rdoc/code_object' + + autoload :Context, 'rdoc/context' + autoload :TopLevel, 'rdoc/top_level' + + autoload :AnonClass, 'rdoc/anon_class' + autoload :ClassModule, 'rdoc/class_module' + autoload :NormalClass, 'rdoc/normal_class' + autoload :NormalModule, 'rdoc/normal_module' + autoload :SingleClass, 'rdoc/single_class' + + autoload :Alias, 'rdoc/alias' + autoload :AnyMethod, 'rdoc/any_method' + autoload :MethodAttr, 'rdoc/method_attr' + autoload :GhostMethod, 'rdoc/ghost_method' + autoload :MetaMethod, 'rdoc/meta_method' + autoload :Attr, 'rdoc/attr' + + autoload :Constant, 'rdoc/constant' + autoload :Include, 'rdoc/include' + autoload :Extend, 'rdoc/extend' + autoload :Require, 'rdoc/require' + end diff --git a/lib/rdoc/alias.rb b/lib/rdoc/alias.rb index fa433dc0a9..39d2694817 100644 --- a/lib/rdoc/alias.rb +++ b/lib/rdoc/alias.rb @@ -1,5 +1,3 @@ -require 'rdoc/code_object' - ## # Represent an alias, which is an old_name/new_name pair associated with a # particular context diff --git a/lib/rdoc/anon_class.rb b/lib/rdoc/anon_class.rb index 63c09e11f1..c23d8e5d96 100644 --- a/lib/rdoc/anon_class.rb +++ b/lib/rdoc/anon_class.rb @@ -1,5 +1,3 @@ -require 'rdoc/class_module' - ## # An anonymous class like: # diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb index c008edfe95..c3d68e87b4 100644 --- a/lib/rdoc/any_method.rb +++ b/lib/rdoc/any_method.rb @@ -1,12 +1,16 @@ -require 'rdoc/method_attr' -require 'rdoc/token_stream' - ## # AnyMethod is the base class for objects representing methods class RDoc::AnyMethod < RDoc::MethodAttr - MARSHAL_VERSION = 1 # :nodoc: + ## + # 2:: + # RDoc 4 + # Added calls_super + # Added parent name and class + # Added section title + + MARSHAL_VERSION = 2 # :nodoc: ## # Don't rename \#initialize to \::new @@ -28,6 +32,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr attr_accessor :params + ## + # If true this method uses +super+ to call a superclass version + + attr_accessor :calls_super + include RDoc::TokenStream ## @@ -39,6 +48,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr @c_function = nil @dont_rename_initialize = false @token_stream = nil + @calls_super = false + @superclass_method = nil end ## @@ -97,6 +108,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr aliases, @params, @file.absolute_name, + @calls_super, + @parent.name, + @parent.class, + @section.title, ] end @@ -107,34 +122,44 @@ class RDoc::AnyMethod < RDoc::MethodAttr # * #full_name # * #parent_name - def marshal_load(array) + def marshal_load array @dont_rename_initialize = nil @is_alias_for = nil @token_stream = nil @aliases = [] - - version = array[0] - @name = array[1] - @full_name = array[2] - @singleton = array[3] - @visibility = array[4] - @comment = array[5] - @call_seq = array[6] - @block_params = array[7] + @parent = nil + @parent_name = nil + @parent_class = nil + @section = nil + @file = nil + + version = array[0] + @name = array[1] + @full_name = array[2] + @singleton = array[3] + @visibility = array[4] + @comment = array[5] + @call_seq = array[6] + @block_params = array[7] + # 8 handled below + @params = array[9] + # 10 handled below + @calls_super = array[11] + @parent_name = array[12] + @parent_title = array[13] + @section_title = array[14] array[8].each do |new_name, comment| add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton) end - @params = array[9] - - @parent_name = if @full_name =~ /#/ then - $` - else - name = @full_name.split('::') - name.pop - name.join '::' - end + @parent_name ||= if @full_name =~ /#/ then + $` + else + name = @full_name.split('::') + name.pop + name.join '::' + end @file = RDoc::TopLevel.new array[10] if version > 0 end @@ -169,7 +194,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr return [] end - params.gsub(/\s+/, '').split ',' + params = params.gsub(/\s+/, '').split ',' + + params.map { |param| param.sub(/=.*/, '') } end ## @@ -181,10 +208,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr params = @call_seq.split("\n").last params = params.sub(/[^( ]+/, '') params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2') - else + elsif @params then params = @params.gsub(/\s*\#.*/, '') params = params.tr("\n", " ").squeeze(" ") params = "(#{params})" unless params[0] == ?( + else + params = '' end if @block_params then @@ -203,5 +232,31 @@ class RDoc::AnyMethod < RDoc::MethodAttr params end + ## + # Sets the store for this method and its referenced code objects. + + def store= store + super + + @file = @store.add_file @file.full_name if @file + end + + ## + # For methods that +super+, find the superclass method that would be called. + + def superclass_method + return unless @calls_super + return @superclass_method if @superclass_method + + parent.each_ancestor do |ancestor| + if method = ancestor.method_list.find { |m| m.name == @name } then + @superclass_method = method + break + end + end + + @superclass_method + end + end diff --git a/lib/rdoc/attr.rb b/lib/rdoc/attr.rb index 5d9bc17831..0eb1c0d79b 100644 --- a/lib/rdoc/attr.rb +++ b/lib/rdoc/attr.rb @@ -1,12 +1,16 @@ -require 'rdoc/method_attr' - ## # An attribute created by \#attr, \#attr_reader, \#attr_writer or # \#attr_accessor class RDoc::Attr < RDoc::MethodAttr - MARSHAL_VERSION = 2 # :nodoc: + ## + # 3:: + # RDoc 4 + # Added parent name and class + # Added section title + + MARSHAL_VERSION = 3 # :nodoc: ## # Is the attribute readable ('R'), writable ('W') or both ('RW')? @@ -58,6 +62,16 @@ class RDoc::Attr < RDoc::MethodAttr end ## + # Attributes never call super. See RDoc::AnyMethod#calls_super + # + # An RDoc::Attr can show up in the method list in some situations (see + # Gem::ConfigFile) + + def calls_super # :nodoc: + false + end + + ## # Returns attr_reader, attr_writer or attr_accessor as appropriate. def definition @@ -93,6 +107,9 @@ class RDoc::Attr < RDoc::MethodAttr parse(@comment), singleton, @file.absolute_name, + @parent.full_name, + @parent.class, + @section.title ] end @@ -104,17 +121,28 @@ class RDoc::Attr < RDoc::MethodAttr # * #parent_name def marshal_load array - version = array[0] - @name = array[1] - @full_name = array[2] - @rw = array[3] - @visibility = array[4] - @comment = array[5] - @singleton = array[6] || false # MARSHAL_VERSION == 0 + @aliases = [] + @parent = nil + @parent_name = nil + @parent_class = nil + @section = nil + @file = nil + + version = array[0] + @name = array[1] + @full_name = array[2] + @rw = array[3] + @visibility = array[4] + @comment = array[5] + @singleton = array[6] || false # MARSHAL_VERSION == 0 + # 7 handled below + @parent_name = array[8] + @parent_class = array[9] + @section_title = array[10] @file = RDoc::TopLevel.new array[7] if version > 1 - @parent_name = @full_name + @parent_name ||= @full_name.split('#', 2).first end def pretty_print q # :nodoc: @@ -132,5 +160,14 @@ class RDoc::Attr < RDoc::MethodAttr "#{definition} #{name} in: #{parent}" end + ## + # Attributes do not have token streams. + # + # An RDoc::Attr can show up in the method list in some situations (see + # Gem::ConfigFile) + + def token_stream # :nodoc: + end + end diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb index 27066d8bd7..04f0132b7d 100644 --- a/lib/rdoc/class_module.rb +++ b/lib/rdoc/class_module.rb @@ -1,5 +1,3 @@ -require 'rdoc/context' - ## # ClassModule is the base class for objects representing either a class or a # module. @@ -13,8 +11,17 @@ class RDoc::ClassModule < RDoc::Context # * Added file to constants # * Added file to includes # * Added file to methods - - MARSHAL_VERSION = 1 # :nodoc: + # 2:: + # RDoc 3.13 + # * Added extends + # 3:: + # RDoc 4.0 + # * Added sections + # * Added in_files + # * Added parent name + # * Complete Constant dump + + MARSHAL_VERSION = 3 # :nodoc: ## # Constants that are aliases for this class or module @@ -56,6 +63,7 @@ class RDoc::ClassModule < RDoc::Context klass.external_aliases.concat mod.external_aliases klass.constants.concat mod.constants klass.includes.concat mod.includes + klass.extends.concat mod.extends klass.methods_hash.update mod.methods_hash klass.constants_hash.update mod.constants_hash @@ -84,6 +92,7 @@ class RDoc::ClassModule < RDoc::Context klass.external_aliases + klass.constants + klass.includes + + klass.extends + klass.classes + klass.modules).each do |obj| obj.parent = klass @@ -115,16 +124,32 @@ class RDoc::ClassModule < RDoc::Context # across multiple runs. def add_comment comment, location - return if comment.empty? or not document_self + return unless document_self original = comment - comment = normalize_comment comment + comment = case comment + when RDoc::Comment then + comment.normalize + else + normalize_comment comment + end @comment_location << [comment, location] self.comment = original end + def add_things my_things, other_things # :nodoc: + other_things.each do |group, things| + my_things[group].each { |thing| yield false, thing } if + my_things.include? group + + things.each do |thing| + yield true, thing + end + end + end + ## # Ancestors list for this ClassModule: the list of included modules # (classes will add their superclass if any). @@ -142,6 +167,11 @@ class RDoc::ClassModule < RDoc::Context end ## + # Ancestors of this class or module only + + alias direct_ancestors ancestors + + ## # Clears the comment. Used by the ruby parser. def clear_comment @@ -155,9 +185,13 @@ class RDoc::ClassModule < RDoc::Context # more like <tt>+=</tt>. def comment= comment - return if comment.empty? + comment = case comment + when RDoc::Comment then + comment.normalize + else + normalize_comment comment + end - comment = normalize_comment comment comment = "#{@comment}\n---\n#{comment}" unless @comment.empty? super comment @@ -166,7 +200,7 @@ class RDoc::ClassModule < RDoc::Context ## # Prepares this ClassModule for use by a generator. # - # See RDoc::TopLevel::complete + # See RDoc::Store#complete def complete min_visibility update_aliases @@ -176,12 +210,22 @@ class RDoc::ClassModule < RDoc::Context end ## + # Does this ClassModule or any of its methods have document_self set? + + def document_self_or_methods + document_self || method_list.any?{ |m| m.document_self } + end + + ## # Iterates the ancestors of this class or module for which an # RDoc::ClassModule exists. def each_ancestor # :yields: module + return enum_for __method__ unless block_given? + ancestors.each do |mod| next if String === mod + next if self == mod yield mod end end @@ -215,8 +259,8 @@ class RDoc::ClassModule < RDoc::Context # Return the fully qualified name of this class or module def full_name - @full_name ||= if RDoc::ClassModule === @parent then - "#{@parent.full_name}::#{@name}" + @full_name ||= if RDoc::ClassModule === parent then + "#{parent.full_name}::#{@name}" else @name end @@ -250,13 +294,20 @@ class RDoc::ClassModule < RDoc::Context @superclass, parse(@comment_location), attrs, - constants.map do |const| - [const.name, parse(const.comment), const.file_name] - end, + constants, includes.map do |incl| [incl.name, parse(incl.comment), incl.file_name] end, method_types, + extends.map do |ext| + [ext.name, parse(ext.comment), ext.file_name] + end, + @sections.values, + @in_files.map do |tl| + tl.absolute_name + end, + parent.full_name, + parent.class, ] end @@ -268,6 +319,8 @@ class RDoc::ClassModule < RDoc::Context @parent = nil @temporary_section = nil @visibility = nil + @classes = {} + @modules = {} @name = array[1] @full_name = array[2] @@ -291,9 +344,14 @@ class RDoc::ClassModule < RDoc::Context attr.record_location RDoc::TopLevel.new file end - array[6].each do |name, comment, file| - const = add_constant RDoc::Constant.new(name, nil, comment) - const.record_location RDoc::TopLevel.new file + array[6].each do |constant, comment, file| + case constant + when RDoc::Constant then + add_constant constant + else + constant = add_constant RDoc::Constant.new(constant, nil, comment) + constant.record_location RDoc::TopLevel.new file + end end array[7].each do |name, comment, file| @@ -313,6 +371,27 @@ class RDoc::ClassModule < RDoc::Context end end end + + array[9].each do |name, comment, file| + ext = add_extend RDoc::Extend.new(name, comment) + ext.record_location RDoc::TopLevel.new file + end if array[9] # Support Marshal version 1 + + sections = (array[10] || []).map do |section| + [section.title, section] + end + + @sections = Hash[*sections.flatten] + @current_section = add_section nil + + @in_files = [] + + (array[11] || []).each do |filename| + record_location RDoc::TopLevel.new filename + end + + @parent_name = array[12] + @parent_class = array[13] end ## @@ -321,6 +400,9 @@ class RDoc::ClassModule < RDoc::Context # The data in +class_module+ is preferred over the receiver. def merge class_module + @parent = class_module.parent + @parent_name = class_module.parent_name + other_document = parse class_module.comment_location if other_document then @@ -360,6 +442,18 @@ class RDoc::ClassModule < RDoc::Context end end + @includes.uniq! # clean up + + merge_collections extends, cm.extends, other_files do |add, ext| + if add then + add_extend ext + else + @extends.delete ext + end + end + + @extends.uniq! # clean up + merge_collections method_list, cm.method_list, other_files do |add, meth| if add then add_method meth @@ -369,6 +463,8 @@ class RDoc::ClassModule < RDoc::Context end end + merge_sections cm + self end @@ -391,22 +487,46 @@ class RDoc::ClassModule < RDoc::Context my_things = mine. group_by { |thing| thing.file } other_things = other.group_by { |thing| thing.file } - my_things.delete_if do |file, things| - next false unless other_files.include? file + remove_things my_things, other_files, &block + add_things my_things, other_things, &block + end - things.each do |thing| - yield false, thing - end + ## + # Merges the comments in this ClassModule with the comments in the other + # ClassModule +cm+. - true + def merge_sections cm # :nodoc: + my_sections = sections.group_by { |section| section.title } + other_sections = cm.sections.group_by { |section| section.title } + + other_files = cm.in_files + + remove_things my_sections, other_files do |_, section| + @sections.delete section.title end - other_things.each do |file, things| - my_things[file].each { |thing| yield false, thing } if - my_things.include?(file) + other_sections.each do |group, sections| + if my_sections.include? group + my_sections[group].each do |my_section| + other_section = cm.sections_hash[group] - things.each do |thing| - yield true, thing + my_comments = my_section.comments + other_comments = other_section.comments + + other_files = other_section.in_files + + merge_collections my_comments, other_comments, other_files do |add, comment| + if add then + my_section.add_comment comment + else + my_section.remove_comment comment + end + end + end + else + sections.each do |section| + add_section group, section.comments + end end end end @@ -438,11 +558,15 @@ class RDoc::ClassModule < RDoc::Context when Array then docs = comment_location.map do |comment, location| doc = super comment - doc.file = location.absolute_name + doc.file = location doc end RDoc::Markup::Document.new(*docs) + when RDoc::Comment then + doc = super comment_location.text, comment_location.format + doc.file = comment_location.location + doc when RDoc::Markup::Document then return comment_location else @@ -451,10 +575,10 @@ class RDoc::ClassModule < RDoc::Context end ## - # Path to this class or module + # Path to this class or module for use with HTML generator output. def path - http_url RDoc::RDoc.current.generator.class_dir + http_url @store.rdoc.generator.class_dir end ## @@ -488,21 +612,61 @@ class RDoc::ClassModule < RDoc::Context modules_hash.each_key do |name| full_name = prefix + name - modules_hash.delete name unless RDoc::TopLevel.all_modules_hash[full_name] + modules_hash.delete name unless @store.modules_hash[full_name] end classes_hash.each_key do |name| full_name = prefix + name - classes_hash.delete name unless RDoc::TopLevel.all_classes_hash[full_name] + classes_hash.delete name unless @store.classes_hash[full_name] end end + def remove_things my_things, other_files # :nodoc: + my_things.delete_if do |file, things| + next false unless other_files.include? file + + things.each do |thing| + yield false, thing + end + + true + end + end + + ## + # Search record used by RDoc::Generator::JsonIndex + + def search_record + [ + name, + full_name, + full_name, + '', + path, + '', + snippet(@comment_location), + ] + end + + ## + # Sets the store for this class or module and its contained code objects. + + def store= store + super + + @attributes .each do |attr| attr.store = store end + @constants .each do |const| const.store = store end + @includes .each do |incl| incl.store = store end + @extends .each do |ext| ext.store = store end + @method_list.each do |meth| meth.store = store end + end + ## # Get the superclass of this class. Attempts to retrieve the superclass # object, returns the name if it is not known. def superclass - RDoc::TopLevel.find_class_named(@superclass) || @superclass + @store.find_class_named(@superclass) || @superclass end ## @@ -533,7 +697,7 @@ class RDoc::ClassModule < RDoc::Context # aliases through a constant. # # The aliased module/class is replaced in the children and in - # RDoc::TopLevel::all_modules_hash or RDoc::TopLevel::all_classes_hash + # RDoc::Store#modules_hash or RDoc::Store#classes_hash # by a copy that has <tt>RDoc::ClassModule#is_alias_for</tt> set to # the aliased module/class, and this copy is added to <tt>#aliases</tt> # of the aliased module/class. @@ -548,16 +712,21 @@ class RDoc::ClassModule < RDoc::Context next unless cm = const.is_alias_for cm_alias = cm.dup cm_alias.name = const.name - cm_alias.parent = self - cm_alias.full_name = nil # force update for new parent + + # Don't move top-level aliases under Object, they look ugly there + unless RDoc::TopLevel === cm_alias.parent then + cm_alias.parent = self + cm_alias.full_name = nil # force update for new parent + end + cm_alias.aliases.clear cm_alias.is_alias_for = cm if cm.module? then - RDoc::TopLevel.all_modules_hash[cm_alias.full_name] = cm_alias + @store.modules_hash[cm_alias.full_name] = cm_alias modules_hash[const.name] = cm_alias else - RDoc::TopLevel.all_classes_hash[cm_alias.full_name] = cm_alias + @store.classes_hash[cm_alias.full_name] = cm_alias classes_hash[const.name] = cm_alias end @@ -574,8 +743,26 @@ class RDoc::ClassModule < RDoc::Context def update_includes includes.reject! do |include| mod = include.module - !(String === mod) && RDoc::TopLevel.all_modules_hash[mod.full_name].nil? + !(String === mod) && @store.modules_hash[mod.full_name].nil? end + + includes.uniq! + end + + ## + # Deletes from #extends those whose module has been removed from the + # documentation. + #-- + # FIXME: like update_includes, extends are not reliably removed + + def update_extends + extends.reject! do |ext| + mod = ext.module + + !(String === mod) && @store.modules_hash[mod.full_name].nil? + end + + extends.uniq! end end diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb index 54826fffbd..e2d9d909da 100644 --- a/lib/rdoc/code_object.rb +++ b/lib/rdoc/code_object.rb @@ -1,6 +1,3 @@ -require 'rdoc' -require 'rdoc/text' - ## # Base class for the RDoc code tree. # @@ -78,9 +75,9 @@ class RDoc::CodeObject attr_accessor :offset ## - # Our parent CodeObject + # Sets the parent CodeObject - attr_accessor :parent + attr_writer :parent ## # Did we ever receive a +:nodoc:+ directive? @@ -88,9 +85,14 @@ class RDoc::CodeObject attr_reader :received_nodoc ## - # Which section are we in + # Set the section this CodeObject is in - attr_accessor :section + attr_writer :section + + ## + # The RDoc::Store for this object. + + attr_accessor :store ## # We are the model of the code, but we know that at some point we will be @@ -103,11 +105,16 @@ class RDoc::CodeObject # Creates a new CodeObject that will document itself and its children def initialize - @metadata = {} - @comment = '' - @parent = nil - @file = nil - @full_name = nil + @metadata = {} + @comment = '' + @parent = nil + @parent_name = nil # for loading + @parent_class = nil # for loading + @section = nil + @section_title = nil # for loading + @file = nil + @full_name = nil + @store = nil @document_children = true @document_self = true @@ -124,11 +131,11 @@ class RDoc::CodeObject @comment = case comment when NilClass then '' when RDoc::Markup::Document then comment + when RDoc::Comment then comment.normalize else if comment and not comment.empty? then normalize_comment comment else - # TODO is this sufficient? # HACK correct fix is to have #initialize create @comment # with the correct encoding if String === @comment and @@ -216,7 +223,7 @@ class RDoc::CodeObject ## # Force the documentation of this object unless documentation - # has been turned off by :endoc: + # has been turned off by :enddoc: #-- # HACK untested, was assigning to an ivar @@ -262,6 +269,29 @@ class RDoc::CodeObject end ## + # Our parent CodeObject. The parent may be missing for classes loaded from + # legacy RI data stores. + + def parent + return @parent if @parent + return nil unless @parent_name + + if @parent_class == RDoc::TopLevel then + @parent = @store.add_file @parent_name + else + @parent = @store.find_class_or_module @parent_name + + return @parent if @parent + + begin + @parent = @store.load_class @parent_name + rescue RDoc::Store::MissingFileError + nil + end + end + end + + ## # File name of our parent def parent_file_name @@ -284,8 +314,18 @@ class RDoc::CodeObject end ## + # The section this CodeObject is in. Sections allow grouping of constants, + # attributes and methods inside a class or module. + + def section + return @section if @section + + @section = parent.add_section @section_title if parent + end + + ## # Enable capture of documentation unless documentation has been - # turned off by :endoc: + # turned off by :enddoc: def start_doc return if @done_documenting diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb index c60dad92df..f1a626cd2e 100644 --- a/lib/rdoc/code_objects.rb +++ b/lib/rdoc/code_objects.rb @@ -1,23 +1,5 @@ -# We represent the various high-level code constructs that appear in Ruby -# programs: classes, modules, methods, and so on. +# This file was used to load all the RDoc::CodeObject subclasses at once. Now +# autoload handles this. -require 'rdoc/code_object' -require 'rdoc/context' -require 'rdoc/top_level' - -require 'rdoc/class_module' -require 'rdoc/normal_class' -require 'rdoc/normal_module' -require 'rdoc/anon_class' -require 'rdoc/single_class' - -require 'rdoc/any_method' -require 'rdoc/alias' -require 'rdoc/ghost_method' -require 'rdoc/meta_method' - -require 'rdoc/attr' -require 'rdoc/constant' -require 'rdoc/require' -require 'rdoc/include' +require 'rdoc' diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb new file mode 100644 index 0000000000..25e7c966c8 --- /dev/null +++ b/lib/rdoc/comment.rb @@ -0,0 +1,232 @@ +## +# A comment holds the text comment for a RDoc::CodeObject and provides a +# unified way of cleaning it up and parsing it into an RDoc::Markup::Document. +# +# Each comment may have a different markup format set by #format=. By default +# 'rdoc' is used. The :markup: directive tells RDoc which format to use. +# +# See RDoc::Markup@Other+directives for instructions on adding an alternate +# format. + +class RDoc::Comment + + include RDoc::Text + + ## + # The format of this comment. Defaults to RDoc::Markup + + attr_reader :format + + ## + # The RDoc::TopLevel this comment was found in + + attr_accessor :location + + ## + # For duck-typing when merging classes at load time + + alias file location # :nodoc: + + ## + # The text for this comment + + attr_reader :text + + ## + # Overrides the content returned by #parse. Use when there is no #text + # source for this comment + + attr_writer :document + + ## + # Creates a new comment with +text+ that is found in the RDoc::TopLevel + # +location+. + + def initialize text = nil, location = nil + @location = location + @text = text + + @document = nil + @format = 'rdoc' + @normalized = false + end + + ## + #-- + # TODO deep copy @document + + def initialize_copy copy # :nodoc: + @text = copy.text.dup + end + + def == other # :nodoc: + self.class === other and + other.text == @text and other.location == @location + end + + ## + # Look for a 'call-seq' in the comment to override the normal parameter + # handling. The :call-seq: is indented from the baseline. All lines of the + # same indentation level and prefix are consumed. + # + # For example, all of the following will be used as the :call-seq: + # + # # :call-seq: + # # ARGF.readlines(sep=$/) -> array + # # ARGF.readlines(limit) -> array + # # ARGF.readlines(sep, limit) -> array + # # + # # ARGF.to_a(sep=$/) -> array + # # ARGF.to_a(limit) -> array + # # ARGF.to_a(sep, limit) -> array + + def extract_call_seq method + # we must handle situations like the above followed by an unindented first + # comment. The difficulty is to make sure not to match lines starting + # with ARGF at the same indent, but that are after the first description + # paragraph. + if @text =~ /^\s*:?call-seq:(.*?(?:\S).*?)^\s*$/m then + all_start, all_stop = $~.offset(0) + seq_start, seq_stop = $~.offset(1) + + # we get the following lines that start with the leading word at the + # same indent, even if they have blank lines before + if $1 =~ /(^\s*\n)+^(\s*\w+)/m then + leading = $2 # ' * ARGF' in the example above + re = %r% + \A( + (^\s*\n)+ + (^#{Regexp.escape leading}.*?\n)+ + )+ + ^\s*$ + %xm + + if @text[seq_stop..-1] =~ re then + all_stop = seq_stop + $~.offset(0).last + seq_stop = seq_stop + $~.offset(1).last + end + end + + seq = @text[seq_start..seq_stop] + seq.gsub!(/^\s*(\S|\n)/m, '\1') + @text.slice! all_start...all_stop + + method.call_seq = seq.chomp + + elsif @text.sub!(/^\s*:?call-seq:(.*?)(^\s*$|\z)/m, '') then + seq = $1 + seq.gsub!(/^\s*/, '') + method.call_seq = seq + end + #elsif @text.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '') then + # method.call_seq = $1.strip + #end + + method + end + + ## + # A comment is empty if its text String is empty. + + def empty? + @text.empty? + end + + ## + # HACK dubious + + def force_encoding encoding + @text.force_encoding encoding + end + + ## + # Sets the format of this comment and resets any parsed document + + def format= format + @format = format + @document = nil + end + + def inspect # :nodoc: + location = @location ? @location.absolute_name : '(unknown)' + + "#<%s:%x %s %p>" % [self.class, object_id, location, @text] + end + + ## + # Normalizes the text. See RDoc::Text#normalize_comment for details + + def normalize + return self unless @text + return self if @normalized # TODO eliminate duplicate normalization + + @text = normalize_comment @text + + @normalized = true + + self + end + + ## + # Was this text normalized? + + def normalized? # :nodoc: + @normalized + end + + ## + # Parses the comment into an RDoc::Markup::Document. The parsed document is + # cached until the text is changed. + + def parse + return @document if @document + + @document = super @text, @format + @document.file = @location + @document + end + + ## + # Removes private sections from this comment. Private sections are flush to + # the comment marker and start with <tt>--</tt> and end with <tt>++</tt>. + # For C-style comments, a private marker may not start at the opening of the + # comment. + # + # /* + # *-- + # * private + # *++ + # * public + # */ + + def remove_private + # Workaround for gsub encoding for Ruby 1.9.2 and earlier + empty = '' + empty.force_encoding @text.encoding if Object.const_defined? :Encoding + + @text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty) + @text = @text.sub(%r%^\s*[#*]?--.*%m, '') + end + + ## + # Replaces this comment's text with +text+ and resets the parsed document. + # + # An error is raised if the comment contains a document but no text. + + def text= text + raise RDoc::Error, 'replacing document-only comment is not allowed' if + @text.nil? and @document + + @document = nil + @text = text + end + + ## + # Returns true if this comment is in TomDoc format. + + def tomdoc? + @format == 'tomdoc' + end + +end + diff --git a/lib/rdoc/constant.rb b/lib/rdoc/constant.rb index 056ce130be..d9fcf021ed 100644 --- a/lib/rdoc/constant.rb +++ b/lib/rdoc/constant.rb @@ -1,16 +1,14 @@ -require 'rdoc/code_object' - ## # A constant class RDoc::Constant < RDoc::CodeObject + MARSHAL_VERSION = 0 # :nodoc: + ## - # If this constant is an alias for a module or class, - # this is the RDoc::ClassModule it is an alias for. - # +nil+ otherwise. + # Sets the module or class this is constant is an alias for. - attr_accessor :is_alias_for + attr_writer :is_alias_for ## # The constant's name @@ -23,13 +21,22 @@ class RDoc::Constant < RDoc::CodeObject attr_accessor :value ## + # The constant's visibility + + attr_accessor :visibility + + ## # Creates a new constant with +name+, +value+ and +comment+ def initialize(name, value, comment) super() - @name = name + + @name = name @value = value + @is_alias_for = nil + @visibility = nil + self.comment = comment end @@ -59,6 +66,27 @@ class RDoc::Constant < RDoc::CodeObject super or is_alias_for && is_alias_for.documented? end + ## + # Full constant name including namespace + + def full_name + @full_name ||= "#{parent_name}::#{@name}" + end + + ## + # The module or class this constant is an alias for + + def is_alias_for + case @is_alias_for + when String then + found = @store.find_class_or_module @is_alias_for + @is_alias_for = found if found + @is_alias_for + else + @is_alias_for + end + end + def inspect # :nodoc: "#<%s:0x%x %s::%s>" % [ self.class, object_id, @@ -67,12 +95,76 @@ class RDoc::Constant < RDoc::CodeObject end ## - # Path to this constant + # Dumps this Constant for use by ri. See also #marshal_load + + def marshal_dump + alias_name = case found = is_alias_for + when RDoc::CodeObject then found.full_name + else found + end + + [ MARSHAL_VERSION, + @name, + full_name, + @visibility, + alias_name, + parse(@comment), + @file.absolute_name, + parent.name, + parent.class, + section.title, + ] + end + + ## + # Loads this Constant from +array+. For a loaded Constant the following + # methods will return cached values: + # + # * #full_name + # * #parent_name + + def marshal_load array + initialize array[1], nil, array[5] + + @full_name = array[2] + @visibility = array[3] + @is_alias_for = array[4] + # 5 handled above + # 6 handled below + @parent_name = array[7] + @parent_class = array[8] + @section_title = array[9] + + @file = RDoc::TopLevel.new array[6] + end + + ## + # Path to this constant for use with HTML generator output. def path "#{@parent.path}##{@name}" end + def pretty_print q # :nodoc: + q.group 2, "[#{self.class.name} #{full_name}", "]" do + unless comment.empty? then + q.breakable + q.text "comment:" + q.breakable + q.pp @comment + end + end + end + + ## + # Sets the store for this class or module and its contained code objects. + + def store= store + super + + @file = @store.add_file @file.full_name if @file + end + def to_s # :nodoc: parent_name = parent ? parent.full_name : '(unknown)' if is_alias_for diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index abdab2026d..6f9deae4a8 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -1,4 +1,4 @@ -require 'rdoc/code_object' +require 'cgi' ## # A Context is something that can hold modules, classes, methods, attributes, @@ -15,6 +15,12 @@ class RDoc::Context < RDoc::CodeObject TYPES = %w[class instance] ## + # If a context has these titles it will be sorted in this order. + + TOMDOC_TITLES = [nil, 'Public', 'Internal', 'Deprecated'] # :nodoc: + TOMDOC_TITLES_SORT = TOMDOC_TITLES.sort_by { |title| title.to_s } # :nodoc: + + ## # Class/module aliases attr_reader :aliases @@ -25,6 +31,11 @@ class RDoc::Context < RDoc::CodeObject attr_reader :attributes ## + # Block params to be used in the next MethodAttr parsed under this context + + attr_accessor :block_params + + ## # Constants defined attr_reader :constants @@ -45,6 +56,11 @@ class RDoc::Context < RDoc::CodeObject attr_reader :includes ## + # Modules this context is extended with + + attr_reader :extends + + ## # Methods defined in this context attr_reader :method_list @@ -72,7 +88,7 @@ class RDoc::Context < RDoc::CodeObject attr_accessor :unmatched_alias_lists ## - # Aliases that could not eventually be resolved. + # Aliases that could not be resolved. attr_reader :external_aliases @@ -88,121 +104,14 @@ class RDoc::Context < RDoc::CodeObject attr_reader :methods_hash ## - # Hash of registered constants. + # Params to be used in the next MethodAttr parsed under this context - attr_reader :constants_hash + attr_accessor :params ## - # A section of documentation like: - # - # # :section: The title - # # The body - # - # Sections can be referenced multiple times and will be collapsed into a - # single section. - - class Section - - include RDoc::Text - - ## - # Section comment - - attr_reader :comment - - ## - # Context this Section lives in - - attr_reader :parent - - ## - # Section title - - attr_reader :title - - @@sequence = "SEC00000" - - ## - # Creates a new section with +title+ and +comment+ - - def initialize parent, title, comment - @parent = parent - @title = title ? title.strip : title - - @@sequence.succ! - @sequence = @@sequence.dup - - @comment = extract_comment comment - end - - ## - # Sections are equal when they have the same #title - - def == other - self.class === other and @title == other.title - end - - ## - # Anchor reference for linking to this section - - def aref - title = @title || '[untitled]' - - CGI.escape(title).gsub('%', '-').sub(/^-/, '') - end - - ## - # Appends +comment+ to the current comment separated by a rule. - - def comment= comment - comment = extract_comment comment - - return if comment.empty? - - if @comment then - @comment += "\n# ---\n#{comment}" - else - @comment = comment - end - end - - ## - # Extracts the comment for this section from the original comment block. - # If the first line contains :section:, strip it and use the rest. - # Otherwise remove lines up to the line containing :section:, and look - # for those lines again at the end and remove them. This lets us write - # - # # :section: The title - # # The body - - def extract_comment comment - if comment =~ /^#[ \t]*:section:.*\n/ then - start = $` - rest = $' - - if start.empty? then - rest - else - rest.sub(/#{start.chomp}\Z/, '') - end - else - comment - end - end - - def inspect # :nodoc: - "#<%s:0x%x %p>" % [self.class, object_id, title] - end - - ## - # Section sequence number (deprecated) - - def sequence - warn "RDoc::Context::Section#sequence is deprecated, use #aref" - @sequence - end + # Hash of registered constants. - end + attr_reader :constants_hash ## # Creates an unnamed empty context with public current visibility @@ -235,6 +144,7 @@ class RDoc::Context < RDoc::CodeObject @aliases = [] @requires = [] @includes = [] + @extends = [] @constants = [] @external_aliases = [] @@ -242,8 +152,12 @@ class RDoc::Context < RDoc::CodeObject # a method not yet encountered). @unmatched_alias_lists = {} - @methods_hash = {} + @methods_hash = {} @constants_hash = {} + + @params = nil + + @store ||= nil end ## @@ -366,12 +280,12 @@ class RDoc::Context < RDoc::CodeObject if full_name =~ /^(.+)::(\w+)$/ then name = $2 ename = $1 - enclosing = RDoc::TopLevel.classes_hash[ename] || - RDoc::TopLevel.modules_hash[ename] + enclosing = @store.classes_hash[ename] || @store.modules_hash[ename] # HACK: crashes in actionpack/lib/action_view/helpers/form_helper.rb (metaprogramming) unless enclosing then # try the given name at top level (will work for the above example) - enclosing = RDoc::TopLevel.classes_hash[given_name] || RDoc::TopLevel.modules_hash[given_name] + enclosing = @store.classes_hash[given_name] || + @store.modules_hash[given_name] return enclosing if enclosing # not found: create the parent(s) names = ename.split('::') @@ -410,7 +324,7 @@ class RDoc::Context < RDoc::CodeObject end # did we believe it was a module? - mod = RDoc::TopLevel.modules_hash.delete superclass + mod = @store.modules_hash.delete superclass upgrade_to_class mod, RDoc::NormalClass, mod.parent if mod @@ -418,7 +332,7 @@ class RDoc::Context < RDoc::CodeObject superclass = nil if superclass == full_name end - klass = RDoc::TopLevel.classes_hash[full_name] + klass = @store.classes_hash[full_name] if klass then # if TopLevel, it may not be registered in the classes: @@ -435,7 +349,7 @@ class RDoc::Context < RDoc::CodeObject end else # this is a new class - mod = RDoc::TopLevel.modules_hash.delete full_name + mod = @store.modules_hash.delete full_name if mod then klass = upgrade_to_class mod, RDoc::NormalClass, enclosing @@ -445,10 +359,12 @@ class RDoc::Context < RDoc::CodeObject klass = class_type.new name, superclass enclosing.add_class_or_module(klass, enclosing.classes_hash, - RDoc::TopLevel.classes_hash) + @store.classes_hash) end end + klass.parent = self + klass end @@ -463,6 +379,7 @@ class RDoc::Context < RDoc::CodeObject mod.section = current_section # TODO declaring context? something is # wrong here... mod.parent = self + mod.store = @store unless @done_documenting then self_hash[mod.name] = mod @@ -504,13 +421,21 @@ class RDoc::Context < RDoc::CodeObject # Adds included module +include+ which should be an RDoc::Include def add_include include - add_to @includes, include unless - @includes.map { |i| i.full_name }.include? include.full_name + add_to @includes, include include end ## + # Adds extension module +ext+ which should be an RDoc::Extend + + def add_extend ext + add_to @extends, ext + + ext + end + + ## # Adds +method+ if not already there. If it is (as method or attribute), # updates the comment if it was empty. @@ -523,6 +448,10 @@ class RDoc::Context < RDoc::CodeObject if known then known.comment = method.comment if known.comment.empty? + previously = ", previously in #{known.file}" unless + method.file == known.file + @store.rdoc.options.warn \ + "Duplicate method #{known.full_name} in #{method.file}#{previously}" else @methods_hash[key] = method method.visibility = @visibility @@ -542,9 +471,9 @@ class RDoc::Context < RDoc::CodeObject return mod if mod full_name = child_name name - mod = RDoc::TopLevel.modules_hash[full_name] || class_type.new(name) + mod = @store.modules_hash[full_name] || class_type.new(name) - add_class_or_module(mod, @modules, RDoc::TopLevel.modules_hash) + add_class_or_module mod, @modules, @store.modules_hash end ## @@ -554,31 +483,34 @@ class RDoc::Context < RDoc::CodeObject def add_module_alias from, name, file return from if @done_documenting - to_name = child_name(name) + to_name = child_name name # if we already know this name, don't register an alias: # see the metaprogramming in lib/active_support/basic_object.rb, - # where we already know BasicObject as a class when we find + # where we already know BasicObject is a class when we find # BasicObject = BlankSlate - return from if RDoc::TopLevel.find_class_or_module(to_name) + return from if @store.find_class_or_module to_name - if from.module? then - RDoc::TopLevel.modules_hash[to_name] = from - @modules[name] = from + to = from.dup + to.name = name + to.full_name = nil + + if to.module? then + @store.modules_hash[to_name] = to + @modules[name] = to else - RDoc::TopLevel.classes_hash[to_name] = from - @classes[name] = from + @store.classes_hash[to_name] = to + @classes[name] = to end - # HACK: register a constant for this alias: - # constant value and comment will be updated after, - # when the Ruby parser adds the constant - const = RDoc::Constant.new name, nil, '' + # Registers a constant for this alias. The constant value and comment + # will be updated later, when the Ruby parser adds the constant + const = RDoc::Constant.new name, nil, to.comment const.record_location file const.is_alias_for = from add_constant const - from + to end ## @@ -602,9 +534,9 @@ class RDoc::Context < RDoc::CodeObject # # See also RDoc::Context::Section - def add_section title, comment + def add_section title, comment = nil if section = @sections[title] then - section.comment = comment + section.add_comment comment if comment else section = Section.new self, title, comment @sections[title] = section @@ -616,9 +548,11 @@ class RDoc::Context < RDoc::CodeObject ## # Adds +thing+ to the collection +array+ - def add_to(array, thing) + def add_to array, thing array << thing if @document_self - thing.parent = self + + thing.parent = self + thing.store = @store if @store thing.section = current_section end @@ -628,7 +562,7 @@ class RDoc::Context < RDoc::CodeObject # This means any of: comment, aliases, methods, attributes, external # aliases, require, constant. # - # Includes are also checked unless <tt>includes == false</tt>. + # Includes and extends are also checked unless <tt>includes == false</tt>. def any_content(includes = true) @any_content ||= !( @@ -640,7 +574,7 @@ class RDoc::Context < RDoc::CodeObject @requires.empty? && @constants.empty? ) - @any_content || (includes && !@includes.empty?) + @any_content || (includes && !(@includes + @extends).empty? ) end ## @@ -723,6 +657,9 @@ class RDoc::Context < RDoc::CodeObject ## # Iterator for ancestors for duck-typing. Does nothing. See # RDoc::ClassModule#each_ancestor. + # + # This method exists to make it easy to work with Context subclasses that + # aren't part of RDoc. def each_ancestor # :nodoc: end @@ -756,10 +693,19 @@ class RDoc::Context < RDoc::CodeObject end ## + # Iterator for extension modules + + def each_extend # :yields: extend + @extends.each do |e| yield e end + end + + ## # Iterator for methods def each_method # :yields: method - @method_list.sort.each {|m| yield m} + return enum_for __method__ unless block_given? + + @method_list.sort.each { |m| yield m } end ## @@ -773,13 +719,15 @@ class RDoc::Context < RDoc::CodeObject # NOTE: Do not edit collections yielded by this method def each_section # :yields: section, constants, attributes - constants = @constants.group_by do |constant| constant.section end - constants.default = [] + return enum_for __method__ unless block_given? + constants = @constants.group_by do |constant| constant.section end attributes = @attributes.group_by do |attribute| attribute.section end + + constants.default = [] attributes.default = [] - @sections.sort_by { |title, _| title.to_s }.each do |_, section| + sort_sections.each do |section| yield section, constants[section].sort, attributes[section].sort end end @@ -851,8 +799,8 @@ class RDoc::Context < RDoc::CodeObject ## # Finds a file with +name+ in this context - def find_file_named(name) - top_level.class.find_file_named(name) + def find_file_named name + @store.find_file_named name end ## @@ -922,21 +870,21 @@ class RDoc::Context < RDoc::CodeObject # look for a class or module 'symbol' case symbol when /^::/ then - result = RDoc::TopLevel.find_class_or_module(symbol) + result = @store.find_class_or_module symbol when /^(\w+):+(.+)$/ suffix = $2 top = $1 searched = self - loop do + while searched do mod = searched.find_module_named(top) break unless mod - result = RDoc::TopLevel.find_class_or_module(mod.full_name + '::' + suffix) + result = @store.find_class_or_module "#{mod.full_name}::#{suffix}" break if result || searched.is_a?(RDoc::TopLevel) searched = searched.parent end else searched = self - loop do + while searched do result = searched.find_module_named(symbol) break if result || searched.is_a?(RDoc::TopLevel) searched = searched.parent @@ -985,6 +933,8 @@ class RDoc::Context < RDoc::CodeObject ## # Instance methods + #-- + # TODO rename to instance_methods def instance_method_list @instance_method_list ||= method_list.reject { |a| a.singleton } @@ -1098,24 +1048,23 @@ class RDoc::Context < RDoc::CodeObject ## # Only called when min_visibility == :public or :private - def remove_invisible_in(array, min_visibility) # :nodoc: - if min_visibility == :public + def remove_invisible_in array, min_visibility # :nodoc: + if min_visibility == :public then array.reject! { |e| e.visibility != :public and not e.force_documentation } else array.reject! { |e| - e.visibility == :private and - not e.force_documentation + e.visibility == :private and not e.force_documentation } end end ## - # Tries to resolve unmatched aliases when a method - # or attribute has just been added. + # Tries to resolve unmatched aliases when a method or attribute has just + # been added. - def resolve_aliases(added) + def resolve_aliases added # resolve any pending unmatched aliases key = added.pretty_name unmatched_alias_list = @unmatched_alias_lists[key] @@ -1128,6 +1077,31 @@ class RDoc::Context < RDoc::CodeObject end ## + # Returns RDoc::Context::Section objects referenced in this context for use + # in a table of contents. + + def section_contents + used_sections = {} + + each_method do |method| + next unless method.display? + + used_sections[method.section] = true + end + + # order found sections + sections = sort_sections.select do |section| + used_sections[section] + end + + # only the default section is used + return [] if + sections.length == 1 and not sections.first.title + + sections + end + + ## # Sections in this context def sections @@ -1155,6 +1129,26 @@ class RDoc::Context < RDoc::CodeObject end end + ## + # Sorts sections alphabetically (default) or in TomDoc fashion (none, + # Public, Internal, Deprecated) + + def sort_sections + titles = @sections.map { |title, _| title } + + if titles.length > 1 and + TOMDOC_TITLES_SORT == + (titles | TOMDOC_TITLES).sort_by { |title| title.to_s } then + @sections.values_at(*TOMDOC_TITLES).compact + else + @sections.sort_by { |title, _| + title.to_s + }.map { |_, section| + section + } + end + end + def to_s # :nodoc: "#{self.class.name} #{self.full_name}" end @@ -1179,13 +1173,16 @@ class RDoc::Context < RDoc::CodeObject enclosing.modules_hash.delete mod.name klass = RDoc::ClassModule.from_module class_type, mod + klass.store = @store # if it was there, then we keep it even if done_documenting - RDoc::TopLevel.classes_hash[mod.full_name] = klass - enclosing.classes_hash[mod.name] = klass + @store.classes_hash[mod.full_name] = klass + enclosing.classes_hash[mod.name] = klass klass end + autoload :Section, 'rdoc/context/section' + end diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb new file mode 100644 index 0000000000..580f07deff --- /dev/null +++ b/lib/rdoc/context/section.rb @@ -0,0 +1,238 @@ +## +# A section of documentation like: +# +# # :section: The title +# # The body +# +# Sections can be referenced multiple times and will be collapsed into a +# single section. + +class RDoc::Context::Section + + include RDoc::Text + + MARSHAL_VERSION = 0 # :nodoc: + + ## + # Section comment + + attr_reader :comment + + ## + # Section comments + + attr_reader :comments + + ## + # Context this Section lives in + + attr_reader :parent + + ## + # Section title + + attr_reader :title + + @@sequence = "SEC00000" + + ## + # Creates a new section with +title+ and +comment+ + + def initialize parent, title, comment + @parent = parent + @title = title ? title.strip : title + + @@sequence.succ! + @sequence = @@sequence.dup + + @comments = [] + + add_comment comment + end + + ## + # Sections are equal when they have the same #title + + def == other + self.class === other and @title == other.title + end + + ## + # Adds +comment+ to this section + + def add_comment comment + comment = extract_comment comment + + return if comment.empty? + + case comment + when RDoc::Comment then + @comments << comment + when RDoc::Markup::Document then + @comments.concat comment.parts + when Array then + @comments.concat comment + else + raise TypeError, "unknown comment type: #{comment.inspect}" + end + end + + ## + # Anchor reference for linking to this section + + def aref + title = @title || '[untitled]' + + CGI.escape(title).gsub('%', '-').sub(/^-/, '') + end + + ## + # Extracts the comment for this section from the original comment block. + # If the first line contains :section:, strip it and use the rest. + # Otherwise remove lines up to the line containing :section:, and look + # for those lines again at the end and remove them. This lets us write + # + # # :section: The title + # # The body + + def extract_comment comment + case comment + when Array then + comment.map do |c| + extract_comment c + end + when nil + RDoc::Comment.new '' + when RDoc::Comment then + if comment.text =~ /^#[ \t]*:section:.*\n/ then + start = $` + rest = $' + + comment.text = if start.empty? then + rest + else + rest.sub(/#{start.chomp}\Z/, '') + end + end + + comment + when RDoc::Markup::Document then + comment + else + raise TypeError, "unknown comment #{comment.inspect}" + end + end + + def inspect # :nodoc: + "#<%s:0x%x %p>" % [self.class, object_id, title] + end + + ## + # The files comments in this section come from + + def in_files + return [] if @comments.empty? + + case @comments + when Array then + @comments.map do |comment| + comment.file + end + when RDoc::Markup::Document then + @comment.parts.map do |document| + document.file + end + else + raise RDoc::Error, "BUG: unknown comment class #{@comments.class}" + end + end + + ## + # Serializes this Section. The title and parsed comment are saved, but not + # the section parent which must be restored manually. + + def marshal_dump + [ + MARSHAL_VERSION, + @title, + parse, + ] + end + + ## + # De-serializes this Section. The section parent must be restored manually. + + def marshal_load array + @parent = nil + + @title = array[1] + @comments = array[2] + end + + ## + # Parses +comment_location+ into an RDoc::Markup::Document composed of + # multiple RDoc::Markup::Documents with their file set. + + def parse + case @comments + when String then + super + when Array then + docs = @comments.map do |comment, location| + doc = super comment + doc.file = location if location + doc + end + + RDoc::Markup::Document.new(*docs) + when RDoc::Comment then + doc = super @comments.text, comments.format + doc.file = @comments.location + doc + when RDoc::Markup::Document then + return @comments + else + raise ArgumentError, "unknown comment class #{comments.class}" + end + end + + ## + # The section's title, or 'Top Section' if the title is nil. + # + # This is used by the table of contents template so the name is silly. + + def plain_html + @title || 'Top Section' + end + + ## + # Removes a comment from this section if it is from the same file as + # +comment+ + + def remove_comment comment + return if @comments.empty? + + case @comments + when Array then + @comments.delete_if do |my_comment| + my_comment.file == comment.file + end + when RDoc::Markup::Document then + @comments.parts.delete_if do |document| + document.file == comment.file.name + end + else + raise RDoc::Error, "BUG: unknown comment class #{@comments.class}" + end + end + + ## + # Section sequence number (deprecated) + + def sequence + warn "RDoc::Context::Section#sequence is deprecated, use #aref" + @sequence + end + +end + diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index adeef2661a..c6f127387c 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -18,7 +18,7 @@ class RDoc::CrossReference # # See CLASS_REGEXP_STR - METHOD_REGEXP_STR = '([a-z]\w*[!?=]?)(?:\([\w.+*/=<>-]*\))?' + METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%)(?:\([\w.+*/=<>-]*\))?' ## # Regular expressions matching text that should potentially have @@ -27,63 +27,79 @@ class RDoc::CrossReference # have been suppressed, since the suppression characters are removed by the # code that is triggered. - CROSSREF_REGEXP = /( - # A::B::C.meth - #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR} - - # Stand-alone method (preceded by a #) - | \\?\##{METHOD_REGEXP_STR} - - # Stand-alone method (preceded by ::) - | ::#{METHOD_REGEXP_STR} - - # A::B::C - # The stuff after CLASS_REGEXP_STR is a - # nasty hack. CLASS_REGEXP_STR unfortunately matches - # words like dog and cat (these are legal "class" - # names in Fortran 95). When a word is flagged as a - # potential cross-reference, limitations in the markup - # engine suppress other processing, such as typesetting. - # This is particularly noticeable for contractions. - # In order that words like "can't" not - # be flagged as potential cross-references, only - # flag potential class cross-references if the character - # after the cross-reference is a space, sentence - # punctuation, tag start character, or attribute - # marker. - | #{CLASS_REGEXP_STR}(?=[\s\)\.\?\!\,\;<\000]|\z) - - # Things that look like filenames - # The key thing is that there must be at least - # one special character (period, slash, or - # underscore). - | (?:\.\.\/)*[-\/\w]+[_\/\.][-\w\/\.]+ - - # Things that have markup suppressed - # Don't process things like '\<' in \<tt>, though. - # TODO: including < is a hack, not very satisfying. - | \\[^\s<] - )/x + CROSSREF_REGEXP = /(?:^|\s) + ( + (?: + # A::B::C.meth + #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR} + + # Stand-alone method (preceded by a #) + | \\?\##{METHOD_REGEXP_STR} + + # Stand-alone method (preceded by ::) + | ::#{METHOD_REGEXP_STR} + + # A::B::C + # The stuff after CLASS_REGEXP_STR is a + # nasty hack. CLASS_REGEXP_STR unfortunately matches + # words like dog and cat (these are legal "class" + # names in Fortran 95). When a word is flagged as a + # potential cross-reference, limitations in the markup + # engine suppress other processing, such as typesetting. + # This is particularly noticeable for contractions. + # In order that words like "can't" not + # be flagged as potential cross-references, only + # flag potential class cross-references if the character + # after the cross-reference is a space, sentence + # punctuation, tag start character, or attribute + # marker. + | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z) + + # Things that look like filenames + # The key thing is that there must be at least + # one special character (period, slash, or + # underscore). + | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+ + + # Things that have markup suppressed + # Don't process things like '\<' in \<tt>, though. + # TODO: including < is a hack, not very satisfying. + | \\[^\s<] + ) + + # labels for headings + (?:@[\w+%-]+(?:\.[\w|%-]+)?)? + )/x ## # Version of CROSSREF_REGEXP used when <tt>--hyperlink-all</tt> is specified. - ALL_CROSSREF_REGEXP = /( - # A::B::C.meth - #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR} + ALL_CROSSREF_REGEXP = / + (?:^|\s) + ( + (?: + # A::B::C.meth + #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR} - # Stand-alone method - | \\?#{METHOD_REGEXP_STR} + # Stand-alone method + | \\?#{METHOD_REGEXP_STR} - # A::B::C - | #{CLASS_REGEXP_STR}(?=[\s\)\.\?\!\,\;<\000]|\z) + # A::B::C + | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z) - # Things that look like filenames - | (?:\.\.\/)*[-\/\w]+[_\/\.][-\w\/\.]+ + # Things that look like filenames + | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+ - # Things that have markup suppressed - | \\[^\s<] - )/x + # Things that have markup suppressed + | \\[^\s<] + ) + + # labels for headings + (?:@[\w+%-]+)? + )/x + + ## + # Hash of references that have been looked-up to their replacements attr_accessor :seen @@ -93,6 +109,7 @@ class RDoc::CrossReference def initialize context @context = context + @store = context.store @seen = {} end @@ -107,16 +124,6 @@ class RDoc::CrossReference def resolve name, text return @seen[name] if @seen.include? name - # Find class, module, or method in class or module. - # - # Do not, however, use an if/elsif/else chain to do so. Instead, test - # each possible pattern until one matches. The reason for this is that a - # string like "YAML.txt" could be the txt() class method of class YAML (in - # which case it would match the first pattern, which splits the string - # into container and method components and looks up both) or a filename - # (in which case it would match the last pattern, which just checks - # whether the string as a whole is a known symbol). - if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then type = $2 type = '' if type == '.' # will find either #method or ::method @@ -141,12 +148,15 @@ class RDoc::CrossReference ref = case name when /^\\(#{CLASS_REGEXP_STR})$/o then - ref = @context.find_symbol $1 + @context.find_symbol $1 else - ref = @context.find_symbol name + @context.find_symbol name end unless ref - ref = nil if RDoc::Alias === ref # external alias: can't link to it + # Try a page name + ref = @store.page name if not ref and name =~ /^\w+$/ + + ref = nil if RDoc::Alias === ref # external alias, can't link to it out = if name == '\\' then name diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index ab752ee665..0b1ec6728e 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -1,7 +1,5 @@ # coding: US-ASCII -require 'rdoc' - ## # This class is a wrapper around File IO and Encoding that helps RDoc load # files and convert them to the correct encoding. @@ -27,26 +25,40 @@ module RDoc::Encoding RDoc::Encoding.set_encoding content if Object.const_defined? :Encoding then - encoding ||= Encoding.default_external - orig_encoding = content.encoding - - if utf8 then - content.force_encoding Encoding::UTF_8 - content.encode! encoding - else - # assume the content is in our output encoding - content.force_encoding encoding - end - - unless content.valid_encoding? then - # revert and try to transcode - content.force_encoding orig_encoding - content.encode! encoding - end - - unless content.valid_encoding? then - warn "unable to convert #{filename} to #{encoding}, skipping" - content = nil + begin + encoding ||= Encoding.default_external + orig_encoding = content.encoding + + if utf8 then + content.force_encoding Encoding::UTF_8 + content.encode! encoding + else + # assume the content is in our output encoding + content.force_encoding encoding + end + + unless content.valid_encoding? then + # revert and try to transcode + content.force_encoding orig_encoding + content.encode! encoding + end + + unless content.valid_encoding? then + warn "unable to convert #{filename} to #{encoding}, skipping" + content = nil + end + rescue Encoding::InvalidByteSequenceError, + Encoding::UndefinedConversionError => e + if force_transcode then + content.force_encoding orig_encoding + content.encode!(encoding, + :invalid => :replace, :undef => :replace, + :replace => '?') + return content + else + warn "unable to convert #{e.message} for #{filename}, skipping" + return nil + end end end @@ -55,15 +67,6 @@ module RDoc::Encoding raise unless e.message =~ /unknown encoding name - (.*)/ warn "unknown encoding name \"#{$1}\" for #{filename}, skipping" nil - rescue Encoding::UndefinedConversionError => e - if force_transcode then - content.force_encoding orig_encoding - content.encode! encoding, :undef => :replace, :replace => '?' - content - else - warn "unable to convert #{e.message} for #{filename}, skipping" - nil - end rescue Errno::EISDIR, Errno::ENOENT nil end diff --git a/lib/rdoc/erb_partial.rb b/lib/rdoc/erb_partial.rb new file mode 100644 index 0000000000..910d1e0351 --- /dev/null +++ b/lib/rdoc/erb_partial.rb @@ -0,0 +1,18 @@ +## +# Allows an ERB template to be rendered in the context (binding) of an +# existing ERB template evaluation. + +class RDoc::ERBPartial < ERB + + ## + # Overrides +compiler+ startup to set the +eoutvar+ to an empty string only + # if it isn't already set. + + def set_eoutvar compiler, eoutvar = '_erbout' + super + + compiler.pre_cmd = ["#{eoutvar} ||= ''"] + end + +end + diff --git a/lib/rdoc/extend.rb b/lib/rdoc/extend.rb new file mode 100644 index 0000000000..2bccfba084 --- /dev/null +++ b/lib/rdoc/extend.rb @@ -0,0 +1,117 @@ +## +# A Module extension in a class with \#extend + +class RDoc::Extend < RDoc::CodeObject + + ## + # Name of extension module + + attr_accessor :name + + ## + # Creates a new Extend for +name+ with +comment+ + + def initialize(name, comment) + super() + @name = name + self.comment = comment + @module = nil # cache for module if found + end + + ## + # Extends are sorted by name + + def <=> other + return unless self.class === other + + name <=> other.name + end + + def == other # :nodoc: + self.class === other and @name == other.name + end + + alias eql? == + + ## + # Full name based on #module + + def full_name + m = self.module + RDoc::ClassModule === m ? m.full_name : @name + end + + def hash # :nodoc: + [@name, self.module].hash + end + + def inspect # :nodoc: + "#<%s:0x%x %s.extend %s>" % [ + self.class, + object_id, + parent_name, @name, + ] + end + + ## + # Attempts to locate the extend module object. Returns the name if not + # known. + # + # The scoping rules of Ruby to resolve the name of an extension module are: + # - first look into the children of the current context; + # - if not found, look into the children of extension modules, + # in reverse extend order; + # - if still not found, go up the hierarchy of names. + # + # This method has <code>O(n!)</code> behavior when the module calling + # extend is referencing nonexistent modules. Avoid calling #module until + # after all the files are parsed. This behavior is due to ruby's constant + # lookup behavior. + + def module + return @module if @module + + # search the current context + return @name unless parent + full_name = parent.child_name(@name) + @module = @store.modules_hash[full_name] + return @module if @module + return @name if @name =~ /^::/ + + # search the includes before this one, in reverse order + searched = parent.extends.take_while { |i| i != self }.reverse + searched.each do |i| + ext = i.module + next if String === ext + full_name = ext.child_name(@name) + @module = @store.modules_hash[full_name] + return @module if @module + end + + # go up the hierarchy of names + up = parent.parent + while up + full_name = up.child_name(@name) + @module = @store.modules_hash[full_name] + return @module if @module + up = up.parent + end + + @name + end + + ## + # Sets the store for this class or module and its contained code objects. + + def store= store + super + + @file = @store.add_file @file.full_name if @file + end + + def to_s # :nodoc: + "extend #@name in: #{parent}" + end + +end + diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb index 2fa891f533..9051f8a658 100644 --- a/lib/rdoc/generator.rb +++ b/lib/rdoc/generator.rb @@ -1,12 +1,10 @@ -require 'rdoc' - ## # RDoc uses generators to turn parsed source code in the form of an # RDoc::CodeObject tree into some form of output. RDoc comes with the HTML # generator RDoc::Generator::Darkfish and an ri data generator # RDoc::Generator::RI. # -# = Registering a Generator +# == Registering a Generator # # Generators are registered by calling RDoc::RDoc.add_generator with the class # of the generator: @@ -15,26 +13,38 @@ require 'rdoc' # RDoc::RDoc.add_generator self # end # -# = Adding Options to +rdoc+ +# == Adding Options to +rdoc+ # # Before option processing in +rdoc+, RDoc::Options will call ::setup_options # on the generator class with an RDoc::Options instance. The generator can # use RDoc::Options#option_parser to add command-line options to the +rdoc+ -# tool. See OptionParser for details on how to add options. +# tool. See RDoc::Options@Custom+Options for an example and see OptionParser +# for details on how to add options. # # You can extend the RDoc::Options instance with additional accessors for your # generator. # -# = Generator Instantiation +# == Generator Instantiation # # After parsing, RDoc::RDoc will instantiate a generator by calling -# #initialize with an RDoc::Options instance. +# #initialize with an RDoc::Store instance and an RDoc::Options instance. +# +# The RDoc::Store instance holds documentation for parsed source code. In +# RDoc 3 and earlier the RDoc::TopLevel class held this data. When upgrading +# a generator from RDoc 3 and earlier you should only need to replace +# RDoc::TopLevel with the store instance. # -# RDoc will then call #generate on the generator instance and pass in an Array -# of RDoc::TopLevel instances, each representing a parsed file. You can use -# the various class methods on RDoc::TopLevel and in the RDoc::CodeObject tree -# to create your desired output format. +# RDoc will then call #generate on the generator instance. You can use the +# various methods on RDoc::Store and in the RDoc::CodeObject tree to create +# your desired output format. module RDoc::Generator + + autoload :Markup, 'rdoc/generator/markup' + + autoload :Darkfish, 'rdoc/generator/darkfish' + autoload :JsonIndex, 'rdoc/generator/json_index' + autoload :RI, 'rdoc/generator/ri' + end diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index a3ffea0ce8..bd0f617d84 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -1,9 +1,8 @@ # -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*- -require 'pathname' +require 'erb' require 'fileutils' -require 'rdoc/erbio' - +require 'pathname' require 'rdoc/generator/markup' ## @@ -46,6 +45,11 @@ require 'rdoc/generator/markup' # 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 @@ -53,6 +57,7 @@ class RDoc::Generator::Darkfish include ERB::Util + ## # Path to this file's parent directory. Used to find templates and other # resources. @@ -61,7 +66,7 @@ class RDoc::Generator::Darkfish ## # Release Version - VERSION = '2' + VERSION = '3' ## # Description of this generator @@ -69,19 +74,58 @@ class RDoc::Generator::Darkfish DESCRIPTION = 'HTML generator, written by Michael Granger' ## - # Initialize a few instance variables before we start + # The relative path to style sheets and javascript. By default this is set + # the same as the rel_prefix. - def initialize options - @options = options + attr_accessor :asset_rel_path - @template_dir = Pathname.new options.template_dir - @template_cache = {} + ## + # The path to generate files into, combined with <tt>--op</tt> from the + # options for a full path. - @files = nil - @classes = nil + attr_reader :base_dir - @basedir = Pathname.pwd.expand_path - end + ## + # 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 output directory @@ -89,6 +133,29 @@ class RDoc::Generator::Darkfish 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 @@ -126,7 +193,7 @@ class RDoc::Generator::Darkfish def write_style_sheet debug_msg "Copying static files" - options = { :verbose => $DEBUG_RDOC, :noop => @options.dry_run } + options = { :verbose => $DEBUG_RDOC, :noop => @dry_run } FileUtils.cp @template_dir + 'rdoc.css', '.', options @@ -134,7 +201,7 @@ class RDoc::Generator::Darkfish next if File.directory? path next if File.basename(path) =~ /^\./ - dst = Pathname.new(path).relative_path_from @template_dir + dst = Pathname.new(path).relative_path_from @template_dir # I suck at glob dst_dir = dst.dirname @@ -148,19 +215,17 @@ class RDoc::Generator::Darkfish # Build the initial indices and output objects based on an array of TopLevel # objects containing the extracted information. - def generate top_levels - @outputdir = Pathname.new(@options.op_dir).expand_path(@basedir) - - @files = top_levels.sort - @classes = RDoc::TopLevel.all_classes_and_modules.sort - @methods = @classes.map { |m| m.method_list }.flatten.sort - @modsort = get_sorted_module_list(@classes) + def generate + setup - # Now actually write the output write_style_sheet generate_index generate_class_files generate_file_files + generate_table_of_contents + @json_index.generate + + copy_static rescue => e debug_msg "%s: %s\n %s" % [ @@ -170,42 +235,64 @@ class RDoc::Generator::Darkfish raise end - protected - ## - # Return a list of the documented modules sorted by salience first, then - # by name. + # Copies static files from the static_path into the output directory + + def copy_static + return if @options.static_path.empty? - def get_sorted_module_list(classes) - nscounts = classes.inject({}) do |counthash, klass| - top_level = klass.full_name.gsub(/::.*/, '') - counthash[top_level] ||= 0 - counthash[top_level] += 1 + fu_options = { :verbose => $DEBUG_RDOC, :noop => @dry_run } - counthash + @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 - # Sort based on how often the top level namespace occurs, and then on the - # name of the module -- this works for projects that put their stuff into - # a namespace, of course, but doesn't hurt if they don't. - classes.sort_by do |klass| - top_level = klass.full_name.gsub( /::.*/, '' ) - [nscounts[top_level] * -1, klass.full_name] - end.select do |klass| + ## + # 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 + 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 = @basedir + @options.op_dir + 'index.html' + 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 @@ -217,10 +304,40 @@ class RDoc::Generator::Darkfish end ## - # Generate a documentation file for each class + # 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 - template_file = @template_dir + 'classpage.rhtml' + 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}" @@ -228,14 +345,8 @@ class RDoc::Generator::Darkfish @classes.each do |klass| current = klass - debug_msg " working on %s (%s)" % [klass.full_name, klass.path] - out_file = @outputdir + klass.path - # suppress 1.9.3 warning - rel_prefix = rel_prefix = @outputdir.relative_path_from(out_file.dirname) - svninfo = svninfo = self.get_svninfo(klass) - debug_msg " rendering #{out_file}" - render_template template_file, out_file do |io| binding end + generate_class klass, template_file end rescue => e error = RDoc::Error.new \ @@ -249,19 +360,56 @@ class RDoc::Generator::Darkfish # Generate a documentation file for each file def generate_file_files - template_file = @template_dir + 'filepage.rhtml' - return unless template_file.exist? + 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| - out_file = @outputdir + file.path + 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 - rel_prefix = rel_prefix = @outputdir.relative_path_from(out_file.dirname) + 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 - debug_msg " rendering #{out_file}" render_template template_file, out_file do |io| binding end end rescue => e @@ -273,6 +421,134 @@ class RDoc::Generator::Darkfish 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 path + setup + + template_file = @template_dir + 'servlet_not_found.rhtml' + return unless template_file.exist? + + debug_msg "Rendering the servlet root 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_root: #{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 = 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 = '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 + + ## + # 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. @@ -325,6 +601,46 @@ class RDoc::Generator::Darkfish end ## + # Creates a template from its components and the +body_file+. + # + # For backwards compatibility, if +body_file+ contains "<html" the body is + # used directly. + + def assemble_template body_file + body = body_file.read + return body if body =~ /<html/ + + head_file = @template_dir + '_head.rhtml' + footer_file = @template_dir + '_footer.rhtml' + + <<-TEMPLATE +<!DOCTYPE html> + +<html> +<head> +#{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+. # @@ -332,28 +648,33 @@ class RDoc::Generator::Darkfish # # An io will be yielded which must be captured by binding in the caller. - def render_template template_file, out_file # :yield: io - template = template_for template_file + 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 - unless @options.dry_run then + 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 + @context = yield io - template_result template, context, template_file + template_result template, @context, template_file end else - context = yield nil + @context = yield nil - output = template_result template, context, template_file + 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 @@ -374,14 +695,25 @@ class RDoc::Generator::Darkfish ## # Retrieves a cache template for +file+, if present, or fills the cache. - def template_for file + def template_for file, page = true, klass = ERB template = @template_cache[file] return template if template - klass = @options.dry_run ? ERB : RDoc::ERBIO + template = if page then + assemble_template file + else + file.read + end + + erbout = if page then + 'io' + else + file_var = File.basename(file).sub(/\..*/, '') + "_erbout_#{file_var}" + end - template = klass.new file.read, nil, '<>' + template = klass.new template, nil, '<>', erbout @template_cache[file] = template template end diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb new file mode 100644 index 0000000000..c303b2effb --- /dev/null +++ b/lib/rdoc/generator/json_index.rb @@ -0,0 +1,248 @@ +require 'json' + +## +# 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 + + ## + # 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/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb index c267bb1c13..3b3546690e 100644 --- a/lib/rdoc/generator/markup.rb +++ b/lib/rdoc/generator/markup.rb @@ -1,14 +1,8 @@ -# This file is loaded by generators. It allows RDoc's CodeObject tree to -# avoid loading generator code to increase startup time (for ri). - -require 'rdoc/text' -require 'rdoc/code_objects' -require 'rdoc/generator' -require 'rdoc/markup/to_html_crossref' -require 'rdoc/ruby_token' - ## # 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 @@ -39,18 +33,18 @@ module RDoc::Generator::Markup def formatter return @formatter if defined? @formatter - show_hash = RDoc::RDoc.current.options.show_hash - hyperlink_all = RDoc::RDoc.current.options.hyperlink_all + options = @store.rdoc.options this = RDoc::Context === self ? self : @parent - @formatter = RDoc::Markup::ToHtmlCrossref.new(this.path, this, show_hash, - hyperlink_all) + @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 - # sprintf'd into +url+ instead. + # will replace the %s using sprintf on the +url+. def cvs_url(url, full_path) if /%s/ =~ url then @@ -62,10 +56,14 @@ module RDoc::Generator::Markup end -class RDoc::AnyMethod +class RDoc::CodeObject include RDoc::Generator::Markup +end + +class RDoc::MethodAttr + @add_line_numbers = false class << self @@ -82,7 +80,8 @@ class RDoc::AnyMethod # # # File xxxxx, line dddd # - # If it has, line numbers are added an ', line dddd' is removed. + # If it has this comment then line numbers are added to +src+ and the <tt>, + # line dddd</tt> portion of the comment is removed. def add_line_numbers(src) return unless src.sub!(/\A(.*)(, line (\d+))/, '\1') @@ -111,32 +110,7 @@ class RDoc::AnyMethod def markup_code return '' unless @token_stream - src = "" - - @token_stream.each do |t| - next unless t - - style = case t - when RDoc::RubyToken::TkCONSTANT then 'ruby-constant' - when RDoc::RubyToken::TkKW then 'ruby-keyword' - when RDoc::RubyToken::TkIVAR then 'ruby-ivar' - when RDoc::RubyToken::TkOp then 'ruby-operator' - when RDoc::RubyToken::TkId then 'ruby-identifier' - when RDoc::RubyToken::TkNode then 'ruby-node' - when RDoc::RubyToken::TkCOMMENT then 'ruby-comment' - when RDoc::RubyToken::TkREGEXP then 'ruby-regexp' - when RDoc::RubyToken::TkSTRING then 'ruby-string' - when RDoc::RubyToken::TkVal then 'ruby-value' - end - - text = CGI.escapeHTML t.text - - if style then - src << "<span class=\"#{style}\">#{text}</span>" - else - src << text - end - end + src = RDoc::TokenStream.to_html @token_stream # dedent the source indent = src.length @@ -151,34 +125,21 @@ class RDoc::AnyMethod end src.gsub!(/^#{' ' * indent}/, '') if indent > 0 - add_line_numbers(src) if self.class.add_line_numbers + add_line_numbers(src) if RDoc::MethodAttr.add_line_numbers src end end -class RDoc::Attr +class RDoc::ClassModule - include RDoc::Generator::Markup - -end - -class RDoc::Alias - - include RDoc::Generator::Markup - -end - -class RDoc::Constant - - include RDoc::Generator::Markup - -end - -class RDoc::Context + ## + # Handy wrapper for marking up this class or module's comment - include RDoc::Generator::Markup + def description + markup @comment_location + end end @@ -195,7 +156,7 @@ class RDoc::TopLevel # command line option to set. def cvs_url - url = RDoc::RDoc.current.options.webcvs + url = @store.rdoc.options.webcvs if /%s/ =~ url then url % @absolute_name diff --git a/lib/rdoc/generator/ri.rb b/lib/rdoc/generator/ri.rb index 939a165cfb..b9c4141a5e 100644 --- a/lib/rdoc/generator/ri.rb +++ b/lib/rdoc/generator/ri.rb @@ -1,6 +1,3 @@ -require 'rdoc/generator' -require 'rdoc/ri' - ## # Generates ri data files @@ -16,70 +13,17 @@ class RDoc::Generator::RI ## # Set up a new ri generator - def initialize options #:not-new: - @options = options - @old_siginfo = nil - @current = nil - - @store = RDoc::RI::Store.new '.' - @store.dry_run = @options.dry_run - @store.encoding = @options.encoding if @options.respond_to? :encoding - end - - ## - # Build the initial indices and output objects based on an array of TopLevel - # objects containing the extracted information. - - def generate top_levels - install_siginfo_handler - - @store.load_cache - - RDoc::TopLevel.all_classes_and_modules.each do |klass| - @current = "#{klass.class}: #{klass.full_name}" - - @store.save_class klass - - klass.each_method do |method| - @current = "#{method.class}: #{method.full_name}" - @store.save_method klass, method - end - - klass.each_attribute do |attribute| - @store.save_method klass, attribute - end - end - - @current = 'saving cache' - - @store.save_cache - - ensure - @current = nil - - remove_siginfo_handler + def initialize store, options #:not-new: + @options = options + @store = store + @store.path = '.' end ## - # Installs a siginfo handler that prints the current filename. - - def install_siginfo_handler - return unless Signal.list.key? 'INFO' - - @old_siginfo = trap 'INFO' do - puts @current if @current - end - end - - ## - # Removes a siginfo handler and replaces the previous - - def remove_siginfo_handler - return unless Signal.list.key? 'INFO' - - handler = @old_siginfo || 'DEFAULT' + # Writes the parsed data store to disk for use by ri. - trap 'INFO', handler + def generate + @store.save end end diff --git a/lib/rdoc/generator/template/darkfish/_footer.rhtml b/lib/rdoc/generator/template/darkfish/_footer.rhtml new file mode 100644 index 0000000000..0736c335ba --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_footer.rhtml @@ -0,0 +1,5 @@ +<footer id="validator-badges"> + <p><a href="http://validator.w3.org/check/referer">[Validate]</a> + <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> <%= RDoc::VERSION %>. + <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %>. +</footer> diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml new file mode 100644 index 0000000000..f3d82a37f6 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_head.rhtml @@ -0,0 +1,16 @@ +<meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type"> + +<title><%= h @title %></title> + +<link type="text/css" media="screen" href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet"> + +<script type="text/javascript"> + var rdoc_rel_prefix = "<%= rel_prefix %>/"; +</script> + +<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/jquery.js"></script> +<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/navigation.js"></script> +<script type="text/javascript" charset="utf-8" src="<%= search_index_rel_prefix %>/js/search_index.js"></script> +<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/search.js"></script> +<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/searcher.js"></script> +<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/darkfish.js"></script> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml new file mode 100644 index 0000000000..93d57f39f6 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml @@ -0,0 +1,18 @@ +<% if !svninfo.empty? then %> +<nav id="file-svninfo-section" class="section"> + <h3 class="section-header">VCS Info</h3> + <div class="section-body"> + <dl class="svninfo"> + <dt>Rev + <dd><%= svninfo[:rev] %> + + <dt>Last Checked In + <dd><%= svninfo[:commitdate].strftime('%Y-%m-%d %H:%M:%S') %> + (<%= svninfo[:commitdelta] %> ago) + + <dt>Checked in by + <dd><%= svninfo[:committer] %> + </dl> + </div> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml new file mode 100644 index 0000000000..efa202fa18 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml @@ -0,0 +1,9 @@ +<nav id="classindex-section" class="section project-section"> + <h3 class="section-header">Class and Module Index</h3> + + <ul class="link-list"> + <% @modsort.each do |index_klass| %> + <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a> + <% end %> + </ul> +</nav> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml new file mode 100644 index 0000000000..19273829a0 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml @@ -0,0 +1,16 @@ +<% unless klass.extends.empty? then %> +<!-- Extension Modules --> +<nav id="extends-section" class="section"> + <h3 class="section-header">Extended With Modules</h3> + + <ul class="link-list"> + <% klass.each_extend do |ext| %> + <% unless String === ext.module then %> + <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a> + <% else %> + <li><span class="extend"><%= ext.name %></span> + <% end %> + <% end %> + </ul> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml new file mode 100644 index 0000000000..c4ae216a14 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml @@ -0,0 +1,8 @@ +<nav id="file-list-section" class="section"> + <h3 class="section-header">Defined In</h3> + <ul> +<% klass.in_files.each do |tl| %> + <li><%= h tl.absolute_name %> +<% end %> + </ul> +</nav> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml new file mode 100644 index 0000000000..5494f1f5f8 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml @@ -0,0 +1,16 @@ +<% unless klass.includes.empty? then %> +<!-- Included Modules --> +<nav id="includes-section" class="section"> + <h3 class="section-header">Included Modules</h3> + + <ul class="link-list"> + <% klass.each_include do |inc| %> + <% unless String === inc.module then %> + <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a> + <% else %> + <li><span class="include"><%= inc.name %></span> + <% end %> + <% end %> + </ul> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml new file mode 100644 index 0000000000..45a3048e84 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml @@ -0,0 +1,14 @@ +<nav id="home-section" class="section"> + <h3 class="section-header">Documentation</h3> + + <ul> + <% installed.each do |name, href, exists| %> + <li class="folder"> + <% if exists then %> + <a href="<%= href %>"><%= h name %></a> + <% else %> + <%= h name %> + <% end %> + <% end %> + </ul> +</nav> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml new file mode 100644 index 0000000000..88e2734819 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml @@ -0,0 +1,12 @@ +<% unless klass.method_list.empty? then %> +<!-- Method Quickref --> +<nav id="method-list-section" class="section"> + <h3 class="section-header">Methods</h3> + + <ul class="link-list"> + <% klass.each_method do |meth| %> + <li <% if meth.calls_super %>class="calls-super" <% end %>><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= h meth.name %></a> + <% end %> + </ul> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml new file mode 100644 index 0000000000..fdeb6aed9f --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml @@ -0,0 +1,7 @@ +<nav id="home-section" class="section"> + <h3 class="section-header"> + <a href="<%= rel_prefix %>/index.html">Home</a> + <a href="<%= rel_prefix %>/table_of_contents.html#classes">Classes</a> + <a href="<%= rel_prefix %>/table_of_contents.html#methods">Methods</a> + </h3> +</nav> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml new file mode 100644 index 0000000000..2089387c51 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml @@ -0,0 +1,12 @@ +<% simple_files = @files.select { |f| f.text? } %> +<% unless simple_files.empty? then %> +<nav id="fileindex-section" class="section project-section"> + <h3 class="section-header">Pages</h3> + + <ul> + <% simple_files.each do |f| %> + <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a> + <% end %> + </ul> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml new file mode 100644 index 0000000000..463f05a8d9 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml @@ -0,0 +1,10 @@ +<% if klass.type == 'class' then %> +<nav id="parent-class-section" class="section"> + <h3 class="section-header">Parent</h3> + <% if klass.superclass and not String === klass.superclass then %> + <p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a> + <% else %> + <p class="link"><%= klass.superclass %> + <% end %> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml new file mode 100644 index 0000000000..f3275783d0 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml @@ -0,0 +1,10 @@ +<nav id="search-section" class="section project-section" class="initially-hidden"> + <form action="#" method="get" accept-charset="utf-8"> + <h3 class="section-header"> + <input type="text" name="search" placeholder="Search" id="search-field" + title="Type to search, Up and Down to navigate, Enter to load"> + </h3> + </form> + + <ul id="search-results" class="initially-hidden"></ul> +</nav> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml new file mode 100644 index 0000000000..726423a341 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml @@ -0,0 +1,10 @@ +<% unless klass.sections.length == 1 then %> +<nav id="sections-section" class="section"> + <h3 class="section-header">Sections</h3> + <ul class="link-list"> + <% klass.sort_sections.each do |section| %> + <li><a href="#<%= section.aref %>"><%= h section.title %></a></li> + <% end %> + </ul> +</nav> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml new file mode 100644 index 0000000000..225f811f0e --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml @@ -0,0 +1,13 @@ +<% table = current.parse(current.comment).table_of_contents + if table.length > 1 then %> +<div id="table-of-contents"> + <nav class="section"> + <h3 class="section-header">Table of Contents</h3> + <ul> +<% table.each do |heading| %> + <li><a href="#<%= heading.aref %>"><%= heading.plain_html %></a> +<% end %> + </ul> + </nav> +</div> +<% end %> diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml new file mode 100644 index 0000000000..c7e52e6808 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/class.rhtml @@ -0,0 +1,179 @@ +<body id="top" class="<%= klass.type %>"> +<nav id="metadata"> + <%= render '_sidebar_navigation.rhtml' %> + + <%= render '_sidebar_search.rhtml' %> + + <%= render '_sidebar_table_of_contents.rhtml' %> + + <div id="file-metadata"> + <%= render '_sidebar_in_files.rhtml' %> + <%= render '_sidebar_VCS_info.rhtml' %> + </div> + + <div id="class-metadata"> + <%= render '_sidebar_sections.rhtml' %> + <%= render '_sidebar_parent.rhtml' %> + <%= render '_sidebar_includes.rhtml' %> + <%= render '_sidebar_extends.rhtml' %> + <%= render '_sidebar_methods.rhtml' %> + </div> + + <div id="project-metadata"> + <%= render '_sidebar_pages.rhtml' %> + <%= render '_sidebar_classes.rhtml' %> + </div> +</nav> + +<div id="documentation"> + <h1 class="<%= klass.type %>"><%= klass.type %> <%= klass.full_name %></h1> + + <div id="description" class="description"> + <%= klass.description %> + </div><!-- description --> + + <% klass.each_section do |section, constants, attributes| %> + <% constants = constants.select { |const| const.display? } %> + <% attributes = attributes.select { |attr| attr.display? } %> + <section id="<%= section.aref %>" class="documentation-section"> + <% if section.title then %> + <div class="documentation-section-title"> + <h2 class="section-header"> + <%= section.title %> + </h2> + <span class="section-click-top"> + <a href="#top">↑ top</a> + </span> + </div> + <% end %> + + <% if section.comment then %> + <div class="description"> + <%= section.description %> + </div> + <% end %> + + <% unless constants.empty? then %> + <!-- Constants --> + <section id="constants-list" class="section"> + <h3 class="section-header">Constants</h3> + <dl> + <% constants.each do |const| %> + <dt id="<%= const.name %>"><%= const.name %> + <% if const.comment then %> + <dd class="description"><%= const.description.strip %> + <% else %> + <dd class="description missing-docs">(Not documented) + <% end %> + <% end %> + </dl> + </section> + <% end %> + + <% unless attributes.empty? then %> + <!-- Attributes --> + <section id="attribute-method-details" class="method-section section"> + <h3 class="section-header">Attributes</h3> + + <% attributes.each do |attrib| %> + <div id="<%= attrib.aref %>" class="method-detail"> + <div class="method-heading attribute-method-heading"> + <span class="method-name"><%= h attrib.name %></span><span + class="attribute-access-type">[<%= attrib.rw %>]</span> + </div> + + <div class="method-description"> + <% if attrib.comment then %> + <%= attrib.description.strip %> + <% else %> + <p class="missing-docs">(Not documented) + <% end %> + </div> + </div> + <% end %> + </section><!-- attribute-method-details --> + <% end %> + + <!-- Methods --> + <% klass.methods_by_type(section).each do |type, visibilities| + next if visibilities.empty? + visibilities.each do |visibility, methods| + next if methods.empty? %> + <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section section"> + <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3> + + <% methods.each do |method| %> + <div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>"> + <% if method.call_seq then %> + <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %> + <div class="method-heading"> + <span class="method-callseq"> + <%= h(call_seq.strip. + gsub( /^\w+\./m, '')). + gsub(/(.*)[-=]>/, '\1→') %> + </span> + <% if i == 0 and method.token_stream then %> + <span class="method-click-advice">click to toggle source</span> + <% end %> + </div> + <% end %> + <% else %> + <div class="method-heading"> + <span class="method-name"><%= h method.name %></span><span + class="method-args"><%= method.param_seq %></span> + <% if method.token_stream then %> + <span class="method-click-advice">click to toggle source</span> + <% end %> + </div> + <% end %> + + <div class="method-description"> + <% if method.comment then %> + <%= method.description.strip %> + <% else %> + <p class="missing-docs">(Not documented) + <% end %> + <% if method.calls_super then %> + <div class="method-calls-super"> + Calls superclass method + <%= + method.superclass_method ? + method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil + %> + </div> + <% end %> + + <% if method.token_stream then %> + <div class="method-source-code" id="<%= method.html_name %>-source"> + <pre><%= method.markup_code %></pre> + </div><!-- <%= method.html_name %>-source --> + <% end %> + </div> + + <% unless method.aliases.empty? then %> + <div class="aliases"> + Also aliased as: <%= method.aliases.map do |aka| + if aka.parent then # HACK lib/rexml/encodings + %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>} + else + h aka.name + end + end.join ", " %> + </div> + <% end %> + + <% if method.is_alias_for then %> + <div class="aliases"> + Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a> + </div> + <% end %> + </div><!-- <%= method.html_name %>-method --> + + <% end %> + </section><!-- <%= visibility %>-<%= type %>-method-details --> + <% end + end %> + </section><!-- <%= section.aref %> --> +<% end %> + +</div><!-- documentation --> diff --git a/lib/rdoc/generator/template/darkfish/classpage.rhtml b/lib/rdoc/generator/template/darkfish/classpage.rhtml deleted file mode 100644 index 9c74cacf0f..0000000000 --- a/lib/rdoc/generator/template/darkfish/classpage.rhtml +++ /dev/null @@ -1,321 +0,0 @@ -<?xml version="1.0" encoding="<%= @options.charset %>"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" /> - - <title><%= klass.type.capitalize %>: <%= klass.full_name %></title> - - <link rel="stylesheet" href="<%= rel_prefix %>/rdoc.css" type="text/css" media="screen" /> - - <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript" charset="utf-8"></script> - <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script> - <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript" charset="utf-8"></script> - <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript" charset="utf-8"></script> - -</head> -<body id="top" class="<%= klass.type %>"> - - <div id="metadata"> - <div id="home-metadata"> - <div id="home-section" class="section"> - <h3 class="section-header"> - <a href="<%= rel_prefix %>/index.html">Home</a> - <a href="<%= rel_prefix %>/index.html#classes">Classes</a> - <a href="<%= rel_prefix %>/index.html#methods">Methods</a> - </h3> - </div> - </div> - - <div id="file-metadata"> - <div id="file-list-section" class="section"> - <h3 class="section-header">In Files</h3> - <div class="section-body"> - <ul> - <% klass.in_files.each do |tl| %> - <li><a href="<%= rel_prefix %>/<%= h tl.path %>?TB_iframe=true&height=550&width=785" - class="thickbox" title="<%= h tl.absolute_name %>"><%= h tl.absolute_name %></a></li> - <% end %> - </ul> - </div> - </div> - - <% if !svninfo.empty? then %> - <div id="file-svninfo-section" class="section"> - <h3 class="section-header">Subversion Info</h3> - <div class="section-body"> - <dl class="svninfo"> - <dt>Rev</dt> - <dd><%= svninfo[:rev] %></dd> - - <dt>Last Checked In</dt> - <dd><%= svninfo[:commitdate].strftime('%Y-%m-%d %H:%M:%S') %> - (<%= svninfo[:commitdelta] %> ago)</dd> - - <dt>Checked in by</dt> - <dd><%= svninfo[:committer] %></dd> - </dl> - </div> - </div> - <% end %> - </div> - - <div id="class-metadata"> - <% if klass.type == 'class' then %> - <!-- Parent Class --> - <div id="parent-class-section" class="section"> - <h3 class="section-header">Parent</h3> - <% if klass.superclass and not String === klass.superclass then %> - <p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a></p> - <% else %> - <p class="link"><%= klass.superclass %></p> - <% end %> - </div> - <% end %> - - <% unless klass.sections.length == 1 then %> - <!-- Sections --> - <div id="sections-section" class="section"> - <h3 class="section-header">Sections</h3> - <ul class="link-list"> - <% klass.sections.sort_by { |s| s.title.to_s }.each do |section| %> - <li><a href="#<%= section.aref %>"><%= h section.title %></a></li> - <% end %> - </ul> - </div> - <% end %> - - <% unless klass.classes_and_modules.empty? then %> - <!-- Namespace Contents --> - <div id="namespace-list-section" class="section"> - <h3 class="section-header">Namespace</h3> - <ul class="link-list"> - <% (klass.modules.sort + klass.classes.sort).each do |mod| %> - <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= klass.aref_to mod.path %>"><%= mod.full_name %></a></li> - <% end %> - </ul> - </div> - <% end %> - - <% unless klass.method_list.empty? then %> - <!-- Method Quickref --> - <div id="method-list-section" class="section"> - <h3 class="section-header">Methods</h3> - <ul class="link-list"> - <% klass.each_method do |meth| %> - <li><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= meth.name %></a></li> - <% end %> - </ul> - </div> - <% end %> - - <% unless klass.includes.empty? then %> - <!-- Included Modules --> - <div id="includes-section" class="section"> - <h3 class="section-header">Included Modules</h3> - <ul class="link-list"> - <% klass.each_include do |inc| %> - <% unless String === inc.module then %> - <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li> - <% else %> - <li><span class="include"><%= inc.name %></span></li> - <% end %> - <% end %> - </ul> - </div> - <% end %> - </div> - - <div id="project-metadata"> - <% simple_files = @files.select {|tl| tl.parser == RDoc::Parser::Simple } %> - <% unless simple_files.empty? then %> - <div id="fileindex-section" class="section project-section"> - <h3 class="section-header">Files</h3> - <ul> - <% simple_files.each do |file| %> - <li class="file"><a href="<%= rel_prefix %>/<%= file.path %>"><%= h file.base_name %></a></li> - <% end %> - </ul> - </div> - <% end %> - - <div id="classindex-section" class="section project-section"> - <h3 class="section-header">Class/Module Index - <span class="search-toggle"><img src="<%= rel_prefix %>/images/find.png" - height="16" width="16" alt="[+]" - title="show/hide quicksearch" /></span></h3> - <form action="#" method="get" accept-charset="utf-8" class="initially-hidden"> - <fieldset> - <legend>Quicksearch</legend> - <input type="text" name="quicksearch" value="" - class="quicksearch-field" /> - </fieldset> - </form> - - <ul class="link-list"> - <% @modsort.each do |index_klass| %> - <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a></li> - <% end %> - </ul> - <div id="no-class-search-results" style="display: none;">No matching classes.</div> - </div> - - <% if $DEBUG_RDOC then %> - <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png" - alt="toggle debugging" height="16" width="16" /></div> - <% end %> - </div> - </div> - - <div id="documentation"> - <h1 class="<%= klass.type %>"><%= klass.full_name %></h1> - - <div id="description" class="description"> - <%= klass.description %> - </div><!-- description --> - - <% klass.each_section do |section, constants, attributes| %> - <% constants = constants.select { |const| const.display? } %> - <% attributes = attributes.select { |attr| attr.display? } %> - <div id="<%= section.aref %>" class="documentation-section"> - <% if section.title then %> - <h2 class="section-header"> - <%= section.title %> - <a href="#top">↑ top</a> - </h2> - <% end %> - - <% if section.comment then %> - <div class="description"> - <%= section.description %> - </div> - <% end %> - - <% unless constants.empty? then %> - <!-- Constants --> - <div id="constants-list" class="section"> - <h3 class="section-header">Constants</h3> - <dl> - <% constants.each do |const| %> - <dt><a name="<%= const.name %>"><%= const.name %></a></dt> - <% if const.comment then %> - <dd class="description"><%= const.description.strip %></dd> - <% else %> - <dd class="description missing-docs">(Not documented)</dd> - <% end %> - <% end %> - </dl> - </div> - <% end %> - - <% unless attributes.empty? then %> - <!-- Attributes --> - <div id="attribute-method-details" class="method-section section"> - <h3 class="section-header">Attributes</h3> - - <% attributes.each do |attrib| %> - <div id="<%= attrib.html_name %>-attribute-method" class="method-detail"> - <a name="<%= h attrib.name %>"></a> - <% if attrib.rw =~ /w/i then %> - <a name="<%= h attrib.name %>="></a> - <% end %> - <div class="method-heading attribute-method-heading"> - <span class="method-name"><%= h attrib.name %></span><span - class="attribute-access-type">[<%= attrib.rw %>]</span> - </div> - - <div class="method-description"> - <% if attrib.comment then %> - <%= attrib.description.strip %> - <% else %> - <p class="missing-docs">(Not documented)</p> - <% end %> - </div> - </div> - <% end %> - </div><!-- attribute-method-details --> - <% end %> - - <!-- Methods --> - <% klass.methods_by_type(section).each do |type, visibilities| - next if visibilities.empty? - visibilities.each do |visibility, methods| - next if methods.empty? %> - <div id="<%= visibility %>-<%= type %>-method-details" class="method-section section"> - <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3> - - <% methods.each do |method| %> - <div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>"> - <a name="<%= h method.aref %>"></a> - - <% if method.call_seq then %> - <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %> - <div class="method-heading"> - <span class="method-callseq"><%= call_seq.strip.gsub(/->/, '→').gsub( /^\w+\./m, '') %></span> - <% if i == 0 then %> - <span class="method-click-advice">click to toggle source</span> - <% end %> - </div> - <% end %> - <% else %> - <div class="method-heading"> - <span class="method-name"><%= h method.name %></span><span - class="method-args"><%= method.params %></span> - <span class="method-click-advice">click to toggle source</span> - </div> - <% end %> - - <div class="method-description"> - <% if method.comment then %> - <%= method.description.strip %> - <% else %> - <p class="missing-docs">(Not documented)</p> - <% end %> - - <% if method.token_stream then %> - <div class="method-source-code" id="<%= method.html_name %>-source"> -<pre> -<%= method.markup_code %> -</pre> - </div><!-- <%= method.html_name %>-source --> - <% end %> - </div> - - <% unless method.aliases.empty? then %> - <div class="aliases"> - Also aliased as: <%= method.aliases.map do |aka| - if aka.parent then # HACK lib/rexml/encodings - %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>} - else - h aka.name - end - end.join ", " %> - </div> - <% end %> - - <% if method.is_alias_for then %> - <div class="aliases"> - Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a> - </div> - <% end %> - </div><!-- <%= method.html_name %>-method --> - - <% end %> - </div><!-- <%= visibility %>-<%= type %>-method-details --> - <% end - end %> - </div><!-- <%= section.aref %> --> - <% end %> - - </div><!-- documentation --> - - <div id="validator-badges"> - <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> - <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish - Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p> - </div> - -</body> -</html> - diff --git a/lib/rdoc/generator/template/darkfish/filepage.rhtml b/lib/rdoc/generator/template/darkfish/filepage.rhtml deleted file mode 100644 index b230a456a3..0000000000 --- a/lib/rdoc/generator/template/darkfish/filepage.rhtml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" /> - - <title>File: <%= file.base_name %> [<%= @options.title %>]</title> - - <link type="text/css" media="screen" href="<%= rel_prefix %>/rdoc.css" rel="stylesheet" /> - - <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript" - charset="utf-8"></script> - <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript" - charset="utf-8"></script> - <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript" - charset="utf-8"></script> - <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript" - charset="utf-8"></script> -</head> - -<% if file.parser == RDoc::Parser::Simple %> -<body class="file"> - <div id="metadata"> - <div id="home-metadata"> - <div id="home-section" class="section"> - <h3 class="section-header"> - <a href="<%= rel_prefix %>/index.html">Home</a> - <a href="<%= rel_prefix %>/index.html#classes">Classes</a> - <a href="<%= rel_prefix %>/index.html#methods">Methods</a> - </h3> - </div> - </div> - - <div id="project-metadata"> - <% simple_files = @files.select { |f| f.parser == RDoc::Parser::Simple } %> - <% unless simple_files.empty? then %> - <div id="fileindex-section" class="section project-section"> - <h3 class="section-header">Files</h3> - <ul> - <% simple_files.each do |f| %> - <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.base_name %></a></li> - <% end %> - </ul> - </div> - <% end %> - - <div id="classindex-section" class="section project-section"> - <h3 class="section-header">Class Index - <span class="search-toggle"><img src="<%= rel_prefix %>/images/find.png" - height="16" width="16" alt="[+]" - title="show/hide quicksearch" /></span></h3> - <form action="#" method="get" accept-charset="utf-8" class="initially-hidden"> - <fieldset> - <legend>Quicksearch</legend> - <input type="text" name="quicksearch" value="" - class="quicksearch-field" /> - </fieldset> - </form> - - <ul class="link-list"> - <% @modsort.each do |index_klass| %> - <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a></li> - <% end %> - </ul> - <div id="no-class-search-results" style="display: none;">No matching classes.</div> - </div> - - <% if $DEBUG_RDOC %> - <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png" - alt="toggle debugging" height="16" width="16" /></div> - <% end %> - </div> - </div> - - <div id="documentation"> - <%= file.description %> - </div> - - <div id="validator-badges"> - <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> - <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish - Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p> - </div> -</body> -<% else %> -<body class="file file-popup"> - <div id="metadata"> - <dl> - <dt class="modified-date">Last Modified</dt> - <dd class="modified-date"><%= file.last_modified %></dd> - - <% if file.requires %> - <dt class="requires">Requires</dt> - <dd class="requires"> - <ul> - <% file.requires.each do |require| %> - <li><%= require.name %></li> - <% end %> - </ul> - </dd> - <% end %> - - <% if @options.webcvs %> - <dt class="scs-url">Trac URL</dt> - <dd class="scs-url"><a target="_top" - href="<%= file.cvs_url %>"><%= file.cvs_url %></a></dd> - <% end %> - </dl> - </div> - - <div id="documentation"> - <% if file.comment %> - <div class="description"> - <h2>Description</h2> - <%= file.description %> - </div> - <% end %> - </div> -</body> -<% end %> -</html> - diff --git a/lib/rdoc/generator/template/darkfish/images/add.png b/lib/rdoc/generator/template/darkfish/images/add.png Binary files differnew file mode 100755 index 0000000000..6332fefea4 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/images/add.png diff --git a/lib/rdoc/generator/template/darkfish/images/arrow_up.png b/lib/rdoc/generator/template/darkfish/images/arrow_up.png Binary files differnew file mode 100755 index 0000000000..1ebb193243 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/images/arrow_up.png diff --git a/lib/rdoc/generator/template/darkfish/images/delete.png b/lib/rdoc/generator/template/darkfish/images/delete.png Binary files differnew file mode 100755 index 0000000000..08f249365a --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/images/delete.png diff --git a/lib/rdoc/generator/template/darkfish/images/tag_blue.png b/lib/rdoc/generator/template/darkfish/images/tag_blue.png Binary files differnew file mode 100755 index 0000000000..3f02b5f8f8 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/images/tag_blue.png diff --git a/lib/rdoc/generator/template/darkfish/images/transparent.png b/lib/rdoc/generator/template/darkfish/images/transparent.png Binary files differnew file mode 100644 index 0000000000..d665e179ef --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/images/transparent.png diff --git a/lib/rdoc/generator/template/darkfish/index.rhtml b/lib/rdoc/generator/template/darkfish/index.rhtml index 3198246f8a..d076c2a252 100644 --- a/lib/rdoc/generator/template/darkfish/index.rhtml +++ b/lib/rdoc/generator/template/darkfish/index.rhtml @@ -1,64 +1,19 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<body> +<nav id="metadata"> + <%= render '_sidebar_navigation.rhtml' %> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> -<head> - <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" /> + <%= render '_sidebar_search.rhtml' %> - <title><%= h @options.title %></title> - - <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" /> - - <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script> - <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script> - <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script> - <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script> - -</head> -<body class="indexpage"> - - <% $stderr.sync = true %> - <h1><%= h @options.title %></h1> - - <% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %> - <div id="main"> - <%= main_page.description.sub(%r{^\s*<h1.*?/h1>}i, '') %> - </div> - <% else %> - <p>This is the API documentation for '<%= @options.title %>'.</p> - <% end %> - - <% simple_files = @files.select {|tl| tl.parser == RDoc::Parser::Simple } %> - <% unless simple_files.empty? then %> - <h2>Files</h2> - <ul> - <% simple_files.sort.each do |file| %> - <li class="file"><a href="<%= file.path %>"><%= h file.base_name %></a></li> - <% end %> - </ul> - <% end %> - - <h2 id="classes">Classes/Modules</h2> - <ul> - <% @modsort.each do |klass| %> - <li class="<%= klass.type %>"><a href="<%= klass.path %>"><%= klass.full_name %></a></li> - <% end %> - </ul> - - <h2 id="methods">Methods</h2> - <ul> - <% RDoc::TopLevel.all_classes_and_modules.map do |mod| - mod.method_list - end.flatten.sort.each do |method| %> - <li><a href="<%= method.path %>"><%= method.pretty_name %> — <%= method.parent.full_name %></a></li> - <% end %> - </ul> - - <div id="validator-badges"> - <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> - <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish - Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p> + <div id="project-metadata"> + <%= render '_sidebar_pages.rhtml' %> + <%= render '_sidebar_classes.rhtml' %> </div> -</body> -</html> +</nav> + +<div id="documentation" class="description"> +<% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %> +<%= main_page.description %> +<% else %> +<p>This is the API documentation for <%= @title %>. +<% end %> +</div> diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js index 84565c1e2d..4be722fac3 100644 --- a/lib/rdoc/generator/template/darkfish/js/darkfish.js +++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js @@ -9,12 +9,12 @@ /* Provide console simulation for firebug-less environments */ if (!("console" in window) || !("firebug" in console)) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + 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() {}; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; }; @@ -23,94 +23,131 @@ if (!("console" in window) || !("firebug" in console)) { */ $.fn.unwrap = function( expr ) { return this.each( function() { - $(this).parents( expr ).eq( 0 ).after( this ).remove(); + $(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(); + 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-description,.method-heading').click( showSource ); + $('.method-heading').click( showSource ); }; function toggleDebuggingSection() { - $('.debugging-section').slideToggle(); + $('.debugging-section').slideToggle(); }; function hookDebuggingToggle() { - $('#debugging-toggle img').click( toggleDebuggingSection ); + $('#debugging-toggle img').click( toggleDebuggingSection ); }; -function hookQuickSearch() { - $('.quicksearch-field').each( function() { - var searchElems = $(this).parents('.section').find( 'li' ); - var toggle = $(this).parents('.section').find('h3 .search-toggle'); - // console.debug( "Toggle is: %o", toggle ); - var qsbox = $(this).parents('form').get( 0 ); - - $(this).quicksearch( this, searchElems, { - noSearchResultsIndicator: 'no-class-search-results', - focusOnLoad: false - }); - $(toggle).click( function() { - // console.debug( "Toggling qsbox: %o", qsbox ); - $(qsbox).toggle(); - }); - }); +function hookTableOfContentsToggle() { + $('.indexpage li .toc-toggle').each( function() { + $(this).click( function() { + $(this).toggleClass('open'); + }); + + var section = $(this).next(); + + $(this).click( function() { + section.slideToggle(); + }); + }); +} + +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 <script> per-page + html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title); + if (result.params) + html += '<span class="params">' + result.params + '</span>'; + html += '</a>'; + + + if (result.namespace) + html += '<p class="search-namespace">' + this.hlt(result.namespace); + + if (result.snippet) + html += '<div class="search-snippet">' + result.snippet + '</div>'; + + li.innerHTML = html; + + return li; + } + + search.select = function(result) { + var result_element = result.get(0); + window.location.href = result_element.firstChild.firstChild.href; + } + + search.scrollIntoView = search.scrollInWindow; }; function highlightTarget( anchor ) { - console.debug( "Highlighting target '%s'.", anchor ); - - $("a[name=" + anchor + "]").each( function() { - if ( !$(this).parent().parent().hasClass('target-section') ) { - console.debug( "Wrapping the target-section" ); - $('div.method-detail').unwrap( 'div.target-section' ); - $(this).parent().wrap( '<div class="target-section"></div>' ); - } else { - console.debug( "Already wrapped." ); - } - }); + console.debug( "Highlighting target '%s'.", anchor ); + + $("a[name=" + anchor + "]").each( function() { + if ( !$(this).parent().parent().hasClass('target-section') ) { + console.debug( "Wrapping the target-section" ); + $('div.method-detail').unwrap( 'div.target-section' ); + $(this).parent().wrap( '<div class="target-section"></div>' ); + } else { + console.debug( "Already wrapped." ); + } + }); }; function highlightLocationTarget() { - console.debug( "Location hash: %s", window.location.hash ); - if ( ! window.location.hash || window.location.hash.length == 0 ) return; + console.debug( "Location hash: %s", window.location.hash ); + if ( ! window.location.hash || window.location.hash.length == 0 ) return; - var anchor = window.location.hash.substring(1); - console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" ); + var anchor = window.location.hash.substring(1); + console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" ); - highlightTarget( anchor ); + highlightTarget( anchor ); }; function highlightClickTarget( event ) { - console.debug( "Highlighting click target for event %o", event.target ); - try { - var anchor = $(event.target).attr( 'href' ).substring(1); - console.debug( "Found target anchor: %s", anchor ); - highlightTarget( anchor ); - } catch ( err ) { - console.error( "Exception while highlighting: %o", err ); - }; + console.debug( "Highlighting click target for event %o", event.target ); + try { + var anchor = $(event.target).attr( 'href' ).substring(1); + console.debug( "Found target anchor: %s", anchor ); + highlightTarget( anchor ); + } catch ( err ) { + console.error( "Exception while highlighting: %o", err ); + }; }; $(document).ready( function() { - hookSourceViews(); - hookDebuggingToggle(); - hookQuickSearch(); - highlightLocationTarget(); + hookSourceViews(); + hookDebuggingToggle(); + hookSearch(); + highlightLocationTarget(); + hookTableOfContentsToggle(); - $('ul.link-list a').bind( "click", highlightClickTarget ); + $('ul.link-list a').bind( "click", highlightClickTarget ); }); diff --git a/lib/rdoc/generator/template/darkfish/js/jquery.js b/lib/rdoc/generator/template/darkfish/js/jquery.js index afe9e74c90..48590ecb96 100644 --- a/lib/rdoc/generator/template/darkfish/js/jquery.js +++ b/lib/rdoc/generator/template/darkfish/js/jquery.js @@ -1,32 +1,18 @@ -/* - * jQuery 1.2.6 - New Wave Javascript +/*! + * jQuery JavaScript Library v1.6.2 + * http://jquery.com/ * - * Copyright (c) 2008 John Resig (jquery.com) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * - * $Date: 2008-09-25 09:50:52 -0700 (Thu, 25 Sep 2008) $ - * $Rev: 38 $ + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Jun 30 14:16:56 2011 -0400 */ -(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else -return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else -return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else -selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else -return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else -this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else -return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else -jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else -script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else -for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else -for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else -jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else -ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else -while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else -while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else -for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else -jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else -xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else -jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else -for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else -s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else -e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
\ No newline at end of file +(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bC.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bR,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bX(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bX(a,c,d,e,"*",g));return l}function bW(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bN),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bA(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bv:bw;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bg(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(H)return H.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test("Â ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:|^on/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i. +shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j +)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
\ No newline at end of file diff --git a/lib/rdoc/generator/template/darkfish/js/quicksearch.js b/lib/rdoc/generator/template/darkfish/js/quicksearch.js deleted file mode 100644 index 70dbd33cd9..0000000000 --- a/lib/rdoc/generator/template/darkfish/js/quicksearch.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * - * JQuery QuickSearch - Hook up a form field to hide non-matching elements. - * $Id: quicksearch.js 53 2009-01-07 02:52:03Z deveiant $ - * - * Author: Michael Granger <mgranger@laika.com> - * - */ -jQuery.fn.quicksearch = function( target, searchElems, options ) { - // console.debug( "Quicksearch fn" ); - - var settings = { - delay: 250, - clearButton: false, - highlightMatches: false, - focusOnLoad: false, - noSearchResultsIndicator: null - }; - if ( options ) $.extend( settings, options ); - - return jQuery(this).each( function() { - // console.debug( "Creating a new quicksearch on %o for %o", this, searchElems ); - new jQuery.quicksearch( this, searchElems, settings ); - }); -}; - - -jQuery.quicksearch = function( searchBox, searchElems, settings ) { - var timeout; - var boxdiv = $(searchBox).parents('div').eq(0); - - function init() { - setupKeyEventHandlers(); - focusOnLoad(); - }; - - function setupKeyEventHandlers() { - // console.debug( "Hooking up the 'keypress' event to %o", searchBox ); - $(searchBox). - unbind( 'keyup' ). - keyup( function(e) { return onSearchKey( e.keyCode ); }); - $(searchBox). - unbind( 'keypress' ). - keypress( function(e) { - switch( e.which ) { - // Execute the search on Enter, Tab, or Newline - case 9: - case 13: - case 10: - clearTimeout( timeout ); - e.preventDefault(); - doQuickSearch(); - break; - - // Allow backspace - case 8: - return true; - break; - - // Only allow valid search characters - default: - return validQSChar( e.charCode ); - } - }); - }; - - function focusOnLoad() { - if ( !settings.focusOnLoad ) return false; - $(searchBox).focus(); - }; - - function onSearchKey ( code ) { - clearTimeout( timeout ); - // console.debug( "...scheduling search." ); - timeout = setTimeout( doQuickSearch, settings.delay ); - }; - - function validQSChar( code ) { - var c = String.fromCharCode( code ); - return ( - (c == ':') || - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') - ); - }; - - function doQuickSearch() { - var searchText = searchBox.value; - var pat = new RegExp( searchText, "im" ); - var shownCount = 0; - - if ( settings.noSearchResultsIndicator ) { - $('#' + settings.noSearchResultsIndicator).hide(); - } - - // All elements start out hidden - $(searchElems).each( function(index) { - var str = $(this).text(); - - if ( pat.test(str) ) { - shownCount += 1; - $(this).fadeIn(); - } else { - $(this).hide(); - } - }); - - if ( shownCount == 0 && settings.noSearchResultsIndicator ) { - $('#' + settings.noSearchResultsIndicator).slideDown(); - } - }; - - init(); -}; diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js new file mode 100644 index 0000000000..dbdfdcbc4c --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/js/search.js @@ -0,0 +1,94 @@ +Search = function(data, input, result) { + this.data = data; + this.$input = $(input); + this.$result = $(result); + + this.$current = null; + this.$view = this.$result.parent(); + this.searcher = new Searcher(data.index); + this.init(); +} + +Search.prototype = $.extend({}, Navigation, new function() { + var suid = 1; + + this.init = function() { + var _this = this; + var observer = function() { + _this.search(_this.$input[0].value); + }; + this.$input.keyup(observer); + this.$input.click(observer); // mac's clear field + + this.searcher.ready(function(results, isLast) { + _this.addResults(results, isLast); + }) + + this.initNavigation(); + this.setNavigationActive(false); + } + + this.search = function(value, selectFirstMatch) { + value = jQuery.trim(value).toLowerCase(); + if (value) { + this.setNavigationActive(true); + } else { + this.setNavigationActive(false); + } + + if (value == '') { + this.lastQuery = value; + this.$result.empty(); + this.setNavigationActive(false); + } else if (value != this.lastQuery) { + this.lastQuery = value; + this.firstRun = true; + this.searcher.find(value); + } + } + + this.addResults = function(results, isLast) { + var target = this.$result.get(0); + if (this.firstRun && (results.length > 0 || isLast)) { + this.$current = null; + this.$result.empty(); + } + + for (var i=0, l = results.length; i < l; i++) { + target.appendChild(this.renderItem.call(this, results[i])); + }; + + if (this.firstRun && results.length > 0) { + this.firstRun = false; + this.$current = $(target.firstChild); + this.$current.addClass('current'); + } + if (jQuery.browser.msie) this.$element[0].className += ''; + } + + this.move = function(isDown) { + if (!this.$current) return; + var $next = this.$current[isDown ? 'next' : 'prev'](); + if ($next.length) { + this.$current.removeClass('current'); + $next.addClass('current'); + this.scrollIntoView($next[0], this.$view[0]); + this.$current = $next; + } + return true; + } + + this.hlt = function(html) { + return this.escapeHTML(html). + replace(/\u0001/g, '<em>'). + replace(/\u0002/g, '</em>'); + } + + this.escapeHTML = function(html) { + return html.replace(/[&<>]/g, function(c) { + return '&#' + c.charCodeAt(0) + ';'; + }); + } + +}); + diff --git a/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js b/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js deleted file mode 100644 index 3a3fdae1fb..0000000000 --- a/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Thickbox 3 - One Box To Rule Them All. - * By Cody Lindley (http://www.codylindley.com) - * Copyright (c) 2007 cody lindley - * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -var tb_pathToImage = "../images/loadingAnimation.gif"; - -eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}))
\ No newline at end of file diff --git a/lib/rdoc/generator/template/darkfish/page.rhtml b/lib/rdoc/generator/template/darkfish/page.rhtml new file mode 100644 index 0000000000..942172919b --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/page.rhtml @@ -0,0 +1,18 @@ +<body class="file"> +<nav id="metadata"> + <%= render '_sidebar_navigation.rhtml' %> + + <%= render '_sidebar_search.rhtml' %> + + <%= render '_sidebar_table_of_contents.rhtml' %> + + <div id="project-metadata"> + <%= render '_sidebar_pages.rhtml' %> + <%= render '_sidebar_classes.rhtml' %> + </div> +</nav> + +<div id="documentation" class="description"> + <%= file.description %> +</div> + diff --git a/lib/rdoc/generator/template/darkfish/rdoc.css b/lib/rdoc/generator/template/darkfish/rdoc.css index ea91421837..b965e604e6 100644 --- a/lib/rdoc/generator/template/darkfish/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/rdoc.css @@ -6,15 +6,14 @@ * */ +/* vim: ft=css et sw=2 ts=2 sts=2 */ /* Base Green is: #6C8C22 */ -*{ padding: 0; margin: 0; } +* { padding: 0; margin: 0; } body { background: #efefef; font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif; -} -body.class, body.module, body.file { margin-left: 40px; } body.file-popup { @@ -44,6 +43,15 @@ pre { padding: 0.5em 0; } +blockquote { + background: #ddd; + margin: 1em; + padding: 0.25em; +} + +blockquote > :first-child { + margin-top: 0 !important; +} /* @group Generic Classes */ @@ -51,16 +59,21 @@ pre { display: none; } -.quicksearch-field { +#search-field { width: 98%; - background: #ddd; - border: 1px solid #aaa; + background: #eee; + border: none; height: 1.5em; -webkit-border-radius: 4px; } -.quicksearch-field:focus { +#search-field:focus { background: #f1edba; } +#search-field:-moz-placeholder, +#search-field::-webkit-input-placeholder { + font-weight: bold; + color: #666; +} .missing-docs { font-size: 120%; @@ -86,28 +99,8 @@ pre { /* @end */ - /* @group Index Page, Standalone file pages */ -body.indexpage { - margin: 1em 3em; -} -body.indexpage p, -body.indexpage div, -body.file p { - margin: 1em 0; -} - -.indexpage .rdoc-list p, .file .rdoc-list p { - margin: 0em 0; -} - -.indexpage ol, -.file #documentation ol { - line-height: 160%; -} - -.indexpage ul, -.file #documentation ul { +.indexpage ul { line-height: 160%; list-style: none; } @@ -116,25 +109,16 @@ body.file p { font-size: 16px; } -.indexpage li, -.file #documentation li { +.indexpage li { padding-left: 20px; } -.indexpage ol, -.file #documentation ol { - margin-left: 20px; -} - -.indexpage ol > li, -.file #documentation ol > li { - padding-left: 0; -} - -.indexpage ul > li, -.file #documentation ul > li { +.indexpage ul > li { background: url(images/bullet_black.png) no-repeat left 4px; } +.indexpage li.method { + background: url(images/plugin.png) no-repeat left 4px; +} .indexpage li.module { background: url(images/package.png) no-repeat left 4px; } @@ -144,36 +128,37 @@ body.file p { .indexpage li.file { background: url(images/page_white_text.png) no-repeat left 4px; } -.file li p, -.indexpage li p { - margin: 0 0; +.indexpage li li { + background: url(images/tag_blue.png) no-repeat left 4px; +} +.indexpage li .toc-toggle { + width: 16px; + height: 16px; + background: url(images/add.png) no-repeat; +} + +.indexpage li .toc-toggle.open { + background: url(images/delete.png) no-repeat; } /* @end */ /* @group Top-Level Structure */ -.class #metadata, -.file #metadata, -.module #metadata { +#metadata { float: left; width: 260px; } -.class #documentation, -.file #documentation, -.module #documentation { +#documentation { margin: 2em 1em 5em 300px; min-width: 340px; } -.file #metadata { - margin: 0.8em; -} - #validator-badges { clear: both; margin: 1em 1em 2em; + font-size: smaller; } /* @end */ @@ -184,7 +169,7 @@ body.file p { -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 1px solid #aaa; - margin: 0 8px 16px; + margin: 0 8px 8px; font-size: 90%; overflow: hidden; } @@ -210,11 +195,24 @@ body.file p { list-style: none; } +#file-metadata { + margin-top: 2em; +} + #file-metadata ul { padding-left: 28px; list-style-image: url(images/page_green.png); } +#table-of-contents { + margin-top: 2em; +} + +#table-of-contents ul { + padding-left: 28px; + list-style-image: url(images/tag_blue.png); +} + dl.svninfo { color: #666; margin: 0; @@ -225,7 +223,9 @@ dl.svninfo dt { ul.link-list li { white-space: nowrap; + line-height: 20px; } + ul.link-list .type { font-size: 8px; text-transform: uppercase; @@ -235,16 +235,21 @@ ul.link-list .type { -webkit-border-radius: 5px; } +.calls-super { + background: url(images/arrow_up.png) no-repeat right center; +} + /* @end */ +/* @group Class Metadata Section */ +#class-metadata { + margin-top: 2em; +} +/* @end */ /* @group Project Metadata Section */ #project-metadata { - margin-top: 3em; -} - -.file #project-metadata { - margin-top: 0em; + margin-top: 2em; } #project-metadata .section { @@ -254,33 +259,14 @@ ul.link-list .type { border-bottom: 1px solid #aaa; position: relative; } -#project-metadata h3.section-header .search-toggle { - position: absolute; - right: 5px; -} - #project-metadata form { color: #777; background: #ccc; - padding: 8px 8px 16px; - border-bottom: 1px solid #bbb; -} -#project-metadata fieldset { - border: 0; -} - -#no-class-search-results { - margin: 0 auto 1em; - text-align: center; - font-size: 14px; - font-weight: bold; - color: #aaa; } /* @end */ - /* @group Documentation Section */ .description { font-size: 100%; @@ -295,34 +281,44 @@ ul.link-list .type { margin: 0; } +.description ol, .description ul { margin-left: 1.5em; } +.description ol li, .description ul li { line-height: 1.4em; } -.description dl, -#documentation dl { +.note-list { + margin: 8px 0; +} + +.label-list { margin: 8px 1.5em; border: 1px solid #ccc; } -.description dl { +.description .label-list { font-size: 14px; } -.description dt, -#documentation dt { +.note-list dt { + font-weight: bold; +} +.note-list dd { + padding: 0 12px; +} + +.label-list dt { padding: 2px 4px; font-weight: bold; background: #ddd; } -.description dd, -#documentation dd { +.label-list dd { padding: 2px 12px; } -.description dd + dt, -#documentation dd + dt { +.label-list dd + dt, +.note-list dd + dt { margin-top: 0.7em; } @@ -331,8 +327,8 @@ ul.link-list .type { } #documentation h2.section-header { - margin-top: 2em; - padding: 0.75em 0.5em; + margin-top: 1em; + padding: 0.25em 0.5em; background: #ccc; color: #333; font-size: 175%; @@ -341,8 +337,25 @@ ul.link-list .type { -webkit-border-radius: 3px; } +.documentation-section-title { + position: relative; +} +.documentation-section-title .section-click-top { + position: absolute; + top: 6px; + right: 12px; + font-size: 10px; + color: #9b9877; + visibility: hidden; + padding-right: 0.5px; +} + +.documentation-section-title:hover .section-click-top { + visibility: visible; +} + #documentation h3.section-header { - margin-top: 2em; + margin-top: 1em; padding: 0.25em 0.5em; background-color: #dedede; color: #333; @@ -398,6 +411,11 @@ ul.link-list .type { display: none; } +#documentation .method-description .method-calls-super { + color: #333; + font-weight: bolder; +} + #documentation .method-detail { margin: 0.5em 0; padding: 0.5em 0; @@ -429,7 +447,7 @@ ul.link-list .type { line-height: 20px; background: url(images/zoom.png) no-repeat right top; } -#documentation .method-detail:hover .method-click-advice { +#documentation .method-heading:hover .method-click-advice { visibility: visible; } @@ -455,14 +473,14 @@ ul.link-list .type { cursor: default; } #documentation .method-description p { - padding: 0; -} -#documentation .method-description p + p { margin-bottom: 0.5em; } #documentation .method-description ul { margin-left: 1.5em; } +pre { + margin: 0.5em 0; +} #documentation .attribute-method-heading { background: url(images/tag_green.png) no-repeat left bottom; @@ -481,283 +499,76 @@ ul.link-list .type { /* @end */ - - /* @group Source Code */ -div.method-source-code { +pre { + overflow: auto; background: #262626; - color: #efefef; - margin: 1em; - padding: 0.5em; + color: white; border: 1px dashed #999; - overflow: hidden; + padding: 0.5em; } -div.method-source-code pre { - background: inherit; - padding: 0; - color: white; - overflow: auto; +.description pre { + margin: 0 0.4em; } -/* @group Ruby keyword styles */ - .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: #b22222; font-weight: bold; background: transparent; } +.ruby-comment { color: #dc0000; font-weight: bold; background: transparent; } .ruby-regexp { color: #ffa07a; background: transparent; } .ruby-value { color: #7fffd4; background: transparent; } /* @end */ -/* @end */ - - -/* @group File Popup Contents */ - -.file #metadata, -.file-popup #metadata { -} - -.file-popup dl { - font-size: 80%; - padding: 0.75em; - background-color: #dedede; - color: #333; - border: 1px solid #bbb; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; -} -.file dt { - font-weight: bold; - padding-left: 22px; - line-height: 20px; - background: url(images/page_white_width.png) no-repeat left top; -} -.file dt.modified-date { - background: url(images/date.png) no-repeat left top; -} -.file dt.requires { - background: url(images/plugin.png) no-repeat left top; -} -.file dt.scs-url { - background: url(images/wrench.png) no-repeat left top; -} - -.file dl dd { - margin: 0 0 1em 0; -} -.file #metadata dl dd ul { - list-style: circle; - margin-left: 20px; - padding-top: 0; -} -.file #metadata dl dd ul li { -} - - -.file h2 { - margin-top: 2em; - padding: 0.75em 0.5em; - background-color: #dedede; - color: #333; - font-size: 120%; - border: 1px solid #bbb; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; -} - -/* @end */ - - -/* @group ThickBox Styles */ -#TB_window { - font: 12px Arial, Helvetica, sans-serif; - color: #333333; -} - -#TB_secondLine { - font: 10px Arial, Helvetica, sans-serif; - color:#666666; +/* @group search results */ +#search-results h1 { + font-size: 1em; + font-weight: normal; + text-shadow: none; } -#TB_window :link, -#TB_window :visited { color: #666666; } -#TB_window :link:hover, -#TB_window :visited:hover { color: #000; } -#TB_window :link:active, -#TB_window :visited:active { color: #666666; } -#TB_window :link:focus, -#TB_window :visited:focus { color: #666666; } - -#TB_overlay { - position: fixed; - z-index:100; - top: 0px; - left: 0px; - height:100%; - width:100%; -} - -.TB_overlayMacFFBGHack {background: url(images/macFFBgHack.png) repeat;} -.TB_overlayBG { - background-color:#000; - filter:alpha(opacity=75); - -moz-opacity: 0.75; - opacity: 0.75; -} - -* html #TB_overlay { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_window { - position: fixed; - background: #ffffff; - z-index: 102; - color:#000000; - display:none; - border: 4px solid #525252; - text-align:left; - top:50%; - left:50%; -} - -* html #TB_window { /* ie6 hack */ - position: absolute; - margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_window img#TB_Image { - display:block; - margin: 15px 0 0 15px; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; - border-top: 1px solid #666; - border-left: 1px solid #666; -} - -#TB_caption{ - height:25px; - padding:7px 30px 10px 25px; - float:left; -} - -#TB_closeWindow{ - height:25px; - padding:11px 25px 10px 0; - float:right; -} - -#TB_closeAjaxWindow{ - padding:7px 10px 5px 0; - margin-bottom:1px; - text-align:right; - float:right; -} - -#TB_ajaxWindowTitle{ - float:left; - padding:7px 0 5px 10px; - margin-bottom:1px; - font-size: 22px; -} - -#TB_title{ - background-color: #6C8C22; - color: #dedede; - height:40px; -} -#TB_title :link, -#TB_title :visited { - color: white !important; - border-bottom: 1px dotted #dedede; -} - -#TB_ajaxContent{ - clear:both; - padding:2px 15px 15px 15px; - overflow:auto; - text-align:left; - line-height:1.4em; -} - -#TB_ajaxContent.TB_modal{ - padding:15px; +#search-results .current { + background: #ccc; + border-bottom: 1px solid transparent; } -#TB_ajaxContent p{ - padding:5px 0px 5px 0px; +#search-results li { + list-style: none; + border-bottom: 1px solid #aaa; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + margin-bottom: 0.5em; } -#TB_load{ - position: fixed; - display:none; - height:13px; - width:208px; - z-index:103; - top: 50%; - left: 50%; - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ +#search-results li:last-child { + border-bottom: none; + margin-bottom: 0; } -* html #TB_load { /* ie6 hack */ - position: absolute; - margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); +#search-results li p { + padding: 0; + margin: 0.5em; } -#TB_HideSelect{ - z-index:99; - position:fixed; - top: 0; - left: 0; - background-color:#fff; - border:none; - filter:alpha(opacity=0); - -moz-opacity: 0; - opacity: 0; - height:100%; - width:100%; +#search-results .search-namespace { + font-weight: bold; } -* html #TB_HideSelect { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); +#search-results li em { + background: yellow; + font-style: normal; } -#TB_iframeContent{ - clear:both; - border:none; - margin-bottom:-1px; - margin-top:1px; - _margin-bottom:1px; +#search-results pre { + margin: 0.5em; } /* @end */ -/* @group Debugging Section */ - -#debugging-toggle { - text-align: center; -} -#debugging-toggle img { - cursor: pointer; -} - -#rdoc-debugging-section-dump { - display: none; - margin: 0 2em 2em; - background: #ccc; - border: 1px solid #999; -} - - - -/* @end */ diff --git a/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml new file mode 100644 index 0000000000..24c9ba8eaa --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml @@ -0,0 +1,18 @@ +<body> +<nav id="metadata"> + <%= render '_sidebar_navigation.rhtml' %> + + <%= render '_sidebar_search.rhtml' %> + + <div id="project-metadata"> + <%= render '_sidebar_pages.rhtml' %> + <%= render '_sidebar_classes.rhtml' %> + </div> +</nav> + +<div id="documentation" class="description"> + <h1>Not Found</h1> + + <p>The page <kbd><%=h path %></kbd> was not found +</div> + diff --git a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml new file mode 100644 index 0000000000..63b4ee8ff7 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml @@ -0,0 +1,37 @@ +<body> +<nav id="metadata"> +<%= render '_sidebar_search.rhtml' %> + +<%= render '_sidebar_installed.rhtml' %> +</nav> + +<div id="documentation" class="description"> + <h1>Local RDoc Documentation</h1> + + <p>Here you can browse local documentation from the ruby standard library and + your installed gems. + +<% gems = installed.select { |_, _, _, type,| type == :gem } %> +<% missing = gems.reject { |_, _, exists,| exists } %> +<% unless missing.empty? then %> + <h2>Missing Gem Documentation</h2> + + <p>You are missing documentation for some of your installed gems. + You can install missing documentation for gems by running + <kbd>gem rdoc --all</kbd>. After installing the missing documentation you + only need to reload this page. The newly created documentation will + automatically appear. + + <p>You can also install documentation for a specific gem by running one of + the following commands. + + <ul> + <% names = missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq %> + <% names.each do |name| %> + <li><kbd>gem rdoc <%=h name %></kbd> + <% end %> + </ul> +<% end %> + +</div> + diff --git a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml new file mode 100644 index 0000000000..8f19085bb4 --- /dev/null +++ b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml @@ -0,0 +1,55 @@ +<body class="indexpage"> +<h1><%= h @title %></h1> + +<% simple_files = @files.select { |f| f.text? } %> +<% unless simple_files.empty? then %> +<h2>Pages</h2> +<ul> +<% simple_files.sort.each do |file| %> + <li class="file"> + <a href="<%= file.path %>"><%= h file.page_name %></a> +<% + # HACK table_of_contents should not exist on Document + table = file.parse(file.comment).table_of_contents + unless table.empty? then %> + <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings"> + <ul class="initially-hidden"> +<% table.each do |heading| %> + <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a> +<% end %> + </ul> +<% end %> + </li> + <% end %> +</ul> +<% end %> + +<h2 id="classes">Classes/Modules</h2> +<ul> +<% @modsort.each do |klass| %> + <li class="<%= klass.type %>"> + <a href="<%= klass.path %>"><%= klass.full_name %></a> +<% table = [] + table.concat klass.parse(klass.comment).table_of_contents + table.concat klass.section_contents + + unless table.empty? then %> + <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings"> + <ul class="initially-hidden"> +<% table.each do |item| %> + <li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a> +<% end %> + </ul> +<% end %> + </li> + <% end %> +</ul> + +<h2 id="methods">Methods</h2> +<ul> + <% @store.all_classes_and_modules.map do |mod| + mod.method_list + end.flatten.sort.each do |method| %> + <li class="method"><a href="<%= method.path %>"><%= method.pretty_name %> — <%= method.parent.full_name %></a> + <% end %> +</ul> diff --git a/lib/rdoc/generator/template/json_index/js/navigation.js b/lib/rdoc/generator/template/json_index/js/navigation.js new file mode 100644 index 0000000000..e41268123e --- /dev/null +++ b/lib/rdoc/generator/template/json_index/js/navigation.js @@ -0,0 +1,142 @@ +/* + * Navigation allows movement using the arrow keys through the search results. + * + * When using this library you will need to set scrollIntoView to the + * appropriate function for your layout. Use scrollInWindow if the container + * is not scrollable and scrollInElement if the container is a separate + * scrolling region. + */ +Navigation = new function() { + this.initNavigation = function() { + var _this = this; + + $(document).keydown(function(e) { + _this.onkeydown(e); + }).keyup(function(e) { + _this.onkeyup(e); + }); + + this.navigationActive = true; + } + + this.setNavigationActive = function(state) { + this.navigationActive = state; + this.clearMoveTimeout(); + } + + this.onkeyup = function(e) { + if (!this.navigationActive) return; + + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + case 38: //Event.KEY_UP: + case 39: //Event.KEY_RIGHT: + case 40: //Event.KEY_DOWN: + this.clearMoveTimeout(); + break; + } + } + + this.onkeydown = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + if (this.moveLeft()) e.preventDefault(); + break; + case 38: //Event.KEY_UP: + if (e.keyCode == 38 || e.ctrlKey) { + if (this.moveUp()) e.preventDefault(); + this.startMoveTimeout(false); + } + break; + case 39: //Event.KEY_RIGHT: + if (this.moveRight()) e.preventDefault(); + break; + case 40: //Event.KEY_DOWN: + if (e.keyCode == 40 || e.ctrlKey) { + if (this.moveDown()) e.preventDefault(); + this.startMoveTimeout(true); + } + break; + case 13: //Event.KEY_RETURN: + if (this.$current) + e.preventDefault(); + this.select(this.$current); + break; + } + if (e.ctrlKey && e.shiftKey) this.select(this.$current); + } + + this.clearMoveTimeout = function() { + clearTimeout(this.moveTimeout); + this.moveTimeout = null; + } + + this.startMoveTimeout = function(isDown) { + if (!$.browser.mozilla && !$.browser.opera) return; + if (this.moveTimeout) this.clearMoveTimeout(); + var _this = this; + + var go = function() { + if (!_this.moveTimeout) return; + _this[isDown ? 'moveDown' : 'moveUp'](); + _this.moveTimout = setTimeout(go, 100); + } + this.moveTimeout = setTimeout(go, 200); + } + + this.moveRight = function() { + } + + this.moveLeft = function() { + } + + this.move = function(isDown) { + } + + this.moveUp = function() { + return this.move(false); + } + + this.moveDown = function() { + return this.move(true); + } + + /* + * Scrolls to the given element in the scrollable element view. + */ + this.scrollInElement = function(element, view) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = view.offsetHeight; + viewScroll = view.scrollTop; + + if (offset - viewScroll + height > viewHeight) { + view.scrollTop = offset - viewHeight + height; + } + if (offset < viewScroll) { + view.scrollTop = offset; + } + } + + /* + * Scrolls to the given element in the window. The second argument is + * ignored + */ + this.scrollInWindow = function(element, ignored) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = window.innerHeight; + viewScroll = window.scrollY; + + if (offset - viewScroll + height > viewHeight) { + window.scrollTo(window.scrollX, offset - viewHeight + height); + } + if (offset < viewScroll) { + window.scrollTo(window.scrollX, offset); + } + } +} + diff --git a/lib/rdoc/generator/template/json_index/js/searcher.js b/lib/rdoc/generator/template/json_index/js/searcher.js new file mode 100644 index 0000000000..f854b541d0 --- /dev/null +++ b/lib/rdoc/generator/template/json_index/js/searcher.js @@ -0,0 +1,228 @@ +Searcher = function(data) { + this.data = data; + this.handlers = []; +} + +Searcher.prototype = new function() { + // search is performed in chunks of 1000 for non-blocking user input + var CHUNK_SIZE = 1000; + // do not try to find more than 100 results + var MAX_RESULTS = 100; + var huid = 1; + var suid = 1; + var runs = 0; + + this.find = function(query) { + var queries = splitQuery(query); + var regexps = buildRegexps(queries); + var highlighters = buildHilighters(queries); + var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++}; + var _this = this; + + this.currentSuid = state.n; + + if (!query) return; + + var run = function() { + // stop current search thread if new search started + if (state.n != _this.currentSuid) return; + + var results = + performSearch(_this.data, regexps, queries, highlighters, state); + var hasMore = (state.limit > 0 && state.pass < 4); + + triggerResults.call(_this, results, !hasMore); + if (hasMore) { + setTimeout(run, 2); + } + runs++; + }; + runs = 0; + + // start search thread + run(); + } + + /* ----- Events ------ */ + this.ready = function(fn) { + fn.huid = huid; + this.handlers.push(fn); + } + + /* ----- Utilities ------ */ + function splitQuery(query) { + return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) { + return string.match(/\S/) + }); + } + + function buildRegexps(queries) { + return jQuery.map(queries, function(query) { + return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i') + }); + } + + function buildHilighters(queries) { + return jQuery.map(queries, function(query) { + return jQuery.map(query.split(''), function(l, i) { + return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2); + }).join(''); + }); + } + + // function longMatchRegexp(index, longIndex, regexps) { + // for (var i = regexps.length - 1; i >= 0; i--){ + // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false; + // }; + // return true; + // } + + + /* ----- Mathchers ------ */ + + /* + * This record matches if the index starts with queries[0] and the record + * matches all of the regexps + */ + function matchPassBeginning(index, longIndex, queries, regexps) { + if (index.indexOf(queries[0]) != 0) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if the longIndex starts with queries[0] and the + * longIndex matches all of the regexps + */ + function matchPassLongIndex(index, longIndex, queries, regexps) { + if (longIndex.indexOf(queries[0]) != 0) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if the index contains queries[0] and the record + * matches all of the regexps + */ + function matchPassContains(index, longIndex, queries, regexps) { + if (index.indexOf(queries[0]) == -1) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if regexps[0] matches the index and the record + * matches all of the regexps + */ + function matchPassRegexp(index, longIndex, queries, regexps) { + if (!index.match(regexps[0])) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + + /* ----- Highlighters ------ */ + function highlightRegexp(info, queries, regexps, highlighters) { + var result = createResult(info); + for (var i=0, l = regexps.length; i < l; i++) { + result.title = result.title.replace(regexps[i], highlighters[i]); + result.namespace = result.namespace.replace(regexps[i], highlighters[i]); + }; + return result; + } + + function hltSubstring(string, pos, length) { + return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length); + } + + function highlightQuery(info, queries, regexps, highlighters) { + var result = createResult(info); + var pos = 0; + var lcTitle = result.title.toLowerCase(); + + pos = lcTitle.indexOf(queries[0]); + if (pos != -1) { + result.title = hltSubstring(result.title, pos, queries[0].length); + } + + result.namespace = result.namespace.replace(regexps[0], highlighters[0]); + for (var i=1, l = regexps.length; i < l; i++) { + result.title = result.title.replace(regexps[i], highlighters[i]); + result.namespace = result.namespace.replace(regexps[i], highlighters[i]); + }; + return result; + } + + function createResult(info) { + var result = {}; + result.title = info[0]; + result.namespace = info[1]; + result.path = info[2]; + result.params = info[3]; + result.snippet = info[4]; + return result; + } + + /* ----- Searching ------ */ + function performSearch(data, regexps, queries, highlighters, state) { + var searchIndex = data.searchIndex; + var longSearchIndex = data.longSearchIndex; + var info = data.info; + var result = []; + var i = state.from; + var l = searchIndex.length; + var togo = CHUNK_SIZE; + var matchFunc, hltFunc; + + while (state.pass < 4 && state.limit > 0 && togo > 0) { + if (state.pass == 0) { + matchFunc = matchPassBeginning; + hltFunc = highlightQuery; + } else if (state.pass == 1) { + matchFunc = matchPassLongIndex; + hltFunc = highlightQuery; + } else if (state.pass == 2) { + matchFunc = matchPassContains; + hltFunc = highlightQuery; + } else if (state.pass == 3) { + matchFunc = matchPassRegexp; + hltFunc = highlightRegexp; + } + + for (; togo > 0 && i < l && state.limit > 0; i++, togo--) { + if (info[i].n == state.n) continue; + if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) { + info[i].n = state.n; + result.push(hltFunc(info[i], queries, regexps, highlighters)); + state.limit--; + } + }; + if (searchIndex.length <= i) { + state.pass++; + i = state.from = 0; + } else { + state.from = i; + } + } + return result; + } + + function triggerResults(results, isLast) { + jQuery.each(this.handlers, function(i, fn) { + fn.call(this, results, isLast) + }) + } +} + diff --git a/lib/rdoc/ghost_method.rb b/lib/rdoc/ghost_method.rb index 192b46f51f..7eb2d93167 100644 --- a/lib/rdoc/ghost_method.rb +++ b/lib/rdoc/ghost_method.rb @@ -1,5 +1,3 @@ -require 'rdoc/any_method' - ## # GhostMethod represents a method referenced only by a comment diff --git a/lib/rdoc/include.rb b/lib/rdoc/include.rb index 9cebd3d8ef..1e9ff5a464 100644 --- a/lib/rdoc/include.rb +++ b/lib/rdoc/include.rb @@ -1,5 +1,3 @@ -require 'rdoc/code_object' - ## # A Module include in a class with \#include @@ -17,7 +15,7 @@ class RDoc::Include < RDoc::CodeObject super() @name = name self.comment = comment - @module = nil # cache for module if found + @module = nil # cache for module if found end ## @@ -30,10 +28,11 @@ class RDoc::Include < RDoc::CodeObject end def == other # :nodoc: - self.class == other.class and - self.name == other.name + self.class === other and @name == other.name end + alias eql? == + ## # Full name based on #module @@ -42,6 +41,10 @@ class RDoc::Include < RDoc::CodeObject RDoc::ClassModule === m ? m.full_name : @name end + def hash # :nodoc: + [@name, self.module].hash + end + def inspect # :nodoc: "#<%s:0x%x %s.include %s>" % [ self.class, @@ -59,6 +62,13 @@ class RDoc::Include < RDoc::CodeObject # - if not found, look into the children of included modules, # in reverse inclusion order; # - if still not found, go up the hierarchy of names. + # + # This method has <code>O(n!)</code> behavior when the module calling + # include is referencing nonexistent modules. Avoid calling #module until + # after all the files are parsed. This behavior is due to ruby's constant + # lookup behavior. + # + # As of the beginning of October, 2011, no gem includes nonexistent modules. def module return @module if @module @@ -66,7 +76,7 @@ class RDoc::Include < RDoc::CodeObject # search the current context return @name unless parent full_name = parent.child_name(@name) - @module = RDoc::TopLevel.modules_hash[full_name] + @module = @store.modules_hash[full_name] return @module if @module return @name if @name =~ /^::/ @@ -76,22 +86,31 @@ class RDoc::Include < RDoc::CodeObject inc = i.module next if String === inc full_name = inc.child_name(@name) - @module = RDoc::TopLevel.modules_hash[full_name] + @module = @store.modules_hash[full_name] return @module if @module end # go up the hierarchy of names - p = parent.parent - while p - full_name = p.child_name(@name) - @module = RDoc::TopLevel.modules_hash[full_name] + up = parent.parent + while up + full_name = up.child_name(@name) + @module = @store.modules_hash[full_name] return @module if @module - p = p.parent + up = up.parent end @name end + ## + # Sets the store for this class or module and its contained code objects. + + def store= store + super + + @file = @store.add_file @file.full_name if @file + end + def to_s # :nodoc: "include #@name in: #{parent}" end diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb new file mode 100644 index 0000000000..f1fa2cf17b --- /dev/null +++ b/lib/rdoc/markdown.rb @@ -0,0 +1,16372 @@ +# coding: UTF-8 +# :markup: markdown + +## +# RDoc::Markdown as described by the [markdown syntax][syntax]. +# +# To choose Markdown as your only default format see +# RDoc::Options@Saved+Options for instructions on setting up a `.doc_options` +# file to store your project default. +# +# ## Extensions +# +# The following markdown extensions are supported by the parser, but not all +# are used in RDoc output by default. +# +# ### RDoc +# +# The RDoc Markdown parser has the following built-in behaviors that cannot be +# disabled. +# +# Underscores embedded in words are never interpreted as emphasis. (While the +# [markdown dingus][dingus] emphasizes in-word underscores, neither the +# Markdown syntax nor MarkdownTest mention this behavior.) +# +# For HTML output, RDoc always auto-links bare URLs. +# +# ### Break on Newline +# +# The break_on_newline extension converts all newlines into hard line breaks +# as in [Github Flavored Markdown][GFM]. This extension is disabled by +# default. +# +# ### CSS +# +# The #css extension enables CSS blocks to be included in the output, but they +# are not used for any built-in RDoc output format. This extension is disabled +# by default. +# +# Example: +# +# <style type="text/css"> +# h1 { font-size: 3em } +# </style> +# +# ### Definition Lists +# +# The definition_lists extension allows definition lists using the [PHP +# Markdown Extra syntax][PHPE], but only one label and definition are supported +# at this time. This extension is enabled by default. +# +# Example: +# +# ``` +# cat +# : A small furry mammal +# that seems to sleep a lot +# +# ant +# : A little insect that is known +# to enjoy picnics +# +# ``` +# +# Produces: +# +# cat +# : A small furry mammal +# that seems to sleep a lot +# +# ant +# : A little insect that is known +# to enjoy picnics +# +# ### Github +# +# The #github extension enables a partial set of [Github Flavored Markdown] +# [GFM]. This extension is enabled by default. +# +# Supported github extensions include: +# +# #### Fenced code blocks +# +# Use ` ``` ` around a block of code instead of indenting it four spaces. +# +# #### Syntax highlighting +# +# Use ` ``` ruby ` as the start of a code fence to add syntax highlighting. +# (Currently only `ruby` syntax is supported). +# +# ### HTML +# +# Enables raw HTML to be included in the output. This extension is enabled by +# default. +# +# Example: +# +# <table> +# ... +# </table> +# +# ### Notes +# +# The #notes extension enables footnote support. This extension is enabled by +# default. +# +# Example: +# +# Here is some text[^1] including an inline footnote ^[for short footnotes] +# +# ... +# +# [^1]: With the footnote text down at the bottom +# +# Produces: +# +# Here is some text[^1] including an inline footnote ^[for short footnotes] +# +# [^1]: With the footnote text down at the bottom +# +# ## Limitations +# +# * Link titles are not used +# * Image links are not generated correctly +# * Footnotes are collapsed into a single paragraph +# +# ## Author +# +# This markdown parser is a port to kpeg from [peg-markdown][pegmarkdown] by +# John MacFarlane. +# +# It is used under the MIT license: +# +# 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. +# +# The port to kpeg was performed by Eric Hodel and Evan Phoenix +# +# [dingus]: http://daringfireball.net/projects/markdown/dingus +# [GFM]: http://github.github.com/github-flavored-markdown/ +# [pegmarkdown]: https://github.com/jgm/peg-markdown +# [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list +# [syntax]: http://daringfireball.net/projects/markdown/syntax +#-- +# Last updated to jgm/peg-markdown commit 8f8fc22ef0 +class RDoc::Markdown + # :stopdoc: + + # This is distinct from setup_parser so that a standalone parser + # can redefine #initialize and still have access to the proper + # parser setup code. + def initialize(str, debug=false) + setup_parser(str, debug) + end + + + + # Prepares for parsing +str+. If you define a custom initialize you must + # call this method before #parse + def setup_parser(str, debug=false) + @string = str + @pos = 0 + @memoizations = Hash.new { |h,k| h[k] = {} } + @result = nil + @failed_rule = nil + @failing_rule_offset = -1 + + setup_foreign_grammar + end + + attr_reader :string + attr_reader :failing_rule_offset + attr_accessor :result, :pos + + + def current_column(target=pos) + if c = string.rindex("\n", target-1) + return target - c - 1 + end + + target + 1 + end + + def current_line(target=pos) + cur_offset = 0 + cur_line = 0 + + string.each_line do |line| + cur_line += 1 + cur_offset += line.size + return cur_line if cur_offset >= target + end + + -1 + end + + def lines + lines = [] + string.each_line { |l| lines << l } + lines + end + + + + def get_text(start) + @string[start..@pos-1] + end + + def show_pos + width = 10 + if @pos < width + "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")" + else + "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")" + end + end + + def failure_info + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + + if @failed_rule.kind_of? Symbol + info = self.class::Rules[@failed_rule] + "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'" + else + "line #{l}, column #{c}: failed rule '#{@failed_rule}'" + end + end + + def failure_caret + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + + line = lines[l-1] + "#{line}\n#{' ' * (c - 1)}^" + end + + def failure_character + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + lines[l-1][c-1, 1] + end + + def failure_oneline + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + + char = lines[l-1][c-1, 1] + + if @failed_rule.kind_of? Symbol + info = self.class::Rules[@failed_rule] + "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'" + else + "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'" + end + end + + class ParseError < RuntimeError + end + + def raise_error + raise ParseError, failure_oneline + end + + def show_error(io=STDOUT) + error_pos = @failing_rule_offset + line_no = current_line(error_pos) + col_no = current_column(error_pos) + + io.puts "On line #{line_no}, column #{col_no}:" + + if @failed_rule.kind_of? Symbol + info = self.class::Rules[@failed_rule] + io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')" + else + io.puts "Failed to match rule '#{@failed_rule}'" + end + + io.puts "Got: #{string[error_pos,1].inspect}" + line = lines[line_no-1] + io.puts "=> #{line}" + io.print(" " * (col_no + 3)) + io.puts "^" + end + + def set_failed_rule(name) + if @pos > @failing_rule_offset + @failed_rule = name + @failing_rule_offset = @pos + end + end + + attr_reader :failed_rule + + def match_string(str) + len = str.size + if @string[pos,len] == str + @pos += len + return str + end + + return nil + end + + def scan(reg) + if m = reg.match(@string[@pos..-1]) + width = m.end(0) + @pos += width + return true + end + + return nil + end + + if "".respond_to? :getbyte + def get_byte + if @pos >= @string.size + return nil + end + + s = @string.getbyte @pos + @pos += 1 + s + end + else + def get_byte + if @pos >= @string.size + return nil + end + + s = @string[@pos] + @pos += 1 + s + end + end + + def parse(rule=nil) + # We invoke the rules indirectly via apply + # instead of by just calling them as methods because + # if the rules use left recursion, apply needs to + # manage that. + + if !rule + apply(:_root) + else + method = rule.gsub("-","_hyphen_") + apply :"_#{method}" + end + end + + class MemoEntry + def initialize(ans, pos) + @ans = ans + @pos = pos + @result = nil + @set = false + @left_rec = false + end + + attr_reader :ans, :pos, :result, :set + attr_accessor :left_rec + + def move!(ans, pos, result) + @ans = ans + @pos = pos + @result = result + @set = true + @left_rec = false + end + end + + def external_invoke(other, rule, *args) + old_pos = @pos + old_string = @string + + @pos = other.pos + @string = other.string + + begin + if val = __send__(rule, *args) + other.pos = @pos + other.result = @result + else + other.set_failed_rule "#{self.class}##{rule}" + end + val + ensure + @pos = old_pos + @string = old_string + end + end + + def apply_with_args(rule, *args) + memo_key = [rule, args] + if m = @memoizations[memo_key][@pos] + @pos = m.pos + if !m.set + m.left_rec = true + return nil + end + + @result = m.result + + return m.ans + else + m = MemoEntry.new(nil, @pos) + @memoizations[memo_key][@pos] = m + start_pos = @pos + + ans = __send__ rule, *args + + lr = m.left_rec + + m.move! ans, @pos, @result + + # Don't bother trying to grow the left recursion + # if it's failing straight away (thus there is no seed) + if ans and lr + return grow_lr(rule, args, start_pos, m) + else + return ans + end + + return ans + end + end + + def apply(rule) + if m = @memoizations[rule][@pos] + @pos = m.pos + if !m.set + m.left_rec = true + return nil + end + + @result = m.result + + return m.ans + else + m = MemoEntry.new(nil, @pos) + @memoizations[rule][@pos] = m + start_pos = @pos + + ans = __send__ rule + + lr = m.left_rec + + m.move! ans, @pos, @result + + # Don't bother trying to grow the left recursion + # if it's failing straight away (thus there is no seed) + if ans and lr + return grow_lr(rule, nil, start_pos, m) + else + return ans + end + + return ans + end + end + + def grow_lr(rule, args, start_pos, m) + while true + @pos = start_pos + @result = m.result + + if args + ans = __send__ rule, *args + else + ans = __send__ rule + end + return nil unless ans + + break if @pos <= m.pos + + m.move! ans, @pos, @result + end + + @result = m.result + @pos = m.pos + return m.ans + end + + class RuleInfo + def initialize(name, rendered) + @name = name + @rendered = rendered + end + + attr_reader :name, :rendered + end + + def self.rule_info(name, rendered) + RuleInfo.new(name, rendered) + end + + + # :startdoc: + + + + require 'rubygems' + require 'rdoc' + require 'rdoc/markup/to_joined_paragraph' + require 'rdoc/markdown/entities' + + if RUBY_VERSION > '1.9' then + require 'rdoc/markdown/literals_1_9' + else + require 'rdoc/markdown/literals_1_8' + end + + ## + # Supported extensions + + EXTENSIONS = [] + + ## + # Extensions enabled by default + + DEFAULT_EXTENSIONS = [ + :definition_lists, + :github, + :html, + :notes, + ] + + # :section: Extensions + + ## + # Creates extension methods for the `name` extension to enable and disable + # the extension and to query if they are active. + + def self.extension name + EXTENSIONS << name + + eval <<-RUBY + def #{name}? + extension? __method__ + end + + def #{name}= enable + extension __method__, enable + end + RUBY + end + + ## + # Converts all newlines into hard breaks + + extension :break_on_newline + + ## + # Allow style blocks + + extension :css + + ## + # Allow PHP Markdown Extras style definition lists + + extension :definition_lists + + ## + # Allow Github Flavored Markdown + + extension :github + + ## + # Allow HTML + + extension :html + + ## + # Enables the notes extension + + extension :notes + + # :section: + + ## + # Parses the `markdown` document into an RDoc::Document using the default + # extensions. + + def self.parse markdown + parser = new + + parser.parse markdown + end + + # TODO remove when kpeg 0.10 is released + alias orig_initialize initialize # :nodoc: + + ## + # Creates a new markdown parser that enables the given +extensions+. + + def initialize extensions = DEFAULT_EXTENSIONS, debug = false + @debug = debug + @formatter = RDoc::Markup::ToJoinedParagraph.new + @extensions = extensions + + @references = nil + @unlinked_references = nil + + @footnotes = nil + @note_order = nil + end + + ## + # Wraps `text` in emphasis for rdoc inline formatting + + def emphasis text + if text =~ /\A[a-z\d.\/]+\z/i then + "_#{text}_" + else + "<em>#{text}</em>" + end + end + + ## + # :category: Extensions + # + # Is the extension `name` enabled? + + def extension? name + name = name.to_s.delete('?').intern + + @extensions.include? name + end + + ## + # :category: Extensions + # + # Enables or disables the extension with `name` + + def extension name, enable + name = name.to_s.delete('=').intern + + if enable then + @extensions |= [name] + else + @extensions -= [name] + end + end + + ## + # Parses `text` in a clone of this parser. This is used for handling nested + # lists the same way as markdown_parser. + + def inner_parse text # :nodoc: + parser = clone + + parser.setup_parser text, @debug + + parser.peg_parse + + doc = parser.result + + doc.accept @formatter + + doc.parts + end + + ## + # Finds a link reference for `label` and creates a new link to it with + # `content` as the link text. If `label` was not encountered in the + # reference-gathering parser pass the label and content are reconstructed + # with the linking `text` (usually whitespace). + + def link_to content, label = content, text = nil + raise 'enable notes extension' if + content.start_with? '^' and label.equal? content + + if ref = @references[label] then + "{#{content}}[#{ref}]" + elsif label.equal? content then + "[#{content}]#{text}" + else + "[#{content}]#{text}[#{label}]" + end + end + + ## + # Creates an RDoc::Markup::ListItem by parsing the `unparsed` content from + # the first parsing pass. + + def list_item_from unparsed + parsed = inner_parse unparsed.join + RDoc::Markup::ListItem.new nil, *parsed + end + + ## + # Stores `label` as a note and fills in previously unknown note references. + + def note label + #foottext = "rdoc-label:foottext-#{label}:footmark-#{label}" + + #ref.replace foottext if ref = @unlinked_notes.delete(label) + + @notes[label] = foottext + + #"{^1}[rdoc-label:footmark-#{label}:foottext-#{label}] " + end + + ## + # Creates a new link for the footnote `reference` and adds the reference to + # the note order list for proper display at the end of the document. + + def note_for ref + @note_order << ref + + label = @note_order.length + + "{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]" + end + + ## + # The internal kpeg parse method + + alias peg_parse parse # :nodoc: + + ## + # Creates an RDoc::Markup::Paragraph from `parts` and including + # extension-specific behavior + + def paragraph parts + parts = parts.map do |part| + if "\n" == part then + RDoc::Markup::HardBreak.new + else + part + end + end if break_on_newline? + + RDoc::Markup::Paragraph.new(*parts) + end + + ## + # Parses `markdown` into an RDoc::Document + + def parse markdown + @references = {} + @unlinked_references = {} + + markdown += "\n\n" + + setup_parser markdown, @debug + peg_parse 'References' + + if notes? then + @footnotes = {} + + setup_parser markdown, @debug + peg_parse 'Notes' + + # using note_order on the first pass would be a bug + @note_order = [] + end + + setup_parser markdown, @debug + peg_parse + + doc = result + + if notes? and not @footnotes.empty? then + doc << RDoc::Markup::Rule.new(1) + + @note_order.each_with_index do |ref, index| + label = index + 1 + note = @footnotes[ref] + + link = "{^#{label}}[rdoc-label:footmark-#{label}:foottext-#{label}] " + note.parts.unshift link + + doc << note + end + end + + doc.accept @formatter + + doc + end + + ## + # Stores `label` as a reference to `link` and fills in previously unknown + # link references. + + def reference label, link + if ref = @unlinked_references.delete(label) then + ref.replace link + end + + @references[label] = link + end + + ## + # Wraps `text` in strong markup for rdoc inline formatting + + def strong text + if text =~ /\A[a-z\d.\/-]+\z/i then + "*#{text}*" + else + "<b>#{text}</b>" + end + end + + + # :stopdoc: + def setup_foreign_grammar + @_grammar_literals = RDoc::Markdown::Literals.new(nil) + end + + # root = Doc + def _root + _tmp = apply(:_Doc) + set_failed_rule :_root unless _tmp + return _tmp + end + + # Doc = BOM? Block*:a { RDoc::Markup::Document.new(*a.compact) } + def _Doc + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_BOM) + unless _tmp + _tmp = true + self.pos = _save1 + end + unless _tmp + self.pos = _save + break + end + _ary = [] + while true + _tmp = apply(:_Block) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + a = @result + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::Document.new(*a.compact) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Doc unless _tmp + return _tmp + end + + # Block = BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain) + def _Block + + _save = self.pos + while true # sequence + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + + _save2 = self.pos + while true # choice + _tmp = apply(:_BlockQuote) + break if _tmp + self.pos = _save2 + _tmp = apply(:_Verbatim) + break if _tmp + self.pos = _save2 + _tmp = apply(:_CodeFence) + break if _tmp + self.pos = _save2 + _tmp = apply(:_Note) + break if _tmp + self.pos = _save2 + _tmp = apply(:_Reference) + break if _tmp + self.pos = _save2 + _tmp = apply(:_HorizontalRule) + break if _tmp + self.pos = _save2 + _tmp = apply(:_Heading) + break if _tmp + self.pos = _save2 + _tmp = apply(:_OrderedList) + break if _tmp + self.pos = _save2 + _tmp = apply(:_BulletList) + break if _tmp + self.pos = _save2 + _tmp = apply(:_DefinitionList) + break if _tmp + self.pos = _save2 + _tmp = apply(:_HtmlBlock) + break if _tmp + self.pos = _save2 + _tmp = apply(:_StyleBlock) + break if _tmp + self.pos = _save2 + _tmp = apply(:_Para) + break if _tmp + self.pos = _save2 + _tmp = apply(:_Plain) + break if _tmp + self.pos = _save2 + break + end # end choice + + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Block unless _tmp + return _tmp + end + + # Para = NonindentSpace Inlines:a BlankLine+ { paragraph a } + def _Para + + _save = self.pos + while true # sequence + _tmp = apply(:_NonindentSpace) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Inlines) + a = @result + unless _tmp + self.pos = _save + break + end + _save1 = self.pos + _tmp = apply(:_BlankLine) + if _tmp + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + else + self.pos = _save1 + end + unless _tmp + self.pos = _save + break + end + @result = begin; paragraph a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Para unless _tmp + return _tmp + end + + # Plain = Inlines:a { paragraph a } + def _Plain + + _save = self.pos + while true # sequence + _tmp = apply(:_Inlines) + a = @result + unless _tmp + self.pos = _save + break + end + @result = begin; paragraph a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Plain unless _tmp + return _tmp + end + + # AtxInline = !Newline !(Sp? "#"* Sp Newline) Inline + def _AtxInline + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_Newline) + _tmp = _tmp ? nil : true + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _save2 = self.pos + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_Sp) + unless _tmp + _tmp = true + self.pos = _save4 + end + unless _tmp + self.pos = _save3 + break + end + while true + _tmp = match_string("#") + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save3 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save3 + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + _tmp = _tmp ? nil : true + self.pos = _save2 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Inline) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_AtxInline unless _tmp + return _tmp + end + + # AtxStart = < ("######" | "#####" | "####" | "###" | "##" | "#") > { text.length } + def _AtxStart + + _save = self.pos + while true # sequence + _text_start = self.pos + + _save1 = self.pos + while true # choice + _tmp = match_string("######") + break if _tmp + self.pos = _save1 + _tmp = match_string("#####") + break if _tmp + self.pos = _save1 + _tmp = match_string("####") + break if _tmp + self.pos = _save1 + _tmp = match_string("###") + break if _tmp + self.pos = _save1 + _tmp = match_string("##") + break if _tmp + self.pos = _save1 + _tmp = match_string("#") + break if _tmp + self.pos = _save1 + break + end # end choice + + if _tmp + text = get_text(_text_start) + end + unless _tmp + self.pos = _save + break + end + @result = begin; text.length ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_AtxStart unless _tmp + return _tmp + end + + # AtxHeading = AtxStart:s Sp? AtxInline+:a (Sp? "#"* Sp)? Newline { RDoc::Markup::Heading.new(s, a.join) } + def _AtxHeading + + _save = self.pos + while true # sequence + _tmp = apply(:_AtxStart) + s = @result + unless _tmp + self.pos = _save + break + end + _save1 = self.pos + _tmp = apply(:_Sp) + unless _tmp + _tmp = true + self.pos = _save1 + end + unless _tmp + self.pos = _save + break + end + _save2 = self.pos + _ary = [] + _tmp = apply(:_AtxInline) + if _tmp + _ary << @result + while true + _tmp = apply(:_AtxInline) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + else + self.pos = _save2 + end + a = @result + unless _tmp + self.pos = _save + break + end + _save3 = self.pos + + _save4 = self.pos + while true # sequence + _save5 = self.pos + _tmp = apply(:_Sp) + unless _tmp + _tmp = true + self.pos = _save5 + end + unless _tmp + self.pos = _save4 + break + end + while true + _tmp = match_string("#") + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save4 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save4 + end + break + end # end sequence + + unless _tmp + _tmp = true + self.pos = _save3 + end + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::Heading.new(s, a.join) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_AtxHeading unless _tmp + return _tmp + end + + # SetextHeading = (SetextHeading1 | SetextHeading2) + def _SetextHeading + + _save = self.pos + while true # choice + _tmp = apply(:_SetextHeading1) + break if _tmp + self.pos = _save + _tmp = apply(:_SetextHeading2) + break if _tmp + self.pos = _save + break + end # end choice + + set_failed_rule :_SetextHeading unless _tmp + return _tmp + end + + # SetextBottom1 = "===" "="* Newline + def _SetextBottom1 + + _save = self.pos + while true # sequence + _tmp = match_string("===") + unless _tmp + self.pos = _save + break + end + while true + _tmp = match_string("=") + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_SetextBottom1 unless _tmp + return _tmp + end + + # SetextBottom2 = "---" "-"* Newline + def _SetextBottom2 + + _save = self.pos + while true # sequence + _tmp = match_string("---") + unless _tmp + self.pos = _save + break + end + while true + _tmp = match_string("-") + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_SetextBottom2 unless _tmp + return _tmp + end + + # SetextHeading1 = &(RawLine SetextBottom1) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom1 { a; RDoc::Markup::Heading.new(1, a.join) } + def _SetextHeading1 + + _save = self.pos + while true # sequence + _save1 = self.pos + + _save2 = self.pos + while true # sequence + _tmp = apply(:_RawLine) + unless _tmp + self.pos = _save2 + break + end + _tmp = apply(:_SetextBottom1) + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_StartList) + a = @result + unless _tmp + self.pos = _save + break + end + _save3 = self.pos + + _save4 = self.pos + while true # sequence + _save5 = self.pos + _tmp = apply(:_Endline) + _tmp = _tmp ? nil : true + self.pos = _save5 + unless _tmp + self.pos = _save4 + break + end + _tmp = apply(:_Inline) + b = @result + unless _tmp + self.pos = _save4 + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save4 + end + break + end # end sequence + + if _tmp + while true + + _save6 = self.pos + while true # sequence + _save7 = self.pos + _tmp = apply(:_Endline) + _tmp = _tmp ? nil : true + self.pos = _save7 + unless _tmp + self.pos = _save6 + break + end + _tmp = apply(:_Inline) + b = @result + unless _tmp + self.pos = _save6 + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save6 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + else + self.pos = _save3 + end + unless _tmp + self.pos = _save + break + end + _save8 = self.pos + _tmp = apply(:_Sp) + unless _tmp + _tmp = true + self.pos = _save8 + end + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_SetextBottom1) + unless _tmp + self.pos = _save + break + end + @result = begin; a; RDoc::Markup::Heading.new(1, a.join) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_SetextHeading1 unless _tmp + return _tmp + end + + # SetextHeading2 = &(RawLine SetextBottom2) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) } + def _SetextHeading2 + + _save = self.pos + while true # sequence + _save1 = self.pos + + _save2 = self.pos + while true # sequence + _tmp = apply(:_RawLine) + unless _tmp + self.pos = _save2 + break + end + _tmp = apply(:_SetextBottom2) + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_StartList) + a = @result + unless _tmp + self.pos = _save + break + end + _save3 = self.pos + + _save4 = self.pos + while true # sequence + _save5 = self.pos + _tmp = apply(:_Endline) + _tmp = _tmp ? nil : true + self.pos = _save5 + unless _tmp + self.pos = _save4 + break + end + _tmp = apply(:_Inline) + b = @result + unless _tmp + self.pos = _save4 + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save4 + end + break + end # end sequence + + if _tmp + while true + + _save6 = self.pos + while true # sequence + _save7 = self.pos + _tmp = apply(:_Endline) + _tmp = _tmp ? nil : true + self.pos = _save7 + unless _tmp + self.pos = _save6 + break + end + _tmp = apply(:_Inline) + b = @result + unless _tmp + self.pos = _save6 + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save6 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + else + self.pos = _save3 + end + unless _tmp + self.pos = _save + break + end + _save8 = self.pos + _tmp = apply(:_Sp) + unless _tmp + _tmp = true + self.pos = _save8 + end + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_SetextBottom2) + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::Heading.new(2, a.join) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_SetextHeading2 unless _tmp + return _tmp + end + + # Heading = (SetextHeading | AtxHeading) + def _Heading + + _save = self.pos + while true # choice + _tmp = apply(:_SetextHeading) + break if _tmp + self.pos = _save + _tmp = apply(:_AtxHeading) + break if _tmp + self.pos = _save + break + end # end choice + + set_failed_rule :_Heading unless _tmp + return _tmp + end + + # BlockQuote = BlockQuoteRaw:a { RDoc::Markup::BlockQuote.new(*a) } + def _BlockQuote + + _save = self.pos + while true # sequence + _tmp = apply(:_BlockQuoteRaw) + a = @result + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::BlockQuote.new(*a) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_BlockQuote unless _tmp + return _tmp + end + + # BlockQuoteRaw = StartList:a (">" " "? Line:l { a << l } (!">" !BlankLine Line:c { a << c })* (BlankLine:n { a << n })*)+ { inner_parse a.join } + def _BlockQuoteRaw + + _save = self.pos + while true # sequence + _tmp = apply(:_StartList) + a = @result + unless _tmp + self.pos = _save + break + end + _save1 = self.pos + + _save2 = self.pos + while true # sequence + _tmp = match_string(">") + unless _tmp + self.pos = _save2 + break + end + _save3 = self.pos + _tmp = match_string(" ") + unless _tmp + _tmp = true + self.pos = _save3 + end + unless _tmp + self.pos = _save2 + break + end + _tmp = apply(:_Line) + l = @result + unless _tmp + self.pos = _save2 + break + end + @result = begin; a << l ; end + _tmp = true + unless _tmp + self.pos = _save2 + break + end + while true + + _save5 = self.pos + while true # sequence + _save6 = self.pos + _tmp = match_string(">") + _tmp = _tmp ? nil : true + self.pos = _save6 + unless _tmp + self.pos = _save5 + break + end + _save7 = self.pos + _tmp = apply(:_BlankLine) + _tmp = _tmp ? nil : true + self.pos = _save7 + unless _tmp + self.pos = _save5 + break + end + _tmp = apply(:_Line) + c = @result + unless _tmp + self.pos = _save5 + break + end + @result = begin; a << c ; end + _tmp = true + unless _tmp + self.pos = _save5 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save2 + break + end + while true + + _save9 = self.pos + while true # sequence + _tmp = apply(:_BlankLine) + n = @result + unless _tmp + self.pos = _save9 + break + end + @result = begin; a << n ; end + _tmp = true + unless _tmp + self.pos = _save9 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + if _tmp + while true + + _save10 = self.pos + while true # sequence + _tmp = match_string(">") + unless _tmp + self.pos = _save10 + break + end + _save11 = self.pos + _tmp = match_string(" ") + unless _tmp + _tmp = true + self.pos = _save11 + end + unless _tmp + self.pos = _save10 + break + end + _tmp = apply(:_Line) + l = @result + unless _tmp + self.pos = _save10 + break + end + @result = begin; a << l ; end + _tmp = true + unless _tmp + self.pos = _save10 + break + end + while true + + _save13 = self.pos + while true # sequence + _save14 = self.pos + _tmp = match_string(">") + _tmp = _tmp ? nil : true + self.pos = _save14 + unless _tmp + self.pos = _save13 + break + end + _save15 = self.pos + _tmp = apply(:_BlankLine) + _tmp = _tmp ? nil : true + self.pos = _save15 + unless _tmp + self.pos = _save13 + break + end + _tmp = apply(:_Line) + c = @result + unless _tmp + self.pos = _save13 + break + end + @result = begin; a << c ; end + _tmp = true + unless _tmp + self.pos = _save13 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save10 + break + end + while true + + _save17 = self.pos + while true # sequence + _tmp = apply(:_BlankLine) + n = @result + unless _tmp + self.pos = _save17 + break + end + @result = begin; a << n ; end + _tmp = true + unless _tmp + self.pos = _save17 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save10 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + else + self.pos = _save1 + end + unless _tmp + self.pos = _save + break + end + @result = begin; inner_parse a.join ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_BlockQuoteRaw unless _tmp + return _tmp + end + + # NonblankIndentedLine = !BlankLine IndentedLine + def _NonblankIndentedLine + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_BlankLine) + _tmp = _tmp ? nil : true + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_IndentedLine) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_NonblankIndentedLine unless _tmp + return _tmp + end + + # VerbatimChunk = BlankLine*:a NonblankIndentedLine+:b { a.concat b } + def _VerbatimChunk + + _save = self.pos + while true # sequence + _ary = [] + while true + _tmp = apply(:_BlankLine) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + a = @result + unless _tmp + self.pos = _save + break + end + _save2 = self.pos + _ary = [] + _tmp = apply(:_NonblankIndentedLine) + if _tmp + _ary << @result + while true + _tmp = apply(:_NonblankIndentedLine) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + else + self.pos = _save2 + end + b = @result + unless _tmp + self.pos = _save + break + end + @result = begin; a.concat b ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_VerbatimChunk unless _tmp + return _tmp + end + + # Verbatim = VerbatimChunk+:a { RDoc::Markup::Verbatim.new(*a.flatten) } + def _Verbatim + + _save = self.pos + while true # sequence + _save1 = self.pos + _ary = [] + _tmp = apply(:_VerbatimChunk) + if _tmp + _ary << @result + while true + _tmp = apply(:_VerbatimChunk) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + else + self.pos = _save1 + end + a = @result + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::Verbatim.new(*a.flatten) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Verbatim unless _tmp + return _tmp + end + + # HorizontalRule = NonindentSpace ("*" Sp "*" Sp "*" (Sp "*")* | "-" Sp "-" Sp "-" (Sp "-")* | "_" Sp "_" Sp "_" (Sp "_")*) Sp Newline BlankLine+ { RDoc::Markup::Rule.new 1 } + def _HorizontalRule + + _save = self.pos + while true # sequence + _tmp = apply(:_NonindentSpace) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + + _save2 = self.pos + while true # sequence + _tmp = match_string("*") + unless _tmp + self.pos = _save2 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save2 + break + end + _tmp = match_string("*") + unless _tmp + self.pos = _save2 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save2 + break + end + _tmp = match_string("*") + unless _tmp + self.pos = _save2 + break + end + while true + + _save4 = self.pos + while true # sequence + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save4 + break + end + _tmp = match_string("*") + unless _tmp + self.pos = _save4 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + break if _tmp + self.pos = _save1 + + _save5 = self.pos + while true # sequence + _tmp = match_string("-") + unless _tmp + self.pos = _save5 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save5 + break + end + _tmp = match_string("-") + unless _tmp + self.pos = _save5 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save5 + break + end + _tmp = match_string("-") + unless _tmp + self.pos = _save5 + break + end + while true + + _save7 = self.pos + while true # sequence + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save7 + break + end + _tmp = match_string("-") + unless _tmp + self.pos = _save7 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save5 + end + break + end # end sequence + + break if _tmp + self.pos = _save1 + + _save8 = self.pos + while true # sequence + _tmp = match_string("_") + unless _tmp + self.pos = _save8 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save8 + break + end + _tmp = match_string("_") + unless _tmp + self.pos = _save8 + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save8 + break + end + _tmp = match_string("_") + unless _tmp + self.pos = _save8 + break + end + while true + + _save10 = self.pos + while true # sequence + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save10 + break + end + _tmp = match_string("_") + unless _tmp + self.pos = _save10 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save8 + end + break + end # end sequence + + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Sp) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Newline) + unless _tmp + self.pos = _save + break + end + _save11 = self.pos + _tmp = apply(:_BlankLine) + if _tmp + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + else + self.pos = _save11 + end + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::Rule.new 1 ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HorizontalRule unless _tmp + return _tmp + end + + # Bullet = !HorizontalRule NonindentSpace ("+" | "*" | "-") Spacechar+ + def _Bullet + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_HorizontalRule) + _tmp = _tmp ? nil : true + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_NonindentSpace) + unless _tmp + self.pos = _save + break + end + + _save2 = self.pos + while true # choice + _tmp = match_string("+") + break if _tmp + self.pos = _save2 + _tmp = match_string("*") + break if _tmp + self.pos = _save2 + _tmp = match_string("-") + break if _tmp + self.pos = _save2 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _save3 = self.pos + _tmp = apply(:_Spacechar) + if _tmp + while true + _tmp = apply(:_Spacechar) + break unless _tmp + end + _tmp = true + else + self.pos = _save3 + end + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Bullet unless _tmp + return _tmp + end + + # BulletList = &Bullet (ListTight | ListLoose):a { RDoc::Markup::List.new(:BULLET, *a) } + def _BulletList + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_Bullet) + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + + _save2 = self.pos + while true # choice + _tmp = apply(:_ListTight) + break if _tmp + self.pos = _save2 + _tmp = apply(:_ListLoose) + break if _tmp + self.pos = _save2 + break + end # end choice + + a = @result + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::List.new(:BULLET, *a) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_BulletList unless _tmp + return _tmp + end + + # ListTight = ListItemTight+:a BlankLine* !(Bullet | Enumerator) { a } + def _ListTight + + _save = self.pos + while true # sequence + _save1 = self.pos + _ary = [] + _tmp = apply(:_ListItemTight) + if _tmp + _ary << @result + while true + _tmp = apply(:_ListItemTight) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + else + self.pos = _save1 + end + a = @result + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _save3 = self.pos + + _save4 = self.pos + while true # choice + _tmp = apply(:_Bullet) + break if _tmp + self.pos = _save4 + _tmp = apply(:_Enumerator) + break if _tmp + self.pos = _save4 + break + end # end choice + + _tmp = _tmp ? nil : true + self.pos = _save3 + unless _tmp + self.pos = _save + break + end + @result = begin; a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListTight unless _tmp + return _tmp + end + + # ListLoose = StartList:a (ListItem:b BlankLine* { a << b })+ { a } + def _ListLoose + + _save = self.pos + while true # sequence + _tmp = apply(:_StartList) + a = @result + unless _tmp + self.pos = _save + break + end + _save1 = self.pos + + _save2 = self.pos + while true # sequence + _tmp = apply(:_ListItem) + b = @result + unless _tmp + self.pos = _save2 + break + end + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save2 + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + if _tmp + while true + + _save4 = self.pos + while true # sequence + _tmp = apply(:_ListItem) + b = @result + unless _tmp + self.pos = _save4 + break + end + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save4 + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save4 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + else + self.pos = _save1 + end + unless _tmp + self.pos = _save + break + end + @result = begin; a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListLoose unless _tmp + return _tmp + end + + # ListItem = (Bullet | Enumerator) StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a } + def _ListItem + + _save = self.pos + while true # sequence + + _save1 = self.pos + while true # choice + _tmp = apply(:_Bullet) + break if _tmp + self.pos = _save1 + _tmp = apply(:_Enumerator) + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_StartList) + a = @result + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_ListBlock) + b = @result + unless _tmp + self.pos = _save + break + end + @result = begin; a << b ; end + _tmp = true + unless _tmp + self.pos = _save + break + end + while true + + _save3 = self.pos + while true # sequence + _tmp = apply(:_ListContinuationBlock) + c = @result + unless _tmp + self.pos = _save3 + break + end + @result = begin; a.push(*c) ; end + _tmp = true + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + @result = begin; list_item_from a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListItem unless _tmp + return _tmp + end + + # ListItemTight = (Bullet | Enumerator) ListBlock:a (!BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a } + def _ListItemTight + + _save = self.pos + while true # sequence + + _save1 = self.pos + while true # choice + _tmp = apply(:_Bullet) + break if _tmp + self.pos = _save1 + _tmp = apply(:_Enumerator) + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_ListBlock) + a = @result + unless _tmp + self.pos = _save + break + end + while true + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_BlankLine) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = apply(:_ListContinuationBlock) + b = @result + unless _tmp + self.pos = _save3 + break + end + @result = begin; a.push(*b) ; end + _tmp = true + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _save5 = self.pos + _tmp = apply(:_ListContinuationBlock) + _tmp = _tmp ? nil : true + self.pos = _save5 + unless _tmp + self.pos = _save + break + end + @result = begin; list_item_from a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListItemTight unless _tmp + return _tmp + end + + # ListBlock = !BlankLine Line:a ListBlockLine*:c { [a, *c] } + def _ListBlock + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_BlankLine) + _tmp = _tmp ? nil : true + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Line) + a = @result + unless _tmp + self.pos = _save + break + end + _ary = [] + while true + _tmp = apply(:_ListBlockLine) + _ary << @result if _tmp + break unless _tmp + end + _tmp = true + @result = _ary + c = @result + unless _tmp + self.pos = _save + break + end + @result = begin; [a, *c] ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListBlock unless _tmp + return _tmp + end + + # ListContinuationBlock = StartList:a < BlankLine* > { a << "\n" } (Indent ListBlock:b { a.concat b })+ { a } + def _ListContinuationBlock + + _save = self.pos + while true # sequence + _tmp = apply(:_StartList) + a = @result + unless _tmp + self.pos = _save + break + end + _text_start = self.pos + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + if _tmp + text = get_text(_text_start) + end + unless _tmp + self.pos = _save + break + end + @result = begin; a << "\n" ; end + _tmp = true + unless _tmp + self.pos = _save + break + end + _save2 = self.pos + + _save3 = self.pos + while true # sequence + _tmp = apply(:_Indent) + unless _tmp + self.pos = _save3 + break + end + _tmp = apply(:_ListBlock) + b = @result + unless _tmp + self.pos = _save3 + break + end + @result = begin; a.concat b ; end + _tmp = true + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + if _tmp + while true + + _save4 = self.pos + while true # sequence + _tmp = apply(:_Indent) + unless _tmp + self.pos = _save4 + break + end + _tmp = apply(:_ListBlock) + b = @result + unless _tmp + self.pos = _save4 + break + end + @result = begin; a.concat b ; end + _tmp = true + unless _tmp + self.pos = _save4 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + else + self.pos = _save2 + end + unless _tmp + self.pos = _save + break + end + @result = begin; a ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListContinuationBlock unless _tmp + return _tmp + end + + # Enumerator = NonindentSpace [0-9]+ "." Spacechar+ + def _Enumerator + + _save = self.pos + while true # sequence + _tmp = apply(:_NonindentSpace) + unless _tmp + self.pos = _save + break + end + _save1 = self.pos + _save2 = self.pos + _tmp = get_byte + if _tmp + unless _tmp >= 48 and _tmp <= 57 + self.pos = _save2 + _tmp = nil + end + end + if _tmp + while true + _save3 = self.pos + _tmp = get_byte + if _tmp + unless _tmp >= 48 and _tmp <= 57 + self.pos = _save3 + _tmp = nil + end + end + break unless _tmp + end + _tmp = true + else + self.pos = _save1 + end + unless _tmp + self.pos = _save + break + end + _tmp = match_string(".") + unless _tmp + self.pos = _save + break + end + _save4 = self.pos + _tmp = apply(:_Spacechar) + if _tmp + while true + _tmp = apply(:_Spacechar) + break unless _tmp + end + _tmp = true + else + self.pos = _save4 + end + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_Enumerator unless _tmp + return _tmp + end + + # OrderedList = &Enumerator (ListTight | ListLoose):a { RDoc::Markup::List.new(:NUMBER, *a) } + def _OrderedList + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_Enumerator) + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + + _save2 = self.pos + while true # choice + _tmp = apply(:_ListTight) + break if _tmp + self.pos = _save2 + _tmp = apply(:_ListLoose) + break if _tmp + self.pos = _save2 + break + end # end choice + + a = @result + unless _tmp + self.pos = _save + break + end + @result = begin; RDoc::Markup::List.new(:NUMBER, *a) ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_OrderedList unless _tmp + return _tmp + end + + # ListBlockLine = !BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine + def _ListBlockLine + + _save = self.pos + while true # sequence + _save1 = self.pos + _tmp = apply(:_BlankLine) + _tmp = _tmp ? nil : true + self.pos = _save1 + unless _tmp + self.pos = _save + break + end + _save2 = self.pos + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_Indent) + unless _tmp + _tmp = true + self.pos = _save4 + end + unless _tmp + self.pos = _save3 + break + end + + _save5 = self.pos + while true # choice + _tmp = apply(:_Bullet) + break if _tmp + self.pos = _save5 + _tmp = apply(:_Enumerator) + break if _tmp + self.pos = _save5 + break + end # end choice + + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + _tmp = _tmp ? nil : true + self.pos = _save2 + unless _tmp + self.pos = _save + break + end + _save6 = self.pos + _tmp = apply(:_HorizontalRule) + _tmp = _tmp ? nil : true + self.pos = _save6 + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_OptionallyIndentedLine) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_ListBlockLine unless _tmp + return _tmp + end + + # HtmlBlockOpenAddress = "<" Spnl ("address" | "ADDRESS") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenAddress + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("address") + break if _tmp + self.pos = _save1 + _tmp = match_string("ADDRESS") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenAddress unless _tmp + return _tmp + end + + # HtmlBlockCloseAddress = "<" Spnl "/" ("address" | "ADDRESS") Spnl ">" + def _HtmlBlockCloseAddress + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("address") + break if _tmp + self.pos = _save1 + _tmp = match_string("ADDRESS") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseAddress unless _tmp + return _tmp + end + + # HtmlBlockAddress = HtmlBlockOpenAddress (HtmlBlockAddress | !HtmlBlockCloseAddress .)* HtmlBlockCloseAddress + def _HtmlBlockAddress + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenAddress) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockAddress) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseAddress) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseAddress) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockAddress unless _tmp + return _tmp + end + + # HtmlBlockOpenBlockquote = "<" Spnl ("blockquote" | "BLOCKQUOTE") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenBlockquote + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("blockquote") + break if _tmp + self.pos = _save1 + _tmp = match_string("BLOCKQUOTE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenBlockquote unless _tmp + return _tmp + end + + # HtmlBlockCloseBlockquote = "<" Spnl "/" ("blockquote" | "BLOCKQUOTE") Spnl ">" + def _HtmlBlockCloseBlockquote + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("blockquote") + break if _tmp + self.pos = _save1 + _tmp = match_string("BLOCKQUOTE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseBlockquote unless _tmp + return _tmp + end + + # HtmlBlockBlockquote = HtmlBlockOpenBlockquote (HtmlBlockBlockquote | !HtmlBlockCloseBlockquote .)* HtmlBlockCloseBlockquote + def _HtmlBlockBlockquote + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenBlockquote) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockBlockquote) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseBlockquote) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseBlockquote) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockBlockquote unless _tmp + return _tmp + end + + # HtmlBlockOpenCenter = "<" Spnl ("center" | "CENTER") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenCenter + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("center") + break if _tmp + self.pos = _save1 + _tmp = match_string("CENTER") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenCenter unless _tmp + return _tmp + end + + # HtmlBlockCloseCenter = "<" Spnl "/" ("center" | "CENTER") Spnl ">" + def _HtmlBlockCloseCenter + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("center") + break if _tmp + self.pos = _save1 + _tmp = match_string("CENTER") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseCenter unless _tmp + return _tmp + end + + # HtmlBlockCenter = HtmlBlockOpenCenter (HtmlBlockCenter | !HtmlBlockCloseCenter .)* HtmlBlockCloseCenter + def _HtmlBlockCenter + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenCenter) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockCenter) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseCenter) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseCenter) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCenter unless _tmp + return _tmp + end + + # HtmlBlockOpenDir = "<" Spnl ("dir" | "DIR") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenDir + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dir") + break if _tmp + self.pos = _save1 + _tmp = match_string("DIR") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenDir unless _tmp + return _tmp + end + + # HtmlBlockCloseDir = "<" Spnl "/" ("dir" | "DIR") Spnl ">" + def _HtmlBlockCloseDir + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dir") + break if _tmp + self.pos = _save1 + _tmp = match_string("DIR") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseDir unless _tmp + return _tmp + end + + # HtmlBlockDir = HtmlBlockOpenDir (HtmlBlockDir | !HtmlBlockCloseDir .)* HtmlBlockCloseDir + def _HtmlBlockDir + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenDir) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockDir) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseDir) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseDir) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockDir unless _tmp + return _tmp + end + + # HtmlBlockOpenDiv = "<" Spnl ("div" | "DIV") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenDiv + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("div") + break if _tmp + self.pos = _save1 + _tmp = match_string("DIV") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenDiv unless _tmp + return _tmp + end + + # HtmlBlockCloseDiv = "<" Spnl "/" ("div" | "DIV") Spnl ">" + def _HtmlBlockCloseDiv + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("div") + break if _tmp + self.pos = _save1 + _tmp = match_string("DIV") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseDiv unless _tmp + return _tmp + end + + # HtmlBlockDiv = HtmlBlockOpenDiv (HtmlBlockDiv | !HtmlBlockCloseDiv .)* HtmlBlockCloseDiv + def _HtmlBlockDiv + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenDiv) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockDiv) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseDiv) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseDiv) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockDiv unless _tmp + return _tmp + end + + # HtmlBlockOpenDl = "<" Spnl ("dl" | "DL") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenDl + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dl") + break if _tmp + self.pos = _save1 + _tmp = match_string("DL") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenDl unless _tmp + return _tmp + end + + # HtmlBlockCloseDl = "<" Spnl "/" ("dl" | "DL") Spnl ">" + def _HtmlBlockCloseDl + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dl") + break if _tmp + self.pos = _save1 + _tmp = match_string("DL") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseDl unless _tmp + return _tmp + end + + # HtmlBlockDl = HtmlBlockOpenDl (HtmlBlockDl | !HtmlBlockCloseDl .)* HtmlBlockCloseDl + def _HtmlBlockDl + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenDl) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockDl) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseDl) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseDl) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockDl unless _tmp + return _tmp + end + + # HtmlBlockOpenFieldset = "<" Spnl ("fieldset" | "FIELDSET") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenFieldset + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("fieldset") + break if _tmp + self.pos = _save1 + _tmp = match_string("FIELDSET") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenFieldset unless _tmp + return _tmp + end + + # HtmlBlockCloseFieldset = "<" Spnl "/" ("fieldset" | "FIELDSET") Spnl ">" + def _HtmlBlockCloseFieldset + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("fieldset") + break if _tmp + self.pos = _save1 + _tmp = match_string("FIELDSET") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseFieldset unless _tmp + return _tmp + end + + # HtmlBlockFieldset = HtmlBlockOpenFieldset (HtmlBlockFieldset | !HtmlBlockCloseFieldset .)* HtmlBlockCloseFieldset + def _HtmlBlockFieldset + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenFieldset) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockFieldset) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseFieldset) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseFieldset) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockFieldset unless _tmp + return _tmp + end + + # HtmlBlockOpenForm = "<" Spnl ("form" | "FORM") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenForm + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("form") + break if _tmp + self.pos = _save1 + _tmp = match_string("FORM") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenForm unless _tmp + return _tmp + end + + # HtmlBlockCloseForm = "<" Spnl "/" ("form" | "FORM") Spnl ">" + def _HtmlBlockCloseForm + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("form") + break if _tmp + self.pos = _save1 + _tmp = match_string("FORM") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseForm unless _tmp + return _tmp + end + + # HtmlBlockForm = HtmlBlockOpenForm (HtmlBlockForm | !HtmlBlockCloseForm .)* HtmlBlockCloseForm + def _HtmlBlockForm + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenForm) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockForm) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseForm) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseForm) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockForm unless _tmp + return _tmp + end + + # HtmlBlockOpenH1 = "<" Spnl ("h1" | "H1") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenH1 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h1") + break if _tmp + self.pos = _save1 + _tmp = match_string("H1") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenH1 unless _tmp + return _tmp + end + + # HtmlBlockCloseH1 = "<" Spnl "/" ("h1" | "H1") Spnl ">" + def _HtmlBlockCloseH1 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h1") + break if _tmp + self.pos = _save1 + _tmp = match_string("H1") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseH1 unless _tmp + return _tmp + end + + # HtmlBlockH1 = HtmlBlockOpenH1 (HtmlBlockH1 | !HtmlBlockCloseH1 .)* HtmlBlockCloseH1 + def _HtmlBlockH1 + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenH1) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockH1) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseH1) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseH1) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockH1 unless _tmp + return _tmp + end + + # HtmlBlockOpenH2 = "<" Spnl ("h2" | "H2") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenH2 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h2") + break if _tmp + self.pos = _save1 + _tmp = match_string("H2") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenH2 unless _tmp + return _tmp + end + + # HtmlBlockCloseH2 = "<" Spnl "/" ("h2" | "H2") Spnl ">" + def _HtmlBlockCloseH2 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h2") + break if _tmp + self.pos = _save1 + _tmp = match_string("H2") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseH2 unless _tmp + return _tmp + end + + # HtmlBlockH2 = HtmlBlockOpenH2 (HtmlBlockH2 | !HtmlBlockCloseH2 .)* HtmlBlockCloseH2 + def _HtmlBlockH2 + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenH2) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockH2) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseH2) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseH2) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockH2 unless _tmp + return _tmp + end + + # HtmlBlockOpenH3 = "<" Spnl ("h3" | "H3") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenH3 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h3") + break if _tmp + self.pos = _save1 + _tmp = match_string("H3") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenH3 unless _tmp + return _tmp + end + + # HtmlBlockCloseH3 = "<" Spnl "/" ("h3" | "H3") Spnl ">" + def _HtmlBlockCloseH3 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h3") + break if _tmp + self.pos = _save1 + _tmp = match_string("H3") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseH3 unless _tmp + return _tmp + end + + # HtmlBlockH3 = HtmlBlockOpenH3 (HtmlBlockH3 | !HtmlBlockCloseH3 .)* HtmlBlockCloseH3 + def _HtmlBlockH3 + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenH3) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockH3) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseH3) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseH3) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockH3 unless _tmp + return _tmp + end + + # HtmlBlockOpenH4 = "<" Spnl ("h4" | "H4") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenH4 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h4") + break if _tmp + self.pos = _save1 + _tmp = match_string("H4") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenH4 unless _tmp + return _tmp + end + + # HtmlBlockCloseH4 = "<" Spnl "/" ("h4" | "H4") Spnl ">" + def _HtmlBlockCloseH4 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h4") + break if _tmp + self.pos = _save1 + _tmp = match_string("H4") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseH4 unless _tmp + return _tmp + end + + # HtmlBlockH4 = HtmlBlockOpenH4 (HtmlBlockH4 | !HtmlBlockCloseH4 .)* HtmlBlockCloseH4 + def _HtmlBlockH4 + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenH4) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockH4) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseH4) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseH4) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockH4 unless _tmp + return _tmp + end + + # HtmlBlockOpenH5 = "<" Spnl ("h5" | "H5") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenH5 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h5") + break if _tmp + self.pos = _save1 + _tmp = match_string("H5") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenH5 unless _tmp + return _tmp + end + + # HtmlBlockCloseH5 = "<" Spnl "/" ("h5" | "H5") Spnl ">" + def _HtmlBlockCloseH5 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h5") + break if _tmp + self.pos = _save1 + _tmp = match_string("H5") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseH5 unless _tmp + return _tmp + end + + # HtmlBlockH5 = HtmlBlockOpenH5 (HtmlBlockH5 | !HtmlBlockCloseH5 .)* HtmlBlockCloseH5 + def _HtmlBlockH5 + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenH5) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockH5) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseH5) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseH5) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockH5 unless _tmp + return _tmp + end + + # HtmlBlockOpenH6 = "<" Spnl ("h6" | "H6") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenH6 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h6") + break if _tmp + self.pos = _save1 + _tmp = match_string("H6") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenH6 unless _tmp + return _tmp + end + + # HtmlBlockCloseH6 = "<" Spnl "/" ("h6" | "H6") Spnl ">" + def _HtmlBlockCloseH6 + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("h6") + break if _tmp + self.pos = _save1 + _tmp = match_string("H6") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseH6 unless _tmp + return _tmp + end + + # HtmlBlockH6 = HtmlBlockOpenH6 (HtmlBlockH6 | !HtmlBlockCloseH6 .)* HtmlBlockCloseH6 + def _HtmlBlockH6 + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenH6) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockH6) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseH6) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseH6) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockH6 unless _tmp + return _tmp + end + + # HtmlBlockOpenMenu = "<" Spnl ("menu" | "MENU") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenMenu + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("menu") + break if _tmp + self.pos = _save1 + _tmp = match_string("MENU") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenMenu unless _tmp + return _tmp + end + + # HtmlBlockCloseMenu = "<" Spnl "/" ("menu" | "MENU") Spnl ">" + def _HtmlBlockCloseMenu + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("menu") + break if _tmp + self.pos = _save1 + _tmp = match_string("MENU") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseMenu unless _tmp + return _tmp + end + + # HtmlBlockMenu = HtmlBlockOpenMenu (HtmlBlockMenu | !HtmlBlockCloseMenu .)* HtmlBlockCloseMenu + def _HtmlBlockMenu + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenMenu) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockMenu) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseMenu) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseMenu) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockMenu unless _tmp + return _tmp + end + + # HtmlBlockOpenNoframes = "<" Spnl ("noframes" | "NOFRAMES") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenNoframes + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("noframes") + break if _tmp + self.pos = _save1 + _tmp = match_string("NOFRAMES") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenNoframes unless _tmp + return _tmp + end + + # HtmlBlockCloseNoframes = "<" Spnl "/" ("noframes" | "NOFRAMES") Spnl ">" + def _HtmlBlockCloseNoframes + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("noframes") + break if _tmp + self.pos = _save1 + _tmp = match_string("NOFRAMES") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseNoframes unless _tmp + return _tmp + end + + # HtmlBlockNoframes = HtmlBlockOpenNoframes (HtmlBlockNoframes | !HtmlBlockCloseNoframes .)* HtmlBlockCloseNoframes + def _HtmlBlockNoframes + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenNoframes) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockNoframes) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseNoframes) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseNoframes) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockNoframes unless _tmp + return _tmp + end + + # HtmlBlockOpenNoscript = "<" Spnl ("noscript" | "NOSCRIPT") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenNoscript + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("noscript") + break if _tmp + self.pos = _save1 + _tmp = match_string("NOSCRIPT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenNoscript unless _tmp + return _tmp + end + + # HtmlBlockCloseNoscript = "<" Spnl "/" ("noscript" | "NOSCRIPT") Spnl ">" + def _HtmlBlockCloseNoscript + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("noscript") + break if _tmp + self.pos = _save1 + _tmp = match_string("NOSCRIPT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseNoscript unless _tmp + return _tmp + end + + # HtmlBlockNoscript = HtmlBlockOpenNoscript (HtmlBlockNoscript | !HtmlBlockCloseNoscript .)* HtmlBlockCloseNoscript + def _HtmlBlockNoscript + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenNoscript) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockNoscript) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseNoscript) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseNoscript) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockNoscript unless _tmp + return _tmp + end + + # HtmlBlockOpenOl = "<" Spnl ("ol" | "OL") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenOl + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("ol") + break if _tmp + self.pos = _save1 + _tmp = match_string("OL") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenOl unless _tmp + return _tmp + end + + # HtmlBlockCloseOl = "<" Spnl "/" ("ol" | "OL") Spnl ">" + def _HtmlBlockCloseOl + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("ol") + break if _tmp + self.pos = _save1 + _tmp = match_string("OL") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseOl unless _tmp + return _tmp + end + + # HtmlBlockOl = HtmlBlockOpenOl (HtmlBlockOl | !HtmlBlockCloseOl .)* HtmlBlockCloseOl + def _HtmlBlockOl + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenOl) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockOl) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseOl) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseOl) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOl unless _tmp + return _tmp + end + + # HtmlBlockOpenP = "<" Spnl ("p" | "P") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenP + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("p") + break if _tmp + self.pos = _save1 + _tmp = match_string("P") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenP unless _tmp + return _tmp + end + + # HtmlBlockCloseP = "<" Spnl "/" ("p" | "P") Spnl ">" + def _HtmlBlockCloseP + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("p") + break if _tmp + self.pos = _save1 + _tmp = match_string("P") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseP unless _tmp + return _tmp + end + + # HtmlBlockP = HtmlBlockOpenP (HtmlBlockP | !HtmlBlockCloseP .)* HtmlBlockCloseP + def _HtmlBlockP + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenP) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockP) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseP) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseP) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockP unless _tmp + return _tmp + end + + # HtmlBlockOpenPre = "<" Spnl ("pre" | "PRE") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenPre + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("pre") + break if _tmp + self.pos = _save1 + _tmp = match_string("PRE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenPre unless _tmp + return _tmp + end + + # HtmlBlockClosePre = "<" Spnl "/" ("pre" | "PRE") Spnl ">" + def _HtmlBlockClosePre + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("pre") + break if _tmp + self.pos = _save1 + _tmp = match_string("PRE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockClosePre unless _tmp + return _tmp + end + + # HtmlBlockPre = HtmlBlockOpenPre (HtmlBlockPre | !HtmlBlockClosePre .)* HtmlBlockClosePre + def _HtmlBlockPre + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenPre) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockPre) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockClosePre) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockClosePre) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockPre unless _tmp + return _tmp + end + + # HtmlBlockOpenTable = "<" Spnl ("table" | "TABLE") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenTable + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("table") + break if _tmp + self.pos = _save1 + _tmp = match_string("TABLE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenTable unless _tmp + return _tmp + end + + # HtmlBlockCloseTable = "<" Spnl "/" ("table" | "TABLE") Spnl ">" + def _HtmlBlockCloseTable + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("table") + break if _tmp + self.pos = _save1 + _tmp = match_string("TABLE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseTable unless _tmp + return _tmp + end + + # HtmlBlockTable = HtmlBlockOpenTable (HtmlBlockTable | !HtmlBlockCloseTable .)* HtmlBlockCloseTable + def _HtmlBlockTable + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenTable) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockTable) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseTable) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseTable) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockTable unless _tmp + return _tmp + end + + # HtmlBlockOpenUl = "<" Spnl ("ul" | "UL") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenUl + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("ul") + break if _tmp + self.pos = _save1 + _tmp = match_string("UL") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenUl unless _tmp + return _tmp + end + + # HtmlBlockCloseUl = "<" Spnl "/" ("ul" | "UL") Spnl ">" + def _HtmlBlockCloseUl + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("ul") + break if _tmp + self.pos = _save1 + _tmp = match_string("UL") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseUl unless _tmp + return _tmp + end + + # HtmlBlockUl = HtmlBlockOpenUl (HtmlBlockUl | !HtmlBlockCloseUl .)* HtmlBlockCloseUl + def _HtmlBlockUl + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenUl) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockUl) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseUl) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseUl) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockUl unless _tmp + return _tmp + end + + # HtmlBlockOpenDd = "<" Spnl ("dd" | "DD") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenDd + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dd") + break if _tmp + self.pos = _save1 + _tmp = match_string("DD") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenDd unless _tmp + return _tmp + end + + # HtmlBlockCloseDd = "<" Spnl "/" ("dd" | "DD") Spnl ">" + def _HtmlBlockCloseDd + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dd") + break if _tmp + self.pos = _save1 + _tmp = match_string("DD") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseDd unless _tmp + return _tmp + end + + # HtmlBlockDd = HtmlBlockOpenDd (HtmlBlockDd | !HtmlBlockCloseDd .)* HtmlBlockCloseDd + def _HtmlBlockDd + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenDd) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockDd) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseDd) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseDd) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockDd unless _tmp + return _tmp + end + + # HtmlBlockOpenDt = "<" Spnl ("dt" | "DT") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenDt + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dt") + break if _tmp + self.pos = _save1 + _tmp = match_string("DT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenDt unless _tmp + return _tmp + end + + # HtmlBlockCloseDt = "<" Spnl "/" ("dt" | "DT") Spnl ">" + def _HtmlBlockCloseDt + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("dt") + break if _tmp + self.pos = _save1 + _tmp = match_string("DT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseDt unless _tmp + return _tmp + end + + # HtmlBlockDt = HtmlBlockOpenDt (HtmlBlockDt | !HtmlBlockCloseDt .)* HtmlBlockCloseDt + def _HtmlBlockDt + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenDt) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockDt) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseDt) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseDt) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockDt unless _tmp + return _tmp + end + + # HtmlBlockOpenFrameset = "<" Spnl ("frameset" | "FRAMESET") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenFrameset + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("frameset") + break if _tmp + self.pos = _save1 + _tmp = match_string("FRAMESET") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenFrameset unless _tmp + return _tmp + end + + # HtmlBlockCloseFrameset = "<" Spnl "/" ("frameset" | "FRAMESET") Spnl ">" + def _HtmlBlockCloseFrameset + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("frameset") + break if _tmp + self.pos = _save1 + _tmp = match_string("FRAMESET") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseFrameset unless _tmp + return _tmp + end + + # HtmlBlockFrameset = HtmlBlockOpenFrameset (HtmlBlockFrameset | !HtmlBlockCloseFrameset .)* HtmlBlockCloseFrameset + def _HtmlBlockFrameset + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenFrameset) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockFrameset) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseFrameset) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseFrameset) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockFrameset unless _tmp + return _tmp + end + + # HtmlBlockOpenLi = "<" Spnl ("li" | "LI") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenLi + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("li") + break if _tmp + self.pos = _save1 + _tmp = match_string("LI") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenLi unless _tmp + return _tmp + end + + # HtmlBlockCloseLi = "<" Spnl "/" ("li" | "LI") Spnl ">" + def _HtmlBlockCloseLi + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("li") + break if _tmp + self.pos = _save1 + _tmp = match_string("LI") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseLi unless _tmp + return _tmp + end + + # HtmlBlockLi = HtmlBlockOpenLi (HtmlBlockLi | !HtmlBlockCloseLi .)* HtmlBlockCloseLi + def _HtmlBlockLi + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenLi) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockLi) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseLi) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseLi) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockLi unless _tmp + return _tmp + end + + # HtmlBlockOpenTbody = "<" Spnl ("tbody" | "TBODY") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenTbody + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("tbody") + break if _tmp + self.pos = _save1 + _tmp = match_string("TBODY") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenTbody unless _tmp + return _tmp + end + + # HtmlBlockCloseTbody = "<" Spnl "/" ("tbody" | "TBODY") Spnl ">" + def _HtmlBlockCloseTbody + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("tbody") + break if _tmp + self.pos = _save1 + _tmp = match_string("TBODY") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseTbody unless _tmp + return _tmp + end + + # HtmlBlockTbody = HtmlBlockOpenTbody (HtmlBlockTbody | !HtmlBlockCloseTbody .)* HtmlBlockCloseTbody + def _HtmlBlockTbody + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenTbody) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockTbody) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseTbody) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseTbody) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockTbody unless _tmp + return _tmp + end + + # HtmlBlockOpenTd = "<" Spnl ("td" | "TD") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenTd + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("td") + break if _tmp + self.pos = _save1 + _tmp = match_string("TD") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenTd unless _tmp + return _tmp + end + + # HtmlBlockCloseTd = "<" Spnl "/" ("td" | "TD") Spnl ">" + def _HtmlBlockCloseTd + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("td") + break if _tmp + self.pos = _save1 + _tmp = match_string("TD") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseTd unless _tmp + return _tmp + end + + # HtmlBlockTd = HtmlBlockOpenTd (HtmlBlockTd | !HtmlBlockCloseTd .)* HtmlBlockCloseTd + def _HtmlBlockTd + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenTd) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockTd) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseTd) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseTd) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockTd unless _tmp + return _tmp + end + + # HtmlBlockOpenTfoot = "<" Spnl ("tfoot" | "TFOOT") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenTfoot + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("tfoot") + break if _tmp + self.pos = _save1 + _tmp = match_string("TFOOT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenTfoot unless _tmp + return _tmp + end + + # HtmlBlockCloseTfoot = "<" Spnl "/" ("tfoot" | "TFOOT") Spnl ">" + def _HtmlBlockCloseTfoot + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("tfoot") + break if _tmp + self.pos = _save1 + _tmp = match_string("TFOOT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseTfoot unless _tmp + return _tmp + end + + # HtmlBlockTfoot = HtmlBlockOpenTfoot (HtmlBlockTfoot | !HtmlBlockCloseTfoot .)* HtmlBlockCloseTfoot + def _HtmlBlockTfoot + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenTfoot) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockTfoot) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseTfoot) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseTfoot) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockTfoot unless _tmp + return _tmp + end + + # HtmlBlockOpenTh = "<" Spnl ("th" | "TH") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenTh + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("th") + break if _tmp + self.pos = _save1 + _tmp = match_string("TH") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenTh unless _tmp + return _tmp + end + + # HtmlBlockCloseTh = "<" Spnl "/" ("th" | "TH") Spnl ">" + def _HtmlBlockCloseTh + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("th") + break if _tmp + self.pos = _save1 + _tmp = match_string("TH") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseTh unless _tmp + return _tmp + end + + # HtmlBlockTh = HtmlBlockOpenTh (HtmlBlockTh | !HtmlBlockCloseTh .)* HtmlBlockCloseTh + def _HtmlBlockTh + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenTh) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockTh) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseTh) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseTh) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockTh unless _tmp + return _tmp + end + + # HtmlBlockOpenThead = "<" Spnl ("thead" | "THEAD") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenThead + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("thead") + break if _tmp + self.pos = _save1 + _tmp = match_string("THEAD") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenThead unless _tmp + return _tmp + end + + # HtmlBlockCloseThead = "<" Spnl "/" ("thead" | "THEAD") Spnl ">" + def _HtmlBlockCloseThead + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("thead") + break if _tmp + self.pos = _save1 + _tmp = match_string("THEAD") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseThead unless _tmp + return _tmp + end + + # HtmlBlockThead = HtmlBlockOpenThead (HtmlBlockThead | !HtmlBlockCloseThead .)* HtmlBlockCloseThead + def _HtmlBlockThead + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenThead) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockThead) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseThead) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseThead) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockThead unless _tmp + return _tmp + end + + # HtmlBlockOpenTr = "<" Spnl ("tr" | "TR") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenTr + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("tr") + break if _tmp + self.pos = _save1 + _tmp = match_string("TR") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenTr unless _tmp + return _tmp + end + + # HtmlBlockCloseTr = "<" Spnl "/" ("tr" | "TR") Spnl ">" + def _HtmlBlockCloseTr + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("tr") + break if _tmp + self.pos = _save1 + _tmp = match_string("TR") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseTr unless _tmp + return _tmp + end + + # HtmlBlockTr = HtmlBlockOpenTr (HtmlBlockTr | !HtmlBlockCloseTr .)* HtmlBlockCloseTr + def _HtmlBlockTr + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenTr) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockTr) + break if _tmp + self.pos = _save2 + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_HtmlBlockCloseTr) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseTr) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockTr unless _tmp + return _tmp + end + + # HtmlBlockOpenScript = "<" Spnl ("script" | "SCRIPT") Spnl HtmlAttribute* ">" + def _HtmlBlockOpenScript + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("script") + break if _tmp + self.pos = _save1 + _tmp = match_string("SCRIPT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockOpenScript unless _tmp + return _tmp + end + + # HtmlBlockCloseScript = "<" Spnl "/" ("script" | "SCRIPT") Spnl ">" + def _HtmlBlockCloseScript + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("script") + break if _tmp + self.pos = _save1 + _tmp = match_string("SCRIPT") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockCloseScript unless _tmp + return _tmp + end + + # HtmlBlockScript = HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript + def _HtmlBlockScript + + _save = self.pos + while true # sequence + _tmp = apply(:_HtmlBlockOpenScript) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # sequence + _save3 = self.pos + _tmp = apply(:_HtmlBlockCloseScript) + _tmp = _tmp ? nil : true + self.pos = _save3 + unless _tmp + self.pos = _save2 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockCloseScript) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockScript unless _tmp + return _tmp + end + + # HtmlBlockInTags = (HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript) + def _HtmlBlockInTags + + _save = self.pos + while true # choice + _tmp = apply(:_HtmlBlockAddress) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockBlockquote) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockCenter) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockDir) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockDiv) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockDl) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockFieldset) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockForm) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockH1) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockH2) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockH3) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockH4) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockH5) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockH6) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockMenu) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockNoframes) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockNoscript) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockOl) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockP) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockPre) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockTable) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockUl) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockDd) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockDt) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockFrameset) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockLi) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockTbody) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockTd) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockTfoot) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockTh) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockThead) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockTr) + break if _tmp + self.pos = _save + _tmp = apply(:_HtmlBlockScript) + break if _tmp + self.pos = _save + break + end # end choice + + set_failed_rule :_HtmlBlockInTags unless _tmp + return _tmp + end + + # HtmlBlock = < (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > BlankLine+ { if html? then RDoc::Markup::Raw.new text end } + def _HtmlBlock + + _save = self.pos + while true # sequence + _text_start = self.pos + + _save1 = self.pos + while true # choice + _tmp = apply(:_HtmlBlockInTags) + break if _tmp + self.pos = _save1 + _tmp = apply(:_HtmlComment) + break if _tmp + self.pos = _save1 + _tmp = apply(:_HtmlBlockSelfClosing) + break if _tmp + self.pos = _save1 + _tmp = apply(:_HtmlUnclosed) + break if _tmp + self.pos = _save1 + break + end # end choice + + if _tmp + text = get_text(_text_start) + end + unless _tmp + self.pos = _save + break + end + _save2 = self.pos + _tmp = apply(:_BlankLine) + if _tmp + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + else + self.pos = _save2 + end + unless _tmp + self.pos = _save + break + end + @result = begin; if html? then + RDoc::Markup::Raw.new text + end ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlock unless _tmp + return _tmp + end + + # HtmlUnclosed = "<" Spnl HtmlUnclosedType Spnl HtmlAttribute* Spnl ">" + def _HtmlUnclosed + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlUnclosedType) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlUnclosed unless _tmp + return _tmp + end + + # HtmlUnclosedType = ("HR" | "hr") + def _HtmlUnclosedType + + _save = self.pos + while true # choice + _tmp = match_string("HR") + break if _tmp + self.pos = _save + _tmp = match_string("hr") + break if _tmp + self.pos = _save + break + end # end choice + + set_failed_rule :_HtmlUnclosedType unless _tmp + return _tmp + end + + # HtmlBlockSelfClosing = "<" Spnl HtmlBlockType Spnl HtmlAttribute* "/" Spnl ">" + def _HtmlBlockSelfClosing + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_HtmlBlockType) + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_HtmlBlockSelfClosing unless _tmp + return _tmp + end + + # HtmlBlockType = ("ADDRESS" | "BLOCKQUOTE" | "CENTER" | "DD" | "DIR" | "DIV" | "DL" | "DT" | "FIELDSET" | "FORM" | "FRAMESET" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "HR" | "ISINDEX" | "LI" | "MENU" | "NOFRAMES" | "NOSCRIPT" | "OL" | "P" | "PRE" | "SCRIPT" | "TABLE" | "TBODY" | "TD" | "TFOOT" | "TH" | "THEAD" | "TR" | "UL" | "address" | "blockquote" | "center" | "dd" | "dir" | "div" | "dl" | "dt" | "fieldset" | "form" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "hr" | "isindex" | "li" | "menu" | "noframes" | "noscript" | "ol" | "p" | "pre" | "script" | "table" | "tbody" | "td" | "tfoot" | "th" | "thead" | "tr" | "ul") + def _HtmlBlockType + + _save = self.pos + while true # choice + _tmp = match_string("ADDRESS") + break if _tmp + self.pos = _save + _tmp = match_string("BLOCKQUOTE") + break if _tmp + self.pos = _save + _tmp = match_string("CENTER") + break if _tmp + self.pos = _save + _tmp = match_string("DD") + break if _tmp + self.pos = _save + _tmp = match_string("DIR") + break if _tmp + self.pos = _save + _tmp = match_string("DIV") + break if _tmp + self.pos = _save + _tmp = match_string("DL") + break if _tmp + self.pos = _save + _tmp = match_string("DT") + break if _tmp + self.pos = _save + _tmp = match_string("FIELDSET") + break if _tmp + self.pos = _save + _tmp = match_string("FORM") + break if _tmp + self.pos = _save + _tmp = match_string("FRAMESET") + break if _tmp + self.pos = _save + _tmp = match_string("H1") + break if _tmp + self.pos = _save + _tmp = match_string("H2") + break if _tmp + self.pos = _save + _tmp = match_string("H3") + break if _tmp + self.pos = _save + _tmp = match_string("H4") + break if _tmp + self.pos = _save + _tmp = match_string("H5") + break if _tmp + self.pos = _save + _tmp = match_string("H6") + break if _tmp + self.pos = _save + _tmp = match_string("HR") + break if _tmp + self.pos = _save + _tmp = match_string("ISINDEX") + break if _tmp + self.pos = _save + _tmp = match_string("LI") + break if _tmp + self.pos = _save + _tmp = match_string("MENU") + break if _tmp + self.pos = _save + _tmp = match_string("NOFRAMES") + break if _tmp + self.pos = _save + _tmp = match_string("NOSCRIPT") + break if _tmp + self.pos = _save + _tmp = match_string("OL") + break if _tmp + self.pos = _save + _tmp = match_string("P") + break if _tmp + self.pos = _save + _tmp = match_string("PRE") + break if _tmp + self.pos = _save + _tmp = match_string("SCRIPT") + break if _tmp + self.pos = _save + _tmp = match_string("TABLE") + break if _tmp + self.pos = _save + _tmp = match_string("TBODY") + break if _tmp + self.pos = _save + _tmp = match_string("TD") + break if _tmp + self.pos = _save + _tmp = match_string("TFOOT") + break if _tmp + self.pos = _save + _tmp = match_string("TH") + break if _tmp + self.pos = _save + _tmp = match_string("THEAD") + break if _tmp + self.pos = _save + _tmp = match_string("TR") + break if _tmp + self.pos = _save + _tmp = match_string("UL") + break if _tmp + self.pos = _save + _tmp = match_string("address") + break if _tmp + self.pos = _save + _tmp = match_string("blockquote") + break if _tmp + self.pos = _save + _tmp = match_string("center") + break if _tmp + self.pos = _save + _tmp = match_string("dd") + break if _tmp + self.pos = _save + _tmp = match_string("dir") + break if _tmp + self.pos = _save + _tmp = match_string("div") + break if _tmp + self.pos = _save + _tmp = match_string("dl") + break if _tmp + self.pos = _save + _tmp = match_string("dt") + break if _tmp + self.pos = _save + _tmp = match_string("fieldset") + break if _tmp + self.pos = _save + _tmp = match_string("form") + break if _tmp + self.pos = _save + _tmp = match_string("frameset") + break if _tmp + self.pos = _save + _tmp = match_string("h1") + break if _tmp + self.pos = _save + _tmp = match_string("h2") + break if _tmp + self.pos = _save + _tmp = match_string("h3") + break if _tmp + self.pos = _save + _tmp = match_string("h4") + break if _tmp + self.pos = _save + _tmp = match_string("h5") + break if _tmp + self.pos = _save + _tmp = match_string("h6") + break if _tmp + self.pos = _save + _tmp = match_string("hr") + break if _tmp + self.pos = _save + _tmp = match_string("isindex") + break if _tmp + self.pos = _save + _tmp = match_string("li") + break if _tmp + self.pos = _save + _tmp = match_string("menu") + break if _tmp + self.pos = _save + _tmp = match_string("noframes") + break if _tmp + self.pos = _save + _tmp = match_string("noscript") + break if _tmp + self.pos = _save + _tmp = match_string("ol") + break if _tmp + self.pos = _save + _tmp = match_string("p") + break if _tmp + self.pos = _save + _tmp = match_string("pre") + break if _tmp + self.pos = _save + _tmp = match_string("script") + break if _tmp + self.pos = _save + _tmp = match_string("table") + break if _tmp + self.pos = _save + _tmp = match_string("tbody") + break if _tmp + self.pos = _save + _tmp = match_string("td") + break if _tmp + self.pos = _save + _tmp = match_string("tfoot") + break if _tmp + self.pos = _save + _tmp = match_string("th") + break if _tmp + self.pos = _save + _tmp = match_string("thead") + break if _tmp + self.pos = _save + _tmp = match_string("tr") + break if _tmp + self.pos = _save + _tmp = match_string("ul") + break if _tmp + self.pos = _save + break + end # end choice + + set_failed_rule :_HtmlBlockType unless _tmp + return _tmp + end + + # StyleOpen = "<" Spnl ("style" | "STYLE") Spnl HtmlAttribute* ">" + def _StyleOpen + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("style") + break if _tmp + self.pos = _save1 + _tmp = match_string("STYLE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_HtmlAttribute) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_StyleOpen unless _tmp + return _tmp + end + + # StyleClose = "<" Spnl "/" ("style" | "STYLE") Spnl ">" + def _StyleClose + + _save = self.pos + while true # sequence + _tmp = match_string("<") + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string("/") + unless _tmp + self.pos = _save + break + end + + _save1 = self.pos + while true # choice + _tmp = match_string("style") + break if _tmp + self.pos = _save1 + _tmp = match_string("STYLE") + break if _tmp + self.pos = _save1 + break + end # end choice + + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_Spnl) + unless _tmp + self.pos = _save + break + end + _tmp = match_string(">") + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_StyleClose unless _tmp + return _tmp + end + + # InStyleTags = StyleOpen (!StyleClose .)* StyleClose + def _InStyleTags + + _save = self.pos + while true # sequence + _tmp = apply(:_StyleOpen) + unless _tmp + self.pos = _save + break + end + while true + + _save2 = self.pos + while true # sequence + _save3 = self.pos + _tmp = apply(:_StyleClose) + _tmp = _tmp ? nil : true + self.pos = _save3 + unless _tmp + self.pos = _save2 + break + end + _tmp = get_byte + unless _tmp + self.pos = _save2 + end + break + end # end sequence + + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + _tmp = apply(:_StyleClose) + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_InStyleTags unless _tmp + return _tmp + end + + # StyleBlock = < InStyleTags > BlankLine* { if css? then RDoc::Markup::Raw.new text end } + def _StyleBlock + + _save = self.pos + while true # sequence + _text_start = self.pos + _tmp = apply(:_InStyleTags) + if _tmp + text = get_text(_text_start) + end + unless _tmp + self.pos = _save + break + end + while true + _tmp = apply(:_BlankLine) + break unless _tmp + end + _tmp = true + unless _tmp + self.pos = _save + break + end + @result = begin; if css? then + RDoc::Markup::Raw.new text + end ; end + _tmp = true + unless _tmp + self.pos = _save + end + break + end # end sequence + + set_failed_rule :_StyleBlock unless _tmp + return _tmp + end + + # Inlines = (!Endline Inline:i { i } | Endline:c &Inline { c })+:chunks Endline? { chunks } + def _Inlines + + _save = self.pos + while true # sequence + _save1 = self.pos + _ary = [] + + _save2 = self.pos + while true # choice + + _save3 = self.pos + while true # sequence + _save4 = self.pos + _tmp = apply(:_Endline) + _tmp = _tmp ? nil : true + self.pos = _save4 + unless _tmp + self.pos = _save3 + break + end + _tmp = apply(:_Inline) + i = @result + unless _tmp + self.pos = _save3 + break + end + @result = begin; i ; end + _tmp = true + unless _tmp + self.pos = _save3 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + + _save5 = self.pos + while true # sequence + _tmp = apply(:_Endline) + c = @result + unless _tmp + self.pos = _save5 + break + end + _save6 = self.pos + _tmp = apply(:_Inline) + self.pos = _save6 + unless _tmp + self.pos = _save5 + break + end + @result = begin; c ; end + _tmp = true + unless _tmp + self.pos = _save5 + end + break + end # end sequence + + break if _tmp + self.pos = _save2 + break + end # end choice + + if _tmp + _ary << @result + while true + + _save7 = self.pos + while true # choice + + _save8 = self.pos + while true # sequence + _save9 = self.pos + _tmp = apply(:_Endline) + _tmp = _tmp ? nil : true + self.pos = _save9 + unless _tmp + self.pos = _save8 + break + end + _tmp = apply(:_Inline) + i = @result + unless _tmp + self.pos = _save8 + break + end + @result = begin; i ; end + _tmp = true + unless _tmp + self.pos = _save8 + end + break + end # end sequence + + break if _tmp + self.pos = _save7 + + _save10 = self.pos + while true # sequence + _tmp = apply(:_Endline) + c = @result + unless _tmp + self.pos = _save10 + break + end + _save11 = self.pos + _tmp = apply(:_Inline) + self.pos = _save11 + unless _tmp + self.pos = _save10 + break + end + @result = begin; c ; end + _tmp = true + unl |