summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 23:33:36 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 23:33:36 +0000
commitdf7dac9174a31e71b58be6184e23bfe6b742a494 (patch)
tree885edf624f0e8f37014b0d937340ac1c372a0066 /lib/rdoc
parentfed428007c015ac3b7f4586f2491517fafffa030 (diff)
* lib/rdoc: Update to RDoc 4.1.0.preview.1
RDoc 4.1.0 contains a number of enhancements including a new default style and accessibility support. You can see the changelog here: https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc * test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/any_method.rb52
-rw-r--r--lib/rdoc/class_module.rb30
-rw-r--r--lib/rdoc/code_object.rb121
-rw-r--r--lib/rdoc/comment.rb3
-rw-r--r--lib/rdoc/context.rb22
-rw-r--r--lib/rdoc/cross_reference.rb2
-rw-r--r--lib/rdoc/extend.rb116
-rw-r--r--lib/rdoc/generator/darkfish.rb53
-rw-r--r--lib/rdoc/generator/template/darkfish/_footer.rhtml8
-rw-r--r--lib/rdoc/generator/template/darkfish/_head.rhtml22
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml6
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml8
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml12
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml10
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml19
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml13
-rw-r--r--lib/rdoc/generator/template/darkfish/class.rhtml77
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts.css167
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttfbin0 -> 94668 bytes
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttfbin0 -> 94196 bytes
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttfbin0 -> 96184 bytes
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttfbin0 -> 95316 bytes
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttfbin0 -> 71200 bytes
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttfbin0 -> 71692 bytes
-rw-r--r--lib/rdoc/generator/template/darkfish/index.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/js/darkfish.js15
-rw-r--r--lib/rdoc/generator/template/darkfish/js/search.js16
-rw-r--r--lib/rdoc/generator/template/darkfish/page.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/rdoc.css465
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml10
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_root.rhtml38
-rw-r--r--lib/rdoc/generator/template/darkfish/table_of_contents.rhtml31
-rw-r--r--lib/rdoc/include.rb118
-rw-r--r--lib/rdoc/known_classes.rb1
-rw-r--r--lib/rdoc/markdown.rb2172
-rw-r--r--lib/rdoc/markdown/literals_1_9.rb2
-rw-r--r--lib/rdoc/markup.rb21
-rw-r--r--lib/rdoc/markup/attribute_manager.rb5
-rw-r--r--lib/rdoc/markup/formatter.rb6
-rw-r--r--lib/rdoc/markup/heading.rb13
-rw-r--r--lib/rdoc/markup/parser.rb9
-rw-r--r--lib/rdoc/markup/pre_process.rb2
-rw-r--r--lib/rdoc/markup/to_html.rb105
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb3
-rw-r--r--lib/rdoc/markup/to_markdown.rb12
-rw-r--r--lib/rdoc/method_attr.rb12
-rw-r--r--lib/rdoc/mixin.rb120
-rw-r--r--lib/rdoc/normal_class.rb4
-rw-r--r--lib/rdoc/normal_module.rb4
-rw-r--r--lib/rdoc/options.rb82
-rw-r--r--lib/rdoc/parser.rb9
-rw-r--r--lib/rdoc/parser/c.rb50
-rw-r--r--lib/rdoc/parser/ruby.rb1159
-rw-r--r--lib/rdoc/rd/block_parser.rb124
-rw-r--r--lib/rdoc/rd/inline_parser.rb98
-rw-r--r--lib/rdoc/rdoc.rb9
-rw-r--r--lib/rdoc/ri/driver.rb281
-rw-r--r--lib/rdoc/ruby_lex.rb225
-rw-r--r--lib/rdoc/ruby_token.rb81
-rw-r--r--lib/rdoc/rubygems_hook.rb11
-rw-r--r--lib/rdoc/servlet.rb41
-rw-r--r--lib/rdoc/stats.rb109
-rw-r--r--lib/rdoc/store.rb6
-rw-r--r--lib/rdoc/test_case.rb39
-rw-r--r--lib/rdoc/text.rb2
-rw-r--r--lib/rdoc/tom_doc.rb30
-rw-r--r--lib/rdoc/top_level.rb2
74 files changed, 3432 insertions, 2940 deletions
diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb
index 23110dcb2a..3afafc86b8 100644
--- a/lib/rdoc/any_method.rb
+++ b/lib/rdoc/any_method.rb
@@ -9,8 +9,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
# Added calls_super
# Added parent name and class
# Added section title
+ # 3::
+ # RDoc 4.1
+ # Added is_alias_for
- MARSHAL_VERSION = 2 # :nodoc:
+ MARSHAL_VERSION = 3 # :nodoc:
##
# Don't rename \#initialize to \::new
@@ -25,7 +28,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
##
# Different ways to call this method
- attr_accessor :call_seq
+ attr_reader :call_seq
##
# Parameters for this method
@@ -90,6 +93,37 @@ class RDoc::AnyMethod < RDoc::MethodAttr
end
##
+ # Sets the different ways you can call this method. If an empty +call_seq+
+ # is given nil is assumed.
+ #
+ # See also #param_seq
+
+ def call_seq= call_seq
+ return if call_seq.empty?
+
+ @call_seq = call_seq
+ end
+
+ ##
+ # Loads is_alias_for from the internal name. Returns nil if the alias
+ # cannot be found.
+
+ def is_alias_for # :nodoc:
+ case @is_alias_for
+ when RDoc::MethodAttr then
+ @is_alias_for
+ when Array then
+ return nil unless @store
+
+ klass_name, singleton, method_name = @is_alias_for
+
+ return nil unless klass = @store.find_class_or_module(klass_name)
+
+ @is_alias_for = klass.find_method method_name, singleton
+ end
+ end
+
+ ##
# Dumps this AnyMethod for use by ri. See also #marshal_load
def marshal_dump
@@ -97,6 +131,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr
[a.name, parse(a.comment)]
end
+ is_alias_for = [
+ @is_alias_for.parent.full_name,
+ @is_alias_for.singleton,
+ @is_alias_for.name
+ ] if @is_alias_for
+
[ MARSHAL_VERSION,
@name,
full_name,
@@ -112,6 +152,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
@parent.name,
@parent.class,
@section.title,
+ is_alias_for,
]
end
@@ -126,7 +167,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
initialize_visibility
@dont_rename_initialize = nil
- @is_alias_for = nil
@token_stream = nil
@aliases = []
@parent = nil
@@ -150,6 +190,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
@parent_name = array[12]
@parent_title = array[13]
@section_title = array[14]
+ @is_alias_for = array[15]
array[8].each do |new_name, comment|
add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
@@ -174,7 +215,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
def name
return @name if @name
- @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq if @call_seq
+ @name =
+ @call_seq[/^.*?\.(\w+)/, 1] ||
+ @call_seq[/^.*?(\w+)/, 1] ||
+ @call_seq if @call_seq
end
##
diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb
index b796050431..71566f050a 100644
--- a/lib/rdoc/class_module.rb
+++ b/lib/rdoc/class_module.rb
@@ -169,6 +169,18 @@ class RDoc::ClassModule < RDoc::Context
includes.map { |i| i.module }.reverse
end
+ def aref_prefix # :nodoc:
+ raise NotImplementedError, "missing aref_prefix for #{self.class}"
+ end
+
+ ##
+ # HTML fragment reference for this module or class. See
+ # RDoc::NormalClass#aref and RDoc::NormalModule#aref
+
+ def aref
+ "#{aref_prefix}-#{full_name}"
+ end
+
##
# Ancestors of this class or module only
@@ -224,7 +236,9 @@ class RDoc::ClassModule < RDoc::Context
# #received_nodoc true?
def documented?
- super or !@comment_location.empty?
+ return true if @received_nodoc
+ return false if @comment_location.empty?
+ @comment_location.any? { |comment, _| not comment.empty? }
end
##
@@ -282,16 +296,18 @@ class RDoc::ClassModule < RDoc::Context
def marshal_dump # :nodoc:
attrs = attributes.sort.map do |attr|
+ next unless attr.display?
[ attr.name, attr.rw,
attr.visibility, attr.singleton, attr.file_name,
]
- end
+ end.compact
method_types = methods_by_type.map do |type, visibilities|
visibilities = visibilities.map do |visibility, methods|
method_names = methods.map do |method|
+ next unless method.display?
[method.name, method.file_name]
- end
+ end.compact
[visibility, method_names.uniq]
end
@@ -305,14 +321,16 @@ class RDoc::ClassModule < RDoc::Context
@superclass,
parse(@comment_location),
attrs,
- constants,
+ constants.select { |constant| constant.display? },
includes.map do |incl|
+ next unless incl.display?
[incl.name, parse(incl.comment), incl.file_name]
- end,
+ end.compact,
method_types,
extends.map do |ext|
+ next unless ext.display?
[ext.name, parse(ext.comment), ext.file_name]
- end,
+ end.compact,
@sections.values,
@in_files.map do |tl|
tl.relative_name
diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb
index 83732e3d3b..4620fa586d 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -20,8 +20,9 @@
# * RDoc::MetaMethod
# * RDoc::Alias
# * RDoc::Constant
-# * RDoc::Require
-# * RDoc::Include
+# * RDoc::Mixin
+# * RDoc::Require
+# * RDoc::Include
class RDoc::CodeObject
@@ -92,7 +93,7 @@ class RDoc::CodeObject
##
# The RDoc::Store for this object.
- attr_accessor :store
+ attr_reader :store
##
# We are the model of the code, but we know that at some point we will be
@@ -105,16 +106,17 @@ class RDoc::CodeObject
# Creates a new CodeObject that will document itself and its children
def initialize
- @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
+ @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
+ @track_visibility = true
initialize_visibility
end
@@ -129,6 +131,8 @@ class RDoc::CodeObject
@force_documentation = false
@received_nodoc = false
@ignored = false
+ @suppressed = false
+ @track_visibility = true
end
##
@@ -155,10 +159,17 @@ class RDoc::CodeObject
end
##
- # Should this CodeObject be shown in documentation?
+ # Should this CodeObject be displayed in output?
+ #
+ # A code object should be displayed if:
+ #
+ # * The item didn't have a nodoc or wasn't in a container that had nodoc
+ # * The item wasn't ignored
+ # * The item has documentation and was not suppressed
def display?
- @document_self and not @ignored
+ @document_self and not @ignored and
+ (documented? or not @suppressed)
end
##
@@ -166,6 +177,8 @@ class RDoc::CodeObject
# has been turned off by :enddoc:
def document_children=(document_children)
+ return unless @track_visibility
+
@document_children = document_children unless @done_documenting
end
@@ -175,6 +188,7 @@ class RDoc::CodeObject
# documentation is turned off by +:nodoc:+.
def document_self=(document_self)
+ return unless @track_visibility
return if @done_documenting
@document_self = document_self
@@ -198,8 +212,9 @@ class RDoc::CodeObject
# will have no effect in the current file.
def done_documenting=(value)
- @done_documenting = value
- @document_self = !value
+ return unless @track_visibility
+ @done_documenting = value
+ @document_self = !value
@document_children = @document_self
end
@@ -249,7 +264,7 @@ class RDoc::CodeObject
##
# Use this to ignore a CodeObject and all its children until found again
- # (#record_location is called). An ignored item will not be shown in
+ # (#record_location is called). An ignored item will not be displayed in
# documentation.
#
# See github issue #55
@@ -259,10 +274,13 @@ class RDoc::CodeObject
# and modules to add new documentation to previously created classes.
#
# If a class was ignored (via stopdoc) then reopened later with additional
- # documentation it should be shown. If a class was ignored and never
- # reopened it should not be shown. The ignore flag allows this to occur.
+ # documentation it should be displayed. If a class was ignored and never
+ # reopened it should not be displayed. The ignore flag allows this to
+ # occur.
def ignore
+ return unless @track_visibility
+
@ignored = true
stop_doc
@@ -270,12 +288,28 @@ class RDoc::CodeObject
##
# Has this class been ignored?
+ #
+ # See also #ignore
def ignored?
@ignored
end
##
+ # The options instance from the store this CodeObject is attached to, or a
+ # default options instance if the CodeObject is not attached.
+ #
+ # This is used by Text#snippet
+
+ def options
+ if @store and @store.rdoc then
+ @store.rdoc.options
+ else
+ RDoc::Options.new
+ end
+ end
+
+ ##
# Our parent CodeObject. The parent may be missing for classes loaded from
# legacy RI data stores.
@@ -316,8 +350,9 @@ class RDoc::CodeObject
# Records the RDoc::TopLevel (file) where this code object was defined
def record_location top_level
- @ignored = false
- @file = top_level
+ @ignored = false
+ @suppressed = false
+ @file = top_level
end
##
@@ -339,16 +374,56 @@ class RDoc::CodeObject
@document_self = true
@document_children = true
- @ignored = false
+ @ignored = false
+ @suppressed = false
end
##
# Disable capture of documentation
def stop_doc
+ return unless @track_visibility
+
@document_self = false
@document_children = false
end
+ ##
+ # Sets the +store+ that contains this CodeObject
+
+ def store= store
+ @store = store
+
+ return unless @track_visibility
+
+ if :nodoc == options.visibility then
+ initialize_visibility
+ @track_visibility = false
+ end
+ end
+
+ ##
+ # Use this to suppress a CodeObject and all its children until the next file
+ # it is seen in or documentation is discovered. A suppressed item with
+ # documentation will be displayed while an ignored item with documentation
+ # may not be displayed.
+
+ def suppress
+ return unless @track_visibility
+
+ @suppressed = true
+
+ stop_doc
+ end
+
+ ##
+ # Has this class been suppressed?
+ #
+ # See also #suppress
+
+ def suppressed?
+ @suppressed
+ end
+
end
diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb
index 2b5be44ee5..33ced18b5a 100644
--- a/lib/rdoc/comment.rb
+++ b/lib/rdoc/comment.rb
@@ -118,9 +118,6 @@ class RDoc::Comment
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
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index 22339bf1c7..892a43e118 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -168,6 +168,24 @@ class RDoc::Context < RDoc::CodeObject
end
##
+ # Adds an item of type +klass+ with the given +name+ and +comment+ to the
+ # context.
+ #
+ # Currently only RDoc::Extend and RDoc::Include are supported.
+
+ def add klass, name, comment
+ if RDoc::Extend == klass then
+ ext = RDoc::Extend.new name, comment
+ add_extend ext
+ elsif RDoc::Include == klass then
+ incl = RDoc::Include.new name, comment
+ add_include incl
+ else
+ raise NotImplementedError, "adding a #{klass} is not implemented"
+ end
+ end
+
+ ##
# Adds +an_alias+ that is automatically resolved
def add_alias an_alias
@@ -1041,8 +1059,8 @@ class RDoc::Context < RDoc::CodeObject
#--
# TODO mark the visibility of attributes in the template (if not public?)
- def remove_invisible(min_visibility)
- return if min_visibility == :private
+ def remove_invisible min_visibility
+ return if [:private, :nodoc].include? min_visibility
remove_invisible_in @method_list, min_visibility
remove_invisible_in @attributes, min_visibility
end
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index 2cb0571732..5b08d5202d 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
diff --git a/lib/rdoc/extend.rb b/lib/rdoc/extend.rb
index 2bccfba084..efa2c69bee 100644
--- a/lib/rdoc/extend.rb
+++ b/lib/rdoc/extend.rb
@@ -1,117 +1,9 @@
##
-# A Module extension in a class with \#extend
+# A Module extension to a class with \#extend
+#
+# RDoc::Extend.new 'Enumerable', 'comment ...'
-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
+class RDoc::Extend < RDoc::Mixin
end
diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb
index 26f545b14b..bd37b60668 100644
--- a/lib/rdoc/generator/darkfish.rb
+++ b/lib/rdoc/generator/darkfish.rb
@@ -58,6 +58,21 @@ class RDoc::Generator::Darkfish
include ERB::Util
##
+ # Stylesheets, fonts, etc. that are included in RDoc.
+
+ BUILTIN_STYLE_ITEMS = # :nodoc:
+ %w[
+ fonts.css
+ fonts/Lato-Light.ttf
+ fonts/Lato-LightItalic.ttf
+ fonts/Lato-Regular.ttf
+ fonts/Lato-RegularItalic.ttf
+ fonts/SourceCodePro-Bold.ttf
+ fonts/SourceCodePro-Regular.ttf
+ rdoc.css
+ ]
+
+ ##
# Path to this file's parent directory. Used to find templates and other
# resources.
@@ -128,6 +143,11 @@ class RDoc::Generator::Darkfish
attr_reader :store
##
+ # The directory where the template files live
+
+ attr_reader :template_dir # :nodoc:
+
+ ##
# The output directory
attr_reader :outputdir
@@ -195,7 +215,13 @@ class RDoc::Generator::Darkfish
debug_msg "Copying static files"
options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
- FileUtils.cp @template_dir + 'rdoc.css', '.', options
+ BUILTIN_STYLE_ITEMS.each do |item|
+ install_rdoc_static_file @template_dir + item, "./#{item}", options
+ end
+
+ @options.template_stylesheets.each do |stylesheet|
+ FileUtils.cp stylesheet, '.', options
+ end
Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
next if File.directory? path
@@ -203,11 +229,7 @@ class RDoc::Generator::Darkfish
dst = Pathname.new(path).relative_path_from @template_dir
- # I suck at glob
- dst_dir = dst.dirname
- FileUtils.mkdir_p dst_dir, options unless File.exist? dst_dir
-
- FileUtils.cp @template_dir + path, dst, options
+ install_rdoc_static_file @template_dir + path, dst, options
end
end
@@ -447,7 +469,7 @@ class RDoc::Generator::Darkfish
##
# Generates the 404 page for the RDoc servlet
- def generate_servlet_not_found path
+ def generate_servlet_not_found message
setup
template_file = @template_dir + 'servlet_not_found.rhtml'
@@ -530,6 +552,23 @@ class RDoc::Generator::Darkfish
raise error
end
+ def install_rdoc_static_file source, destination, options # :nodoc:
+ return unless source.exist?
+
+ begin
+ FileUtils.mkdir_p File.dirname(destination), options
+
+ begin
+ FileUtils.ln source, destination, options
+ rescue Errno::EEXIST
+ FileUtils.rm destination
+ retry
+ end
+ rescue
+ FileUtils.cp source, destination, options
+ end
+ end
+
##
# Prepares for generation of output from the current directory
diff --git a/lib/rdoc/generator/template/darkfish/_footer.rhtml b/lib/rdoc/generator/template/darkfish/_footer.rhtml
index 0736c335ba..3d9526f02a 100644
--- a/lib/rdoc/generator/template/darkfish/_footer.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_footer.rhtml
@@ -1,5 +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 id="validator-badges" role="contentinfo">
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
+ <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> <%= RDoc::VERSION %>.
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>
diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml
index f3d82a37f6..062160a751 100644
--- a/lib/rdoc/generator/template/darkfish/_head.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_head.rhtml
@@ -1,16 +1,22 @@
-<meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type">
+<meta charset="<%= @options.charset %>">
<title><%= h @title %></title>
-<link type="text/css" media="screen" href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/fonts.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
+<% if @options.template_stylesheets.flatten.any? then %>
+<% @options.template_stylesheets.flatten.each do |stylesheet| %>
+<link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
+<% end %>
+<% end %>
<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>
+<script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
+<script src="<%= asset_rel_prefix %>/js/navigation.js"></script>
+<script src="<%= search_index_rel_prefix %>/js/search_index.js"></script>
+<script src="<%= asset_rel_prefix %>/js/search.js"></script>
+<script src="<%= asset_rel_prefix %>/js/searcher.js"></script>
+<script 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
index 93d57f39f6..e889f8063d 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
@@ -1,6 +1,7 @@
<% if !svninfo.empty? then %>
-<nav id="file-svninfo-section" class="section">
- <h3 class="section-header">VCS Info</h3>
+<div id="file-svninfo-section" class="nav-section">
+ <h3>VCS Info</h3>
+
<div class="section-body">
<dl class="svninfo">
<dt>Rev
@@ -14,5 +15,5 @@
<dd><%= svninfo[:committer] %>
</dl>
</div>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
index efa202fa18..fe54d8339f 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
@@ -1,9 +1,9 @@
-<nav id="classindex-section" class="section project-section">
- <h3 class="section-header">Class and Module Index</h3>
+<div id="classindex-section" class="nav-section">
+ <h3>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>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
index 19273829a0..2bd8efee99 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
@@ -1,7 +1,6 @@
<% unless klass.extends.empty? then %>
-<!-- Extension Modules -->
-<nav id="extends-section" class="section">
- <h3 class="section-header">Extended With Modules</h3>
+<div id="extends-section" class="nav-section">
+ <h3>Extended With Modules</h3>
<ul class="link-list">
<% klass.each_extend do |ext| %>
@@ -12,5 +11,5 @@
<% end %>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
index 22be0c9b65..0ba1d2be80 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
@@ -1,8 +1,9 @@
-<nav id="file-list-section" class="section">
- <h3 class="section-header">Defined In</h3>
+<div id="file-list-section" class="nav-section">
+ <h3>Defined In</h3>
+
<ul>
<% klass.in_files.each do |tl| %>
<li><%= h tl.relative_name %>
<% end %>
</ul>
-</nav>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
index 5494f1f5f8..d141098ecd 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
@@ -1,7 +1,6 @@
<% unless klass.includes.empty? then %>
-<!-- Included Modules -->
-<nav id="includes-section" class="section">
- <h3 class="section-header">Included Modules</h3>
+<div id="includes-section" class="nav-section">
+ <h3>Included Modules</h3>
<ul class="link-list">
<% klass.each_include do |inc| %>
@@ -12,5 +11,5 @@
<% end %>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
index 45a3048e84..1285bfd732 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
@@ -1,8 +1,9 @@
-<nav id="home-section" class="section">
- <h3 class="section-header">Documentation</h3>
+<div id="home-section" class="nav-section">
+ <h3>Documentation</h3>
<ul>
- <% installed.each do |name, href, exists| %>
+ <% installed.each do |name, href, exists, type, _| %>
+ <% next if type == :extra %>
<li class="folder">
<% if exists then %>
<a href="<%= href %>"><%= h name %></a>
@@ -11,4 +12,4 @@
<% end %>
<% end %>
</ul>
-</nav>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
index 88e2734819..45df08d8fe 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
@@ -1,12 +1,12 @@
<% unless klass.method_list.empty? then %>
<!-- Method Quickref -->
-<nav id="method-list-section" class="section">
- <h3 class="section-header">Methods</h3>
+<div id="method-list-section" class="nav-section">
+ <h3>Methods</h3>
- <ul class="link-list">
+ <ul class="link-list" role="directory">
<% 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>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
index fdeb6aed9f..7b9c4f73b3 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
@@ -1,7 +1,11 @@
-<nav id="home-section" class="section">
- <h3 class="section-header">
- <a href="<%= rel_prefix %>/index.html">Home</a>
+<div id="home-section" role="banner" class="nav-section">
+ <h2>
+ <a href="<%= rel_prefix %>/index.html" rel="home">Home</a>
+ </h2>
+
+ <h3>
+ <a href="<%= rel_prefix %>/table_of_contents.html#pages">Pages</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>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
index 2089387c51..5f39825f08 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
@@ -1,12 +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>
+<div id="fileindex-section" class="nav-section">
+ <h3>Pages</h3>
- <ul>
+ <ul class="link-list">
<% simple_files.each do |f| %>
- <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
+ <li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
index 463f05a8d9..cc04852652 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
@@ -1,10 +1,11 @@
<% if klass.type == 'class' then %>
-<nav id="parent-class-section" class="section">
- <h3 class="section-header">Parent</h3>
+<div id="parent-class-section" class="nav-section">
+ <h3>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>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
index f3275783d0..4c1e1f7cc3 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
@@ -1,10 +1,15 @@
-<nav id="search-section" class="section project-section" class="initially-hidden">
+<div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
- <h3 class="section-header">
- <input type="text" name="search" placeholder="Search" id="search-field"
+ <div id="search-field-wrapper">
+ <input id="search-field" role="combobox" aria-label="Search"
+ aria-autocomplete="list" aria-controls="search-results"
+ type="text" name="search" placeholder="Search"
title="Type to search, Up and Down to navigate, Enter to load">
- </h3>
- </form>
+ </div>
- <ul id="search-results" class="initially-hidden"></ul>
-</nav>
+ <ul id="search-results" aria-label="Search Results"
+ aria-busy="false" aria-expanded="false"
+ aria-atomic="false" aria-live="polite"
+ aria-relevant="all" class="initially-hidden"></ul>
+ </form>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
index 726423a341..15ff78ba91 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
@@ -1,10 +1,11 @@
<% unless klass.sections.length == 1 then %>
-<nav id="sections-section" class="section">
- <h3 class="section-header">Sections</h3>
- <ul class="link-list">
+<div id="sections-section" class="nav-section">
+ <h3>Sections</h3>
+
+ <ul class="link-list" role="directory">
<% klass.sort_sections.each do |section| %>
<li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
<% end %>
</ul>
-</nav>
+</div>
<% 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
index 7842625840..b58e6b3c61 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
@@ -6,14 +6,13 @@
table = current.parse(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>
+<div class="nav-section">
+ <h3>Table of Contents</h3>
+
+ <ul class="link-list" role="directory">
<% table.each do |heading| %>
- <li><a href="#<%= heading.aref %>"><%= heading.plain_html %></a>
+ <li><a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
<% end %>
- </ul>
- </nav>
+ </ul>
</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml
index c7e52e6808..b497000112 100644
--- a/lib/rdoc/generator/template/darkfish/class.rhtml
+++ b/lib/rdoc/generator/template/darkfish/class.rhtml
@@ -1,16 +1,12 @@
-<body id="top" class="<%= klass.type %>">
-<nav id="metadata">
- <%= render '_sidebar_navigation.rhtml' %>
-
- <%= render '_sidebar_search.rhtml' %>
+<body id="top" role="document" class="<%= klass.type %>">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<%= 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' %>
@@ -18,52 +14,50 @@
<%= 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>
+<main role="main" aria-labelledby="<%=h klass.aref %>">
+ <h1 id="<%=h klass.aref %>" class="<%= klass.type %>">
+ <%= klass.type %> <%= klass.full_name %>
+ </h1>
- <div id="description" class="description">
+ <section class="description">
<%= klass.description %>
- </div><!-- description -->
+ </section>
<% 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">
+ <header class="documentation-section-title">
+ <h2>
<%= section.title %>
</h2>
<span class="section-click-top">
<a href="#top">&uarr; top</a>
</span>
- </div>
+ </header>
<% end %>
<% if section.comment then %>
- <div class="description">
+ <div>
<%= section.description %>
</div>
<% end %>
<% unless constants.empty? then %>
- <!-- Constants -->
- <section id="constants-list" class="section">
- <h3 class="section-header">Constants</h3>
+ <section class="constants-list">
+ <header>
+ <h3>Constants</h3>
+ </header>
<dl>
<% constants.each do |const| %>
<dt id="<%= const.name %>"><%= const.name %>
<% if const.comment then %>
- <dd class="description"><%= const.description.strip %>
+ <dd><%= const.description.strip %>
<% else %>
- <dd class="description missing-docs">(Not documented)
+ <dd class="missing-docs">(Not documented)
<% end %>
<% end %>
</dl>
@@ -71,9 +65,10 @@
<% end %>
<% unless attributes.empty? then %>
- <!-- Attributes -->
- <section id="attribute-method-details" class="method-section section">
- <h3 class="section-header">Attributes</h3>
+ <section class="attribute-method-details" class="method-section">
+ <header>
+ <h3>Attributes</h3>
+ </header>
<% attributes.each do |attrib| %>
<div id="<%= attrib.aref %>" class="method-detail">
@@ -91,16 +86,17 @@
</div>
</div>
<% end %>
- </section><!-- attribute-method-details -->
+ </section>
<% 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>
+ <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section">
+ <header>
+ <h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
+ </header>
<% methods.each do |method| %>
<div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
@@ -146,7 +142,7 @@
<% 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 -->
+ </div>
<% end %>
</div>
@@ -167,13 +163,12 @@
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 -->
+ </div>
<% end %>
- </section><!-- <%= visibility %>-<%= type %>-method-details -->
+ </section>
<% end
end %>
- </section><!-- <%= section.aref %> -->
+ </section>
<% end %>
-
-</div><!-- documentation -->
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/fonts.css b/lib/rdoc/generator/template/darkfish/fonts.css
new file mode 100644
index 0000000000..e9e721183b
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts.css
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
+ * with Reserved Font Name "Source". All Rights Reserved. Source is a
+ * trademark of Adobe Systems Incorporated in the United States and/or other
+ * countries.
+ *
+ * This Font Software is licensed under the SIL Open Font License, Version
+ * 1.1.
+ *
+ * This license is copied below, and is also available with a FAQ at:
+ * http://scripts.sil.org/OFL
+ */
+
+@font-face {
+ font-family: "Source Code Pro";
+ font-style: normal;
+ font-weight: 400;
+ src: local("Source Code Pro"),
+ local("SourceCodePro-Regular"),
+ url("fonts/SourceCodePro-Regular.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Source Code Pro";
+ font-style: normal;
+ font-weight: 700;
+ src: local("Source Code Pro Bold"),
+ local("SourceCodePro-Bold"),
+ url("fonts/SourceCodePro-Bold.ttf") format("truetype");
+}
+
+/*
+ * Copyright (c) 2010, Ɓukasz Dziedzic (dziedzic@typoland.com),
+ * with Reserved Font Name Lato.
+ *
+ * This Font Software is licensed under the SIL Open Font License, Version
+ * 1.1.
+ *
+ * This license is copied below, and is also available with a FAQ at:
+ * http://scripts.sil.org/OFL
+ */
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 300;
+ src: local("Lato Light"),
+ local("Lato-Light"),
+ url("fonts/Lato-Light.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: italic;
+ font-weight: 300;
+ src: local("Lato Light Italic"),
+ local("Lato-LightItalic"),
+ url("fonts/Lato-LightItalic.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 700;
+ src: local("Lato Regular"),
+ local("Lato-Regular"),
+ url("fonts/Lato-Regular.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: italic;
+ font-weight: 700;
+ src: local("Lato Italic"),
+ local("Lato-Italic"),
+ url("fonts/Lato-RegularItalic.ttf") format("truetype");
+}
+
+/*
+ * -----------------------------------------------------------
+ * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+ * -----------------------------------------------------------
+ *
+ * PREAMBLE
+ * The goals of the Open Font License (OFL) are to stimulate worldwide
+ * development of collaborative font projects, to support the font creation
+ * efforts of academic and linguistic communities, and to provide a free and
+ * open framework in which fonts may be shared and improved in partnership
+ * with others.
+ *
+ * The OFL allows the licensed fonts to be used, studied, modified and
+ * redistributed freely as long as they are not sold by themselves. The
+ * fonts, including any derivative works, can be bundled, embedded,
+ * redistributed and/or sold with any software provided that any reserved
+ * names are not used by derivative works. The fonts and derivatives,
+ * however, cannot be released under any other type of license. The
+ * requirement for fonts to remain under this license does not apply
+ * to any document created using the fonts or their derivatives.
+ *
+ * DEFINITIONS
+ * "Font Software" refers to the set of files released by the Copyright
+ * Holder(s) under this license and clearly marked as such. This may
+ * include source files, build scripts and documentation.
+ *
+ * "Reserved Font Name" refers to any names specified as such after the
+ * copyright statement(s).
+ *
+ * "Original Version" refers to the collection of Font Software components as
+ * distributed by the Copyright Holder(s).
+ *
+ * "Modified Version" refers to any derivative made by adding to, deleting,
+ * or substituting -- in part or in whole -- any of the components of the
+ * Original Version, by changing formats or by porting the Font Software to a
+ * new environment.
+ *
+ * "Author" refers to any designer, engineer, programmer, technical
+ * writer or other person who contributed to the Font Software.
+ *
+ * PERMISSION & CONDITIONS
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of the Font Software, to use, study, copy, merge, embed, modify,
+ * redistribute, and sell modified and unmodified copies of the Font
+ * Software, subject to the following conditions:
+ *
+ * 1) Neither the Font Software nor any of its individual components,
+ * in Original or Modified Versions, may be sold by itself.
+ *
+ * 2) Original or Modified Versions of the Font Software may be bundled,
+ * redistributed and/or sold with any software, provided that each copy
+ * contains the above copyright notice and this license. These can be
+ * included either as stand-alone text files, human-readable headers or
+ * in the appropriate machine-readable metadata fields within text or
+ * binary files as long as those fields can be easily viewed by the user.
+ *
+ * 3) No Modified Version of the Font Software may use the Reserved Font
+ * Name(s) unless explicit written permission is granted by the corresponding
+ * Copyright Holder. This restriction only applies to the primary font name as
+ * presented to the users.
+ *
+ * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+ * Software shall not be used to promote, endorse or advertise any
+ * Modified Version, except to acknowledge the contribution(s) of the
+ * Copyright Holder(s) and the Author(s) or with their explicit written
+ * permission.
+ *
+ * 5) The Font Software, modified or unmodified, in part or in whole,
+ * must be distributed entirely under this license, and must not be
+ * distributed under any other license. The requirement for fonts to
+ * remain under this license does not apply to any document created
+ * using the Font Software.
+ *
+ * TERMINATION
+ * This license becomes null and void if any of the above conditions are
+ * not met.
+ *
+ * DISCLAIMER
+ * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+ * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+ * OTHER DEALINGS IN THE FONT SOFTWARE.
+ */
+
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
new file mode 100644
index 0000000000..b49dd43729
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
new file mode 100644
index 0000000000..7959fef075
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
new file mode 100644
index 0000000000..839cd589dc
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
new file mode 100644
index 0000000000..bababa09e3
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf
new file mode 100644
index 0000000000..61e3090c1c
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf
new file mode 100644
index 0000000000..85686d967d
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/index.rhtml b/lib/rdoc/generator/template/darkfish/index.rhtml
index d076c2a252..7d1c74807b 100644
--- a/lib/rdoc/generator/template/darkfish/index.rhtml
+++ b/lib/rdoc/generator/template/darkfish/index.rhtml
@@ -1,8 +1,10 @@
-<body>
-<nav id="metadata">
- <%= render '_sidebar_navigation.rhtml' %>
+<body id="top" role="document" class="file">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
- <%= render '_sidebar_search.rhtml' %>
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<div id="project-metadata">
<%= render '_sidebar_pages.rhtml' %>
@@ -10,10 +12,12 @@
</div>
</nav>
-<div id="documentation" class="description">
-<% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %>
+<main role="main">
+<% if @options.main_page and
+ 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>
+</main>
+
diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js
index f26fd45d3a..06fef3b215 100644
--- a/lib/rdoc/generator/template/darkfish/js/darkfish.js
+++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js
@@ -52,20 +52,6 @@ function hookDebuggingToggle() {
$('#debugging-toggle img').click( toggleDebuggingSection );
};
-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);
@@ -149,7 +135,6 @@ $(document).ready( function() {
hookDebuggingToggle();
hookSearch();
highlightLocationTarget();
- hookTableOfContentsToggle();
$('ul.link-list a').bind( "click", highlightClickTarget );
});
diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js
index dbdfdcbc4c..563ed7e54e 100644
--- a/lib/rdoc/generator/template/darkfish/js/search.js
+++ b/lib/rdoc/generator/template/darkfish/js/search.js
@@ -39,9 +39,12 @@ Search.prototype = $.extend({}, Navigation, new function() {
if (value == '') {
this.lastQuery = value;
this.$result.empty();
+ this.$result.attr('aria-expanded', 'false');
this.setNavigationActive(false);
} else if (value != this.lastQuery) {
this.lastQuery = value;
+ this.$result.attr('aria-busy', 'true');
+ this.$result.attr('aria-expanded', 'true');
this.firstRun = true;
this.searcher.find(value);
}
@@ -55,23 +58,28 @@ Search.prototype = $.extend({}, Navigation, new function() {
}
for (var i=0, l = results.length; i < l; i++) {
- target.appendChild(this.renderItem.call(this, results[i]));
+ var item = this.renderItem.call(this, results[i]);
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
+ target.appendChild(item);
};
if (this.firstRun && results.length > 0) {
this.firstRun = false;
this.$current = $(target.firstChild);
- this.$current.addClass('current');
+ this.$current.addClass('search-selected');
}
if (jQuery.browser.msie) this.$element[0].className += '';
+
+ if (isLast) this.$result.attr('aria-busy', 'false');
}
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.$current.removeClass('search-selected');
+ $next.addClass('search-selected');
+ this.$input.attr('aria-activedescendant', $next.attr('id'));
this.scrollIntoView($next[0], this.$view[0]);
this.$current = $next;
}
diff --git a/lib/rdoc/generator/template/darkfish/page.rhtml b/lib/rdoc/generator/template/darkfish/page.rhtml
index 942172919b..4a6b006bb3 100644
--- a/lib/rdoc/generator/template/darkfish/page.rhtml
+++ b/lib/rdoc/generator/template/darkfish/page.rhtml
@@ -1,18 +1,18 @@
-<body class="file">
-<nav id="metadata">
- <%= render '_sidebar_navigation.rhtml' %>
-
- <%= render '_sidebar_search.rhtml' %>
+<body id="top" role="document" class="file">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<%= 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>
+<main role="main" aria-label="Page <%=h file.full_name%>">
+<%= file.description %>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/rdoc.css b/lib/rdoc/generator/template/darkfish/rdoc.css
index 35207033de..f86edb8367 100644
--- a/lib/rdoc/generator/template/darkfish/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/rdoc.css
@@ -12,21 +12,10 @@
* { padding: 0; margin: 0; }
body {
- background: #efefef;
- font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif;
- margin-left: 40px;
+ background: #fafafa;
+ font-family: Lato, sans-serif;
+ font-weight: 300;
}
-body.file-popup {
- font-size: 90%;
- margin-left: 0;
-}
-
-h1 {
- font-size: 300%;
- text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;
- color: #6C8C22;
-}
-h2,h3,h4 { margin-top: 1.5em; }
h1 span,
h2 span,
@@ -36,7 +25,7 @@ h5 span,
h6 span {
display: none;
padding-left: 1em;
- font-size: 50%;
+ font-size: 10px;
vertical-align: super;
}
@@ -54,24 +43,15 @@ h6:hover span {
color: #6C8C22;
text-decoration: none;
}
+
:link:hover,
:visited:hover {
border-bottom: 1px dotted #6C8C22;
}
+code,
pre {
- background: #ddd;
- padding: 0.5em 0;
-}
-
-blockquote {
- background: #ddd;
- margin: 1em;
- padding: 0.25em;
-}
-
-blockquote > :first-child {
- margin-top: 0 !important;
+ font-family: "Source Code Pro", Monaco, monospace;
}
/* @group Generic Classes */
@@ -82,10 +62,13 @@ blockquote > :first-child {
#search-field {
width: 98%;
- background: #eee;
+ background: white;
border: none;
height: 1.5em;
-webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ text-align: left;
}
#search-field:focus {
background: #f1edba;
@@ -121,44 +104,31 @@ blockquote > :first-child {
/* @end */
/* @group Index Page, Standalone file pages */
-.indexpage ul {
- line-height: 160%;
+.table-of-contents ul {
+ margin: 1em;
list-style: none;
}
-.indexpage ul :link,
-.indexpage ul :visited {
- font-size: 16px;
-}
-.indexpage li {
- padding-left: 20px;
+.table-of-contents ul ul {
+ margin-top: 0.25em;
}
-.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;
-}
-.indexpage li.class {
- background: url(images/ruby.png) no-repeat left 4px;
-}
-.indexpage li.file {
- background: url(images/page_white_text.png) no-repeat left 4px;
+.table-of-contents ul :link,
+.table-of-contents ul :visited {
+ font-size: 16px;
}
-.indexpage li li {
- background: url(images/tag_blue.png) no-repeat left 4px;
+
+.table-of-contents li {
+ margin-bottom: 0.25em;
}
-.indexpage li .toc-toggle {
+
+.table-of-contents li .toc-toggle {
width: 16px;
height: 16px;
background: url(images/add.png) no-repeat;
}
-.indexpage li .toc-toggle.open {
+.table-of-contents li .toc-toggle.open {
background: url(images/delete.png) no-repeat;
}
@@ -166,14 +136,32 @@ blockquote > :first-child {
/* @group Top-Level Structure */
-#metadata {
+nav {
float: left;
width: 260px;
+ font-family: Helvetica, sans-serif;
+ font-size: 14px;
}
-#documentation {
- margin: 2em 1em 5em 300px;
+main {
+ display: block;
+ margin: 0 2em 5em 260px;
+ padding-left: 20px;
min-width: 340px;
+ font-size: 16px;
+}
+
+main h1,
+main h2,
+main h3,
+main h4,
+main h5,
+main h6 {
+ font-family: Helvetica, sans-serif;
+}
+
+.table-of-contents main {
+ margin-left: 2em;
}
#validator-badges {
@@ -184,67 +172,68 @@ blockquote > :first-child {
/* @end */
-/* @group Metadata Section */
-#metadata .section {
- background-color: #dedede;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border: 1px solid #aaa;
- margin: 0 8px 8px;
+/* @group navigation */
+nav {
+ margin-bottom: 1em;
+}
+
+nav .nav-section {
+ margin-top: 2em;
+ border-top: 2px solid #aaa;
font-size: 90%;
overflow: hidden;
}
-#metadata h3.section-header {
+
+nav h2 {
margin: 0;
- padding: 2px 8px;
- background: #ccc;
- color: #666;
- -moz-border-radius-topleft: 4px;
- -moz-border-radius-topright: 4px;
- -webkit-border-top-left-radius: 4px;
- -webkit-border-top-right-radius: 4px;
- border-bottom: 1px solid #aaa;
-}
-#metadata #home-section h3.section-header {
- border-bottom: 0;
+ padding: 2px 8px 2px 8px;
+ background-color: #e8e8e8;
+ color: #555;
+ font-size: 125%;
+ text-align: center;
}
-#metadata ul,
-#metadata dl,
-#metadata p {
- padding: 8px;
- list-style: none;
+nav h3 {
+ margin: 0;
+ padding: 2px 8px 2px 8px;
+ text-align: right;
+ background-color: #e8e8e8;
+ color: #555;
}
-#file-metadata {
- margin-top: 2em;
+nav ul,
+nav dl,
+nav p {
+ padding: 4px 8px 0;
+ list-style: none;
}
-#file-metadata ul {
- padding-left: 28px;
- list-style-image: url(images/page_green.png);
+#project-navigation .nav-section {
+ margin: 0;
+ border-top: 0;
}
-#table-of-contents {
- margin-top: 2em;
+#home-section h2,
+#home-section h3 {
+ text-align: center;
}
-#table-of-contents ul {
- padding-left: 28px;
- list-style-image: url(images/tag_blue.png);
+#search-section {
+ margin-top: 0;
+ border-top: 0;
}
-dl.svninfo {
- color: #666;
- margin: 0;
-}
-dl.svninfo dt {
- font-weight: bold;
+#search-field-wrapper {
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ padding: 3px 8px;
+ background-color: #e8e8e8;
+ color: #555;
}
ul.link-list li {
white-space: nowrap;
- line-height: 20px;
+ line-height: 1.4em;
}
ul.link-list .type {
@@ -262,100 +251,119 @@ ul.link-list .type {
/* @end */
-/* @group Class Metadata Section */
-#class-metadata {
- margin-top: 2em;
+/* @group Documentation Section */
+main {
+ color: #333;
}
-/* @end */
-/* @group Project Metadata Section */
-#project-metadata {
- margin-top: 2em;
+main > h1:first-child,
+main > h2:first-child,
+main > h3:first-child,
+main > h4:first-child,
+main > h5:first-child,
+main > h6:first-child {
+ margin-top: 0px;
}
-#project-metadata .section {
- border: 1px solid #aaa;
+main sup {
+ vertical-align: super;
+ font-size: 0.8em;
}
-#project-metadata h3.section-header {
- border-bottom: 1px solid #aaa;
- position: relative;
+
+/* The heading with the class name */
+main h1[class] {
+ margin-top: 0;
+ margin-bottom: 1em;
+ font-size: 2em;
+ color: #6C8C22;
}
-#project-metadata form {
- color: #777;
- background: #ccc;
+main h1 {
+ margin: 2em 0 0.5em;
+ font-size: 1.7em;
}
-/* @end */
+main h2 {
+ margin: 2em 0 0.5em;
+ font-size: 1.5em;
+}
-/* @group Documentation Section */
-.description {
- font-size: 100%;
- color: #333;
+main h3 {
+ margin: 2em 0 0.5em;
+ font-size: 1.2em;
}
-.description p {
- margin: 1em 0.4em;
+main h4 {
+ margin: 2em 0 0.5em;
+ font-size: 1.1em;
}
-.description li p {
- margin: 0;
+main h5 {
+ margin: 2em 0 0.5em;
+ font-size: 1em;
}
-.description ol,
-.description ul {
- margin-left: 1.5em;
+main h6 {
+ margin: 2em 0 0.5em;
+ font-size: 1em;
}
-.description ol li,
-.description ul li {
+
+main p {
+ margin: 0 0 0.5em;
line-height: 1.4em;
}
-.note-list {
- margin: 8px 0;
+main pre {
+ margin: 1.2em 0.5em;
+ padding: 1em;
+ font-size: 0.8em;
}
-.label-list {
- margin: 8px 1.5em;
- border: 1px solid #ccc;
+main hr {
+ margin: 1.5em 1em;
+ border: 2px solid #ddd;
}
-.description .label-list {
- font-size: 14px;
+
+main blockquote {
+ margin: 0 2em 1.2em 1.2em;
+ padding-left: 0.5em;
+ border-left: 2px solid #ddd;
}
-.note-list dt {
- font-weight: bold;
+main ol,
+main ul {
+ margin: 1em 2em;
}
-.note-list dd {
- padding: 0 12px;
+
+main li > p {
+ margin-bottom: 0.5em;
}
-.label-list dt {
- padding: 2px 4px;
- font-weight: bold;
- background: #ddd;
+main dl {
+ margin: 1em 0.5em;
}
-.label-list dd {
- padding: 2px 12px;
+
+main dt {
+ margin-bottom: 0.5em;
+ font-weight: bold;
}
-.label-list dd + dt,
-.note-list dd + dt {
- margin-top: 0.7em;
+
+main dd {
+ margin: 0 1em 1em 0.5em;
}
-#documentation .section {
- font-size: 90%;
+main header h2 {
+ margin-top: 2em;
+ border-width: 0;
+ border-top: 4px solid #bbb;
+ font-size: 130%;
}
-#documentation h2.section-header {
- margin-top: 1em;
- padding: 0.25em 0.5em;
- background: #ccc;
- color: #333;
- font-size: 175%;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
+main header h3 {
+ margin: 2em 0 1.5em;
+ border-width: 0;
+ border-top: 3px solid #bbb;
+ font-size: 120%;
}
.documentation-section-title {
@@ -364,47 +372,35 @@ ul.link-list .type {
.documentation-section-title .section-click-top {
position: absolute;
top: 6px;
- right: 12px;
+ left: 12px;
font-size: 10px;
color: #9b9877;
visibility: hidden;
- padding-right: 0.5px;
+ padding-left: 0.5px;
}
.documentation-section-title:hover .section-click-top {
visibility: visible;
}
-#documentation h3.section-header {
- margin-top: 1em;
- padding: 0.25em 0.5em;
- background-color: #dedede;
- color: #333;
- font-size: 150%;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-#constants-list > dl,
-#attributes-list > dl {
+.constants-list > dl {
margin: 1em 0 2em;
border: 0;
}
-#constants-list > dl dt,
-#attributes-list > dl dt {
+
+.constants-list > dl dt {
+ margin-bottom: 0.75em;
padding-left: 0;
- font-weight: bold;
- font-family: Monaco, "Andale Mono";
- background: inherit;
+ font-family: "Source Code Pro", Monaco, monospace;
+ font-size: 110%;
}
-#constants-list > dl dt a,
-#attributes-list > dl dt a {
+
+.constants-list > dl dt a {
color: inherit;
}
-#constants-list > dl dd,
-#attributes-list > dl dd {
- margin: 0 0 1em 0;
+
+.constants-list > dl dd {
+ margin: 0 0 2em 0;
padding: 0;
color: #666;
}
@@ -428,93 +424,77 @@ ul.link-list .type {
/* @group Method Details */
-#documentation .method-source-code {
+main .method-source-code {
display: none;
}
-#documentation .method-description .method-calls-super {
+main .method-description .method-calls-super {
color: #333;
- font-weight: bolder;
+ font-weight: bold;
}
-#documentation .method-detail {
- margin: 0.5em 0;
- padding: 0.5em 0;
+main .method-detail {
+ margin-bottom: 2.5em;
cursor: pointer;
}
-#documentation .method-detail:hover {
- background-color: #f1edba;
+
+main .method-detail:target {
+ margin-left: -10px;
+ border-left: 10px solid #f1edba;
}
-#documentation .method-heading {
+
+main .method-heading {
position: relative;
- padding: 2px 4px 0 20px;
- font-size: 125%;
+ font-family: "Source Code Pro", Monaco, monospace;
+ font-size: 110%;
font-weight: bold;
color: #333;
- background: url(images/brick.png) no-repeat left bottom;
}
-#documentation .method-heading :link,
-#documentation .method-heading :visited {
+main .method-heading :link,
+main .method-heading :visited {
color: inherit;
}
-#documentation .method-click-advice {
+main .method-click-advice {
position: absolute;
top: 2px;
right: 5px;
- font-size: 10px;
+ font-size: 12px;
color: #9b9877;
visibility: hidden;
padding-right: 20px;
line-height: 20px;
background: url(images/zoom.png) no-repeat right top;
}
-#documentation .method-heading:hover .method-click-advice {
+main .method-heading:hover .method-click-advice {
visibility: visible;
}
-#documentation .method-alias .method-heading {
- color: #666;
- background: url(images/brick_link.png) no-repeat left bottom;
-}
-
-#documentation .method-description,
-#documentation .aliases {
- margin: 0 20px;
+main .method-alias .method-heading {
color: #666;
}
-#documentation .method-description p,
-#documentation .aliases p {
- line-height: 1.2em;
+main .method-description,
+main .aliases {
+ margin-top: 0.75em;
+ color: #333;
}
-#documentation .aliases {
+main .aliases {
padding-top: 4px;
font-style: italic;
cursor: default;
}
-#documentation .method-description p {
- margin-bottom: 0.5em;
-}
-#documentation .method-description ul {
+main .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;
-}
-#documentation #attribute-method-details .method-detail:hover {
+main #attribute-method-details .method-detail:hover {
background-color: transparent;
cursor: default;
}
-#documentation .attribute-access-type {
- font-size: 60%;
+main .attribute-access-type {
text-transform: uppercase;
- vertical-align: super;
- padding: 0 2px;
+ padding: 0 1em;
}
/* @end */
@@ -523,15 +503,12 @@ pre {
/* @group Source Code */
pre {
- overflow: auto;
- background: #262626;
- color: white;
+ margin: 0.5em 0;
border: 1px dashed #999;
padding: 0.5em;
-}
-
-.description pre {
- margin: 0 0.4em;
+ background: #262626;
+ color: white;
+ overflow: auto;
}
.ruby-constant { color: #7fffd4; background: transparent; }
@@ -540,7 +517,7 @@ pre {
.ruby-operator { color: #00ffee; background: transparent; }
.ruby-identifier { color: #ffdead; background: transparent; }
.ruby-node { color: #ffa07a; background: transparent; }
-.ruby-comment { color: #dc0000; font-weight: bold; background: transparent; }
+.ruby-comment { color: #dc0000; background: transparent; }
.ruby-regexp { color: #ffa07a; background: transparent; }
.ruby-value { color: #7fffd4; background: transparent; }
@@ -548,23 +525,24 @@ pre {
/* @group search results */
-#search-results h1 {
- font-size: 1em;
+#search-results {
+ font-family: Lato, sans-serif;
+ font-weight: 300;
+}
+
+#search-results .search-match {
+ font-family: Helvetica, sans-serif;
font-weight: normal;
- text-shadow: none;
}
-#search-results .current {
- background: #ccc;
+#search-results .search-selected {
+ background: #e8e8e8;
border-bottom: 1px solid transparent;
}
#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;
}
@@ -589,6 +567,7 @@ pre {
#search-results pre {
margin: 0.5em;
+ font-family: "Source Code Pro", Monaco, monospace;
}
/* @end */
diff --git a/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
index 24c9ba8eaa..f0841572c3 100644
--- a/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
+++ b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
@@ -1,5 +1,5 @@
-<body>
-<nav id="metadata">
+<body role="document">
+<nav role="navigation">
<%= render '_sidebar_navigation.rhtml' %>
<%= render '_sidebar_search.rhtml' %>
@@ -10,9 +10,9 @@
</div>
</nav>
-<div id="documentation" class="description">
+<main role="main">
<h1>Not Found</h1>
- <p>The page <kbd><%=h path %></kbd> was not found
-</div>
+ <p><%= message %>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
index 63b4ee8ff7..3a33659aea 100644
--- a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
+++ b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
@@ -1,16 +1,43 @@
-<body>
-<nav id="metadata">
-<%= render '_sidebar_search.rhtml' %>
+<body role="document">
+<nav role="navigation">
+ <div id="project-navigation">
+ <div id="home-section" class="nav-section">
+ <h2>
+ <a href="<%= rel_prefix %>/" rel="home">Home</a>
+ </h2>
+ </div>
+
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<%= render '_sidebar_installed.rhtml' %>
</nav>
-<div id="documentation" class="description">
+<main role="main">
<h1>Local RDoc Documentation</h1>
<p>Here you can browse local documentation from the ruby standard library and
your installed gems.
+<% extra_dirs = installed.select { |_, _, _, type,| type == :extra } %>
+<% unless extra_dirs.empty? %>
+ <h2>Extra Documentation Directories</h2>
+
+ <p>The following additional documentation directories are available:</p>
+
+ <ol>
+ <% extra_dirs.each do |name, href, exists, _, path| %>
+ <li>
+ <% if exists %>
+ <a href="<%= href %>"><%= h name %></a> (<%= h path %>)
+ <% else %>
+ <%= h name %> (<%= h path %>; <i>not available</i>)
+ <% end %>
+ </li>
+ <% end %>
+ </ol>
+<% end %>
+
<% gems = installed.select { |_, _, _, type,| type == :gem } %>
<% missing = gems.reject { |_, _, exists,| exists } %>
<% unless missing.empty? then %>
@@ -32,6 +59,5 @@
<% end %>
</ul>
<% end %>
-
-</div>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
index bebff40f6a..7ff1a9e93e 100644
--- a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
+++ b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
@@ -1,9 +1,10 @@
-<body class="indexpage">
-<h1><%= h @title %></h1>
+<body id="top" class="table-of-contents">
+<main role="main">
+<h1 class="class"><%= h @title %></h1>
<% simple_files = @files.select { |f| f.text? } %>
<% unless simple_files.empty? then %>
-<h2>Pages</h2>
+<h2 id="pages">Pages</h2>
<ul>
<% simple_files.sort.each do |file| %>
<li class="file">
@@ -12,8 +13,7 @@
# 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">
+ <ul>
<% table.each do |heading| %>
<li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
<% end %>
@@ -24,7 +24,7 @@
</ul>
<% end %>
-<h2 id="classes">Classes/Modules</h2>
+<h2 id="classes">Classes and Modules</h2>
<ul>
<% @modsort.each do |klass| %>
<li class="<%= klass.type %>">
@@ -34,22 +34,25 @@
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">
+ <ul>
<% table.each do |item| %>
<li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
<% end %>
</ul>
<% end %>
</li>
- <% end %>
+<% 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 %> &mdash; <%= method.parent.full_name %></a>
- <% end %>
+<% @store.all_classes_and_modules.map do |mod|
+ mod.method_list
+ end.flatten.sort.each do |method| %>
+ <li class="method">
+ <a href="<%= method.path %>"><%= h method.pretty_name %></a>
+ &mdash;
+ <span class="container"><%= method.parent.full_name %></span>
+<% end %>
</ul>
+</main>
diff --git a/lib/rdoc/include.rb b/lib/rdoc/include.rb
index 1e9ff5a464..75ed9c7bff 100644
--- a/lib/rdoc/include.rb
+++ b/lib/rdoc/include.rb
@@ -1,119 +1,9 @@
##
-# A Module include in a class with \#include
+# A Module included in a class with \#include
+#
+# RDoc::Include.new 'Enumerable', 'comment ...'
-class RDoc::Include < RDoc::CodeObject
-
- ##
- # Name of included module
-
- attr_accessor :name
-
- ##
- # Creates a new Include for +name+ with +comment+
-
- def initialize(name, comment)
- super()
- @name = name
- self.comment = comment
- @module = nil # cache for module if found
- end
-
- ##
- # Includes 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.include %s>" % [
- self.class,
- object_id,
- parent_name, @name,
- ]
- end
-
- ##
- # Attempts to locate the included module object. Returns the name if not
- # known.
- #
- # The scoping rules of Ruby to resolve the name of an included module are:
- # - first look into the children of the current context;
- # - 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
-
- # 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.includes.take_while { |i| i != self }.reverse
- searched.each do |i|
- inc = i.module
- next if String === inc
- full_name = inc.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:
- "include #@name in: #{parent}"
- end
+class RDoc::Include < RDoc::Mixin
end
diff --git a/lib/rdoc/known_classes.rb b/lib/rdoc/known_classes.rb
index 863be4bd5c..ddc932c7c0 100644
--- a/lib/rdoc/known_classes.rb
+++ b/lib/rdoc/known_classes.rb
@@ -62,6 +62,7 @@ module RDoc
"rb_mDL" => "DL",
"rb_mEnumerable" => "Enumerable",
"rb_mErrno" => "Errno",
+ "rb_mFConst" => "File::Constants",
"rb_mFileTest" => "FileTest",
"rb_mGC" => "GC",
"rb_mKernel" => "Kernel",
diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb
index 5133c7b0c8..ed04191ffc 100644
--- a/lib/rdoc/markdown.rb
+++ b/lib/rdoc/markdown.rb
@@ -8,6 +8,16 @@
# RDoc::Options@Saved+Options for instructions on setting up a `.doc_options`
# file to store your project default.
#
+# ## Usage
+#
+# Here is a brief example of using this parse to read a markdown file by hand.
+#
+# data = File.read("README.md")
+# formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
+# html = RDoc::Markdown.parse(data).accept(@formatter)
+#
+# # do something with html
+#
# ## Extensions
#
# The following markdown extensions are supported by the parser, but not all
@@ -120,7 +130,6 @@
# ## Limitations
#
# * Link titles are not used
-# * Image links are not generated correctly
# * Footnotes are collapsed into a single paragraph
#
# ## Author
@@ -172,8 +181,7 @@ class RDoc::Markdown
# 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
+ set_string str, 0
@memoizations = Hash.new { |h,k| h[k] = {} }
@result = nil
@failed_rule = nil
@@ -186,7 +194,7 @@ class RDoc::Markdown
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
@@ -220,6 +228,13 @@ class RDoc::Markdown
@string[start..@pos-1]
end
+ # Sets the string and current parsing position for the parser.
+ def set_string string, pos
+ @string = string
+ @string_size = string ? string.size : 0
+ @pos = pos
+ end
+
def show_pos
width = 10
if @pos < width
@@ -326,19 +341,19 @@ class RDoc::Markdown
return nil
end
- if "".respond_to? :getbyte
+ if "".respond_to? :ord
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
- s = @string.getbyte @pos
+ s = @string[@pos].ord
@pos += 1
s
end
else
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
@@ -387,8 +402,7 @@ class RDoc::Markdown
old_pos = @pos
old_string = @string
- @pos = other.pos
- @string = other.string
+ set_string other.string, other.pos
begin
if val = __send__(rule, *args)
@@ -399,8 +413,7 @@ class RDoc::Markdown
end
val
ensure
- @pos = old_pos
- @string = old_string
+ set_string old_string, old_pos
end
end
@@ -548,15 +561,13 @@ class RDoc::Markdown
def self.extension name
EXTENSIONS << name
- eval <<-RUBY
- def #{name}?
- extension? __method__
- end
+ define_method "#{name}?" do
+ extension? name
+ end
- def #{name}= enable
- extension __method__, enable
- end
- RUBY
+ define_method "#{name}=" do |enable|
+ extension name, enable
+ end
end
##
@@ -636,8 +647,6 @@ class RDoc::Markdown
# Is the extension `name` enabled?
def extension? name
- name = name.to_s.delete('?').intern
-
@extensions.include? name
end
@@ -647,8 +656,6 @@ class RDoc::Markdown
# Enables or disables the extension with `name`
def extension name, enable
- name = name.to_s.delete('=').intern
-
if enable then
@extensions |= [name]
else
@@ -870,13 +877,13 @@ class RDoc::Markdown
return _tmp
end
- # Block = BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)
+ # 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)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -942,12 +949,12 @@ class RDoc::Markdown
return _tmp
end
- # Para = NonindentSpace Inlines:a BlankLine+ { paragraph a }
+ # Para = @NonindentSpace Inlines:a @BlankLine+ { paragraph a }
def _Para
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -959,10 +966,10 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -1008,13 +1015,13 @@ class RDoc::Markdown
return _tmp
end
- # AtxInline = !Newline !(Sp? "#"* Sp Newline) Inline
+ # AtxInline = !@Newline !(@Sp? /#*/ @Sp @Newline) Inline
def _AtxInline
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -1026,7 +1033,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save4
@@ -1035,21 +1042,17 @@ class RDoc::Markdown
self.pos = _save3
break
end
- while true
- _tmp = match_string("#")
- break unless _tmp
- end
- _tmp = true
+ _tmp = scan(/\A(?-mix:#*)/)
unless _tmp
self.pos = _save3
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save3
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save3
end
@@ -1073,36 +1076,13 @@ class RDoc::Markdown
return _tmp
end
- # AtxStart = < ("######" | "#####" | "####" | "###" | "##" | "#") > { text.length }
+ # AtxStart = < /\#{1,6}/ > { 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
-
+ _tmp = scan(/\A(?-mix:\#{1,6})/)
if _tmp
text = get_text(_text_start)
end
@@ -1122,7 +1102,7 @@ class RDoc::Markdown
return _tmp
end
- # AtxHeading = AtxStart:s Sp? AtxInline+:a (Sp? "#"* Sp)? Newline { RDoc::Markup::Heading.new(s, a.join) }
+ # AtxHeading = AtxStart:s @Sp? AtxInline+:a (@Sp? /#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) }
def _AtxHeading
_save = self.pos
@@ -1134,7 +1114,7 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save1
@@ -1168,7 +1148,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save5
@@ -1177,16 +1157,12 @@ class RDoc::Markdown
self.pos = _save4
break
end
- while true
- _tmp = match_string("#")
- break unless _tmp
- end
- _tmp = true
+ _tmp = scan(/\A(?-mix:#*)/)
unless _tmp
self.pos = _save4
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
end
@@ -1201,7 +1177,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -1236,26 +1212,17 @@ class RDoc::Markdown
return _tmp
end
- # SetextBottom1 = "===" "="* Newline
+ # SetextBottom1 = /={3,}/ @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
+ _tmp = scan(/\A(?-mix:={3,})/)
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
end
@@ -1266,26 +1233,17 @@ class RDoc::Markdown
return _tmp
end
- # SetextBottom2 = "---" "-"* Newline
+ # SetextBottom2 = /-{3,}/ @Newline
def _SetextBottom2
_save = self.pos
while true # sequence
- _tmp = match_string("---")
+ _tmp = scan(/\A(?-mix:-{3,})/)
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)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
end
@@ -1296,7 +1254,7 @@ class RDoc::Markdown
return _tmp
end
- # SetextHeading1 = &(RawLine SetextBottom1) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }
+ # SetextHeading1 = &(@RawLine SetextBottom1) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }
def _SetextHeading1
_save = self.pos
@@ -1305,7 +1263,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save2
break
@@ -1322,7 +1280,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -1333,7 +1291,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -1360,7 +1318,7 @@ class RDoc::Markdown
_save6 = self.pos
while true # sequence
_save7 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -1392,7 +1350,7 @@ class RDoc::Markdown
break
end
_save8 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save8
@@ -1401,7 +1359,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -1423,7 +1381,7 @@ class RDoc::Markdown
return _tmp
end
- # SetextHeading2 = &(RawLine SetextBottom2) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }
+ # 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
@@ -1432,7 +1390,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save2
break
@@ -1449,7 +1407,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -1460,7 +1418,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -1487,7 +1445,7 @@ class RDoc::Markdown
_save6 = self.pos
while true # sequence
_save7 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -1519,7 +1477,7 @@ class RDoc::Markdown
break
end
_save8 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save8
@@ -1528,7 +1486,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -1591,12 +1549,12 @@ class RDoc::Markdown
return _tmp
end
- # BlockQuoteRaw = StartList:a (">" " "? Line:l { a << l } (!">" !BlankLine Line:c { a << c })* (BlankLine:n { a << n })*)+ { inner_parse a.join }
+ # 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)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -1646,7 +1604,7 @@ class RDoc::Markdown
break
end
_save7 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -1678,7 +1636,7 @@ class RDoc::Markdown
_save9 = self.pos
while true # sequence
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
n = @result
unless _tmp
self.pos = _save9
@@ -1746,7 +1704,7 @@ class RDoc::Markdown
break
end
_save15 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save15
unless _tmp
@@ -1778,7 +1736,7 @@ class RDoc::Markdown
_save17 = self.pos
while true # sequence
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
n = @result
unless _tmp
self.pos = _save17
@@ -1823,13 +1781,13 @@ class RDoc::Markdown
return _tmp
end
- # NonblankIndentedLine = !BlankLine IndentedLine
+ # NonblankIndentedLine = !@BlankLine IndentedLine
def _NonblankIndentedLine
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -1847,14 +1805,14 @@ class RDoc::Markdown
return _tmp
end
- # VerbatimChunk = BlankLine*:a NonblankIndentedLine+:b { a.concat b }
+ # VerbatimChunk = @BlankLine*:a NonblankIndentedLine+:b { a.concat b }
def _VerbatimChunk
_save = self.pos
while true # sequence
_ary = []
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_ary << @result if _tmp
break unless _tmp
end
@@ -1934,12 +1892,12 @@ class RDoc::Markdown
return _tmp
end
- # HorizontalRule = NonindentSpace ("*" Sp "*" Sp "*" (Sp "*")* | "-" Sp "-" Sp "-" (Sp "-")* | "_" Sp "_" Sp "_" (Sp "_")*) Sp Newline BlankLine+ { RDoc::Markup::Rule.new 1 }
+ # 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)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -1955,7 +1913,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -1965,7 +1923,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -1979,7 +1937,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
break
@@ -2010,7 +1968,7 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
@@ -2020,7 +1978,7 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
@@ -2034,7 +1992,7 @@ class RDoc::Markdown
_save7 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save7
break
@@ -2065,7 +2023,7 @@ class RDoc::Markdown
self.pos = _save8
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save8
break
@@ -2075,7 +2033,7 @@ class RDoc::Markdown
self.pos = _save8
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save8
break
@@ -2089,7 +2047,7 @@ class RDoc::Markdown
_save10 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save10
break
@@ -2119,21 +2077,21 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
end
_save11 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2156,7 +2114,7 @@ class RDoc::Markdown
return _tmp
end
- # Bullet = !HorizontalRule NonindentSpace ("+" | "*" | "-") Spacechar+
+ # Bullet = !HorizontalRule @NonindentSpace /[+*-]/ @Spacechar+
def _Bullet
_save = self.pos
@@ -2169,40 +2127,26 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_NonindentSpace)
+ _tmp = _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
-
+ _tmp = scan(/\A(?-mix:[+*-])/)
unless _tmp
self.pos = _save
break
end
- _save3 = self.pos
- _tmp = apply(:_Spacechar)
+ _save2 = self.pos
+ _tmp = _Spacechar()
if _tmp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
else
- self.pos = _save3
+ self.pos = _save2
end
unless _tmp
self.pos = _save
@@ -2255,7 +2199,7 @@ class RDoc::Markdown
return _tmp
end
- # ListTight = ListItemTight+:a BlankLine* !(Bullet | Enumerator) { a }
+ # ListTight = ListItemTight+:a @BlankLine* !(Bullet | Enumerator) { a }
def _ListTight
_save = self.pos
@@ -2281,7 +2225,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2320,12 +2264,12 @@ class RDoc::Markdown
return _tmp
end
- # ListLoose = StartList:a (ListItem:b BlankLine* { a << b })+ { a }
+ # ListLoose = @StartList:a (ListItem:b @BlankLine* { a << b })+ { a }
def _ListLoose
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -2342,7 +2286,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2370,7 +2314,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2408,7 +2352,7 @@ class RDoc::Markdown
return _tmp
end
- # ListItem = (Bullet | Enumerator) StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }
+ # ListItem = (Bullet | Enumerator) @StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }
def _ListItem
_save = self.pos
@@ -2429,7 +2373,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -2484,7 +2428,7 @@ class RDoc::Markdown
return _tmp
end
- # ListItemTight = (Bullet | Enumerator) ListBlock:a (!BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }
+ # ListItemTight = (Bullet | Enumerator) ListBlock:a (!@BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }
def _ListItemTight
_save = self.pos
@@ -2516,7 +2460,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save4
unless _tmp
@@ -2564,13 +2508,13 @@ class RDoc::Markdown
return _tmp
end
- # ListBlock = !BlankLine Line:a ListBlockLine*:c { [a, *c] }
+ # ListBlock = !@BlankLine Line:a ListBlockLine*:c { [a, *c] }
def _ListBlock
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -2608,19 +2552,19 @@ class RDoc::Markdown
return _tmp
end
- # ListContinuationBlock = StartList:a BlankLine* { a << "\n" } (Indent ListBlock:b { a.concat b })+ { a }
+ # ListContinuationBlock = @StartList:a @BlankLine* { a << "\n" } (Indent ListBlock:b { a.concat b })+ { a }
def _ListContinuationBlock
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2703,12 +2647,12 @@ class RDoc::Markdown
return _tmp
end
- # Enumerator = NonindentSpace [0-9]+ "." Spacechar+
+ # Enumerator = @NonindentSpace [0-9]+ "." @Spacechar+
def _Enumerator
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -2748,10 +2692,10 @@ class RDoc::Markdown
break
end
_save4 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
if _tmp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
@@ -2809,13 +2753,13 @@ class RDoc::Markdown
return _tmp
end
- # ListBlockLine = !BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine
+ # ListBlockLine = !@BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine
def _ListBlockLine
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -8457,7 +8401,7 @@ class RDoc::Markdown
return _tmp
end
- # HtmlBlock = < (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > BlankLine+ { if html? then RDoc::Markup::Raw.new text end }
+ # HtmlBlock = < (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ { if html? then RDoc::Markup::Raw.new text end }
def _HtmlBlock
_save = self.pos
@@ -8489,10 +8433,10 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -9017,7 +8961,7 @@ class RDoc::Markdown
return _tmp
end
- # StyleBlock = < InStyleTags > BlankLine* { if css? then RDoc::Markup::Raw.new text end }
+ # StyleBlock = < InStyleTags > @BlankLine* { if css? then RDoc::Markup::Raw.new text end }
def _StyleBlock
_save = self.pos
@@ -9032,7 +8976,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -9054,7 +8998,7 @@ class RDoc::Markdown
return _tmp
end
- # Inlines = (!Endline Inline:i { i } | Endline:c &Inline { c })+:chunks Endline? { chunks }
+ # Inlines = (!@Endline Inline:i { i } | @Endline:c &Inline { c })+:chunks @Endline? { chunks }
def _Inlines
_save = self.pos
@@ -9068,7 +9012,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save4
unless _tmp
@@ -9094,7 +9038,7 @@ class RDoc::Markdown
_save5 = self.pos
while true # sequence
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
c = @result
unless _tmp
self.pos = _save5
@@ -9130,7 +9074,7 @@ class RDoc::Markdown
_save8 = self.pos
while true # sequence
_save9 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save9
unless _tmp
@@ -9156,7 +9100,7 @@ class RDoc::Markdown
_save10 = self.pos
while true # sequence
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
c = @result
unless _tmp
self.pos = _save10
@@ -9196,7 +9140,7 @@ class RDoc::Markdown
break
end
_save12 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
unless _tmp
_tmp = true
self.pos = _save12
@@ -9217,7 +9161,7 @@ class RDoc::Markdown
return _tmp
end
- # Inline = (Str | Endline | UlOrStarLine | Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)
+ # Inline = (Str | @Endline | UlOrStarLine | @Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)
def _Inline
_save = self.pos
@@ -9225,13 +9169,13 @@ class RDoc::Markdown
_tmp = apply(:_Str)
break if _tmp
self.pos = _save
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
break if _tmp
self.pos = _save
_tmp = apply(:_UlOrStarLine)
break if _tmp
self.pos = _save
- _tmp = apply(:_Space)
+ _tmp = _Space()
break if _tmp
self.pos = _save
_tmp = apply(:_Strong)
@@ -9274,16 +9218,16 @@ class RDoc::Markdown
return _tmp
end
- # Space = Spacechar+ { " " }
+ # Space = @Spacechar+ { " " }
def _Space
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
if _tmp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
@@ -9306,12 +9250,12 @@ class RDoc::Markdown
return _tmp
end
- # Str = StartList:a < NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }
+ # Str = @StartList:a < @NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }
def _Str
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -9319,10 +9263,10 @@ class RDoc::Markdown
end
_text_start = self.pos
_save1 = self.pos
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
if _tmp
while true
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
break unless _tmp
end
_tmp = true
@@ -9379,7 +9323,7 @@ class RDoc::Markdown
return _tmp
end
- # StrChunk = < (NormalChar | "_"+ &Alphanumeric)+ > { text }
+ # StrChunk = < (@NormalChar | /_+/ &Alphanumeric)+ > { text }
def _StrChunk
_save = self.pos
@@ -9389,30 +9333,20 @@ class RDoc::Markdown
_save2 = self.pos
while true # choice
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
break if _tmp
self.pos = _save2
_save3 = self.pos
while true # sequence
- _save4 = self.pos
- _tmp = match_string("_")
- if _tmp
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save4
- end
+ _tmp = scan(/\A(?-mix:_+)/)
unless _tmp
self.pos = _save3
break
end
- _save5 = self.pos
+ _save4 = self.pos
_tmp = apply(:_Alphanumeric)
- self.pos = _save5
+ self.pos = _save4
unless _tmp
self.pos = _save3
end
@@ -9427,40 +9361,30 @@ class RDoc::Markdown
if _tmp
while true
- _save6 = self.pos
+ _save5 = self.pos
while true # choice
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
break if _tmp
- self.pos = _save6
+ self.pos = _save5
- _save7 = self.pos
+ _save6 = self.pos
while true # sequence
- _save8 = self.pos
- _tmp = match_string("_")
- if _tmp
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save8
- end
+ _tmp = scan(/\A(?-mix:_+)/)
unless _tmp
- self.pos = _save7
+ self.pos = _save6
break
end
- _save9 = self.pos
+ _save7 = self.pos
_tmp = apply(:_Alphanumeric)
- self.pos = _save9
+ self.pos = _save7
unless _tmp
- self.pos = _save7
+ self.pos = _save6
end
break
end # end sequence
break if _tmp
- self.pos = _save6
+ self.pos = _save5
break
end # end choice
@@ -9489,7 +9413,7 @@ class RDoc::Markdown
return _tmp
end
- # EscapedChar = "\\" !Newline < /[:\\`|*_{}\[\]()#+.!><-]/ > { text }
+ # EscapedChar = "\\" !@Newline < /[:\\`|*_{}\[\]()#+.!><-]/ > { text }
def _EscapedChar
_save = self.pos
@@ -9500,7 +9424,7 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -9565,18 +9489,18 @@ class RDoc::Markdown
return _tmp
end
- # Endline = (LineBreak | TerminalEndline | NormalEndline)
+ # Endline = (@LineBreak | @TerminalEndline | @NormalEndline)
def _Endline
_save = self.pos
while true # choice
- _tmp = apply(:_LineBreak)
+ _tmp = _LineBreak()
break if _tmp
self.pos = _save
- _tmp = apply(:_TerminalEndline)
+ _tmp = _TerminalEndline()
break if _tmp
self.pos = _save
- _tmp = apply(:_NormalEndline)
+ _tmp = _NormalEndline()
break if _tmp
self.pos = _save
break
@@ -9586,23 +9510,23 @@ class RDoc::Markdown
return _tmp
end
- # NormalEndline = Sp Newline !BlankLine !">" !AtxStart !(Line ("===" "="* | "---" "-"*) Newline) { "\n" }
+ # NormalEndline = @Sp @Newline !@BlankLine !">" !AtxStart !(Line /={3,}|-{3,}=/ @Newline) { "\n" }
def _NormalEndline
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
end
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -9634,59 +9558,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
-
- _save6 = self.pos
- while true # choice
-
- _save7 = self.pos
- while true # sequence
- _tmp = match_string("===")
- unless _tmp
- self.pos = _save7
- break
- end
- while true
- _tmp = match_string("=")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save7
- end
- break
- end # end sequence
-
- break if _tmp
- self.pos = _save6
-
- _save9 = self.pos
- while true # sequence
- _tmp = match_string("---")
- unless _tmp
- self.pos = _save9
- break
- end
- while true
- _tmp = match_string("-")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save9
- end
- break
- end # end sequence
-
- break if _tmp
- self.pos = _save6
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix:={3,}|-{3,}=)/)
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -9711,22 +9588,22 @@ class RDoc::Markdown
return _tmp
end
- # TerminalEndline = Sp Newline Eof
+ # TerminalEndline = @Sp @Newline @Eof
def _TerminalEndline
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Eof)
+ _tmp = _Eof()
unless _tmp
self.pos = _save
end
@@ -9737,7 +9614,7 @@ class RDoc::Markdown
return _tmp
end
- # LineBreak = " " NormalEndline { RDoc::Markup::HardBreak.new }
+ # LineBreak = " " @NormalEndline { RDoc::Markup::HardBreak.new }
def _LineBreak
_save = self.pos
@@ -9747,7 +9624,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_NormalEndline)
+ _tmp = _NormalEndline()
unless _tmp
self.pos = _save
break
@@ -9764,13 +9641,13 @@ class RDoc::Markdown
return _tmp
end
- # Symbol = < SpecialChar > { text }
+ # Symbol = < @SpecialChar > { text }
def _Symbol
_save = self.pos
while true # sequence
_text_start = self.pos
- _tmp = apply(:_SpecialChar)
+ _tmp = _SpecialChar()
if _tmp
text = get_text(_text_start)
end
@@ -9824,7 +9701,7 @@ class RDoc::Markdown
return _tmp
end
- # StarLine = (< "****" "*"* > { text } | < Spacechar "*"+ &Spacechar > { text })
+ # StarLine = (< /\*{4,}/ > { text } | < @Spacechar /\*+/ &@Spacechar > { text })
def _StarLine
_save = self.pos
@@ -9833,25 +9710,7 @@ class RDoc::Markdown
_save1 = self.pos
while true # sequence
_text_start = self.pos
-
- _save2 = self.pos
- while true # sequence
- _tmp = match_string("****")
- unless _tmp
- self.pos = _save2
- break
- end
- while true
- _tmp = match_string("*")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save2
- end
- break
- end # end sequence
-
+ _tmp = scan(/\A(?-mix:\*{4,})/)
if _tmp
text = get_text(_text_start)
end
@@ -9870,37 +9729,27 @@ class RDoc::Markdown
break if _tmp
self.pos = _save
- _save4 = self.pos
+ _save2 = self.pos
while true # sequence
_text_start = self.pos
- _save5 = self.pos
+ _save3 = self.pos
while true # sequence
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save6 = self.pos
- _tmp = match_string("*")
- if _tmp
- while true
- _tmp = match_string("*")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save6
- end
+ _tmp = scan(/\A(?-mix:\*+)/)
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save7 = self.pos
- _tmp = apply(:_Spacechar)
- self.pos = _save7
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ self.pos = _save4
unless _tmp
- self.pos = _save5
+ self.pos = _save3
end
break
end # end sequence
@@ -9909,13 +9758,13 @@ class RDoc::Markdown
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save4
+ self.pos = _save2
break
end
@result = begin; text ; end
_tmp = true
unless _tmp
- self.pos = _save4
+ self.pos = _save2
end
break
end # end sequence
@@ -9929,7 +9778,7 @@ class RDoc::Markdown
return _tmp
end
- # UlLine = (< "____" "_"* > { text } | < Spacechar "_"+ &Spacechar > { text })
+ # UlLine = (< /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text })
def _UlLine
_save = self.pos
@@ -9938,25 +9787,7 @@ class RDoc::Markdown
_save1 = self.pos
while true # sequence
_text_start = self.pos
-
- _save2 = self.pos
- while true # sequence
- _tmp = match_string("____")
- unless _tmp
- self.pos = _save2
- break
- end
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save2
- end
- break
- end # end sequence
-
+ _tmp = scan(/\A(?-mix:_{4,})/)
if _tmp
text = get_text(_text_start)
end
@@ -9975,37 +9806,27 @@ class RDoc::Markdown
break if _tmp
self.pos = _save
- _save4 = self.pos
+ _save2 = self.pos
while true # sequence
_text_start = self.pos
- _save5 = self.pos
+ _save3 = self.pos
while true # sequence
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save6 = self.pos
- _tmp = match_string("_")
- if _tmp
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save6
- end
+ _tmp = scan(/\A(?-mix:_+)/)
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save7 = self.pos
- _tmp = apply(:_Spacechar)
- self.pos = _save7
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ self.pos = _save4
unless _tmp
- self.pos = _save5
+ self.pos = _save3
end
break
end # end sequence
@@ -10014,13 +9835,13 @@ class RDoc::Markdown
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save4
+ self.pos = _save2
break
end
@result = begin; text ; end
_tmp = true
unless _tmp
- self.pos = _save4
+ self.pos = _save2
end
break
end # end sequence
@@ -10052,7 +9873,7 @@ class RDoc::Markdown
return _tmp
end
- # OneStarOpen = !StarLine "*" !Spacechar !Newline
+ # OneStarOpen = !StarLine "*" !@Spacechar !@Newline
def _OneStarOpen
_save = self.pos
@@ -10071,7 +9892,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10079,7 +9900,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10092,13 +9913,13 @@ class RDoc::Markdown
return _tmp
end
- # OneStarClose = !Spacechar !Newline Inline:a "*" { a }
+ # OneStarClose = !@Spacechar !@Newline Inline:a "*" { a }
def _OneStarClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10106,7 +9927,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10136,7 +9957,7 @@ class RDoc::Markdown
return _tmp
end
- # EmphStar = OneStarOpen StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }
+ # EmphStar = OneStarOpen @StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }
def _EmphStar
_save = self.pos
@@ -10146,7 +9967,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10209,7 +10030,7 @@ class RDoc::Markdown
return _tmp
end
- # OneUlOpen = !UlLine "_" !Spacechar !Newline
+ # OneUlOpen = !UlLine "_" !@Spacechar !@Newline
def _OneUlOpen
_save = self.pos
@@ -10228,7 +10049,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10236,7 +10057,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10249,13 +10070,13 @@ class RDoc::Markdown
return _tmp
end
- # OneUlClose = !Spacechar !Newline Inline:a "_" { a }
+ # OneUlClose = !@Spacechar !@Newline Inline:a "_" { a }
def _OneUlClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10263,7 +10084,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10293,7 +10114,7 @@ class RDoc::Markdown
return _tmp
end
- # EmphUl = OneUlOpen StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }
+ # EmphUl = OneUlOpen @StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }
def _EmphUl
_save = self.pos
@@ -10303,7 +10124,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10384,7 +10205,7 @@ class RDoc::Markdown
return _tmp
end
- # TwoStarOpen = !StarLine "**" !Spacechar !Newline
+ # TwoStarOpen = !StarLine "**" !@Spacechar !@Newline
def _TwoStarOpen
_save = self.pos
@@ -10403,7 +10224,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10411,7 +10232,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10424,13 +10245,13 @@ class RDoc::Markdown
return _tmp
end
- # TwoStarClose = !Spacechar !Newline Inline:a "**" { a }
+ # TwoStarClose = !@Spacechar !@Newline Inline:a "**" { a }
def _TwoStarClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10438,7 +10259,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10468,7 +10289,7 @@ class RDoc::Markdown
return _tmp
end
- # StrongStar = TwoStarOpen StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }
+ # StrongStar = TwoStarOpen @StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }
def _StrongStar
_save = self.pos
@@ -10478,7 +10299,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10541,7 +10362,7 @@ class RDoc::Markdown
return _tmp
end
- # TwoUlOpen = !UlLine "__" !Spacechar !Newline
+ # TwoUlOpen = !UlLine "__" !@Spacechar !@Newline
def _TwoUlOpen
_save = self.pos
@@ -10560,7 +10381,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10568,7 +10389,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10581,13 +10402,13 @@ class RDoc::Markdown
return _tmp
end
- # TwoUlClose = !Spacechar !Newline Inline:a "__" { a }
+ # TwoUlClose = !@Spacechar !@Newline Inline:a "__" { a }
def _TwoUlClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10595,7 +10416,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10625,7 +10446,7 @@ class RDoc::Markdown
return _tmp
end
- # StrongUl = TwoUlOpen StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }
+ # StrongUl = TwoUlOpen @StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }
def _StrongUl
_save = self.pos
@@ -10635,7 +10456,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10698,7 +10519,7 @@ class RDoc::Markdown
return _tmp
end
- # Image = "!" (ExplicitLink | ReferenceLink):a { a }
+ # Image = "!" (ExplicitLink | ReferenceLink):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
def _Image
_save = self.pos
@@ -10725,7 +10546,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- @result = begin; a ; end
+ @result = begin; "rdoc-image:#{a[/\[(.*)\]/, 1]}" ; end
_tmp = true
unless _tmp
self.pos = _save
@@ -10873,7 +10694,7 @@ class RDoc::Markdown
return _tmp
end
- # ExplicitLink = Label:l Spnl "(" Sp Source:s Spnl Title Sp ")" { "{#{l}}[#{s}]" }
+ # ExplicitLink = Label:l Spnl "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" }
def _ExplicitLink
_save = self.pos
@@ -10894,7 +10715,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
@@ -10915,7 +10736,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
@@ -11162,7 +10983,7 @@ class RDoc::Markdown
return _tmp
end
- # TitleSingle = "'" (!("'" Sp (")" | Newline)) .)* "'"
+ # TitleSingle = "'" (!("'" @Sp (")" | @Newline)) .)* "'"
def _TitleSingle
_save = self.pos
@@ -11185,7 +11006,7 @@ class RDoc::Markdown
self.pos = _save4
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
break
@@ -11196,7 +11017,7 @@ class RDoc::Markdown
_tmp = match_string(")")
break if _tmp
self.pos = _save5
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save5
break
@@ -11239,7 +11060,7 @@ class RDoc::Markdown
return _tmp
end
- # TitleDouble = "\"" (!("\"" Sp (")" | Newline)) .)* "\""
+ # TitleDouble = "\"" (!("\"" @Sp (")" | @Newline)) .)* "\""
def _TitleDouble
_save = self.pos
@@ -11262,7 +11083,7 @@ class RDoc::Markdown
self.pos = _save4
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
break
@@ -11273,7 +11094,7 @@ class RDoc::Markdown
_tmp = match_string(")")
break if _tmp
self.pos = _save5
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save5
break
@@ -11334,7 +11155,7 @@ class RDoc::Markdown
return _tmp
end
- # AutoLinkUrl = "<" < /[A-Za-z]+/ "://" (!Newline !">" .)+ > ">" { text }
+ # AutoLinkUrl = "<" < /[A-Za-z]+/ "://" (!@Newline !">" .)+ > ">" { text }
def _AutoLinkUrl
_save = self.pos
@@ -11363,7 +11184,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save4
unless _tmp
@@ -11391,7 +11212,7 @@ class RDoc::Markdown
_save6 = self.pos
while true # sequence
_save7 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -11449,7 +11270,7 @@ class RDoc::Markdown
return _tmp
end
- # AutoLinkEmail = "<" "mailto:"? < /[\w+.\/!%~$-]+/i "@" (!Newline !">" .)+ > ">" { "mailto:#{text}" }
+ # AutoLinkEmail = "<" "mailto:"? < /[\w+.\/!%~$-]+/i "@" (!@Newline !">" .)+ > ">" { "mailto:#{text}" }
def _AutoLinkEmail
_save = self.pos
@@ -11488,7 +11309,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -11516,7 +11337,7 @@ class RDoc::Markdown
_save7 = self.pos
while true # sequence
_save8 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save8
unless _tmp
@@ -11574,12 +11395,12 @@ class RDoc::Markdown
return _tmp
end
- # Reference = NonindentSpace !"[]" Label:label ":" Spnl RefSrc:link RefTitle BlankLine+ { # TODO use title reference label, link nil }
+ # Reference = @NonindentSpace !"[]" Label:label ":" Spnl RefSrc:link RefTitle @BlankLine+ { # TODO use title reference label, link nil }
def _Reference
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -11620,10 +11441,10 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -11649,7 +11470,7 @@ class RDoc::Markdown
return _tmp
end
- # Label = "[" (!"^" &{ notes? } | &. &{ !notes? }) StartList:a (!"]" Inline:l { a << l })* "]" { a.join.gsub(/\s+/, ' ') }
+ # Label = "[" (!"^" &{ notes? } | &. &{ !notes? }) @StartList:a (!"]" Inline:l { a << l })* "]" { a.join.gsub(/\s+/, ' ') }
def _Label
_save = self.pos
@@ -11712,7 +11533,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -11835,7 +11656,7 @@ class RDoc::Markdown
return _tmp
end
- # RefTitleSingle = Spnl "'" < (!("'" Sp Newline | Newline) .)* > "'" { text }
+ # RefTitleSingle = Spnl "'" < (!("'" @Sp @Newline | @Newline) .)* > "'" { text }
def _RefTitleSingle
_save = self.pos
@@ -11867,12 +11688,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -11881,7 +11702,7 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save4
break
@@ -11927,7 +11748,7 @@ class RDoc::Markdown
return _tmp
end
- # RefTitleDouble = Spnl "\"" < (!("\"" Sp Newline | Newline) .)* > "\"" { text }
+ # RefTitleDouble = Spnl "\"" < (!("\"" @Sp @Newline | @Newline) .)* > "\"" { text }
def _RefTitleDouble
_save = self.pos
@@ -11959,12 +11780,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -11973,7 +11794,7 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save4
break
@@ -12019,7 +11840,7 @@ class RDoc::Markdown
return _tmp
end
- # RefTitleParens = Spnl "(" < (!(")" Sp Newline | Newline) .)* > ")" { text }
+ # RefTitleParens = Spnl "(" < (!(")" @Sp @Newline | @Newline) .)* > ")" { text }
def _RefTitleParens
_save = self.pos
@@ -12051,12 +11872,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -12065,7 +11886,7 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save4
break
@@ -12253,7 +12074,7 @@ class RDoc::Markdown
return _tmp
end
- # Code = (Ticks1 Sp < ((!"`" Nonspacechar)+ | !Ticks1 "`"+ | !(Sp Ticks1) (Spacechar | Newline !BlankLine))+ > Sp Ticks1 | Ticks2 Sp < ((!"`" Nonspacechar)+ | !Ticks2 "`"+ | !(Sp Ticks2) (Spacechar | Newline !BlankLine))+ > Sp Ticks2 | Ticks3 Sp < ((!"`" Nonspacechar)+ | !Ticks3 "`"+ | !(Sp Ticks3) (Spacechar | Newline !BlankLine))+ > Sp Ticks3 | Ticks4 Sp < ((!"`" Nonspacechar)+ | !Ticks4 "`"+ | !(Sp Ticks4) (Spacechar | Newline !BlankLine))+ > Sp Ticks4 | Ticks5 Sp < ((!"`" Nonspacechar)+ | !Ticks5 "`"+ | !(Sp Ticks5) (Spacechar | Newline !BlankLine))+ > Sp Ticks5) { "<code>#{text}</code>" }
+ # Code = (Ticks1 @Sp < ((!"`" Nonspacechar)+ | !Ticks1 /`+/ | !(@Sp Ticks1) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks1 | Ticks2 @Sp < ((!"`" Nonspacechar)+ | !Ticks2 /`+/ | !(@Sp Ticks2) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks2 | Ticks3 @Sp < ((!"`" Nonspacechar)+ | !Ticks3 /`+/ | !(@Sp Ticks3) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks3 | Ticks4 @Sp < ((!"`" Nonspacechar)+ | !Ticks4 /`+/ | !(@Sp Ticks4) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks4 | Ticks5 @Sp < ((!"`" Nonspacechar)+ | !Ticks5 /`+/ | !(@Sp Ticks5) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks5) { "<code>#{text}</code>" }
def _Code
_save = self.pos
@@ -12269,7 +12090,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -12337,17 +12158,7 @@ class RDoc::Markdown
self.pos = _save10
break
end
- _save12 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save12
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
self.pos = _save10
end
@@ -12357,61 +12168,61 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _save13 = self.pos
+ _save12 = self.pos
while true # sequence
- _save14 = self.pos
+ _save13 = self.pos
- _save15 = self.pos
+ _save14 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save15
+ self.pos = _save14
break
end
_tmp = apply(:_Ticks1)
unless _tmp
- self.pos = _save15
+ self.pos = _save14
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save14
+ self.pos = _save13
unless _tmp
- self.pos = _save13
+ self.pos = _save12
break
end
- _save16 = self.pos
+ _save15 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save16
+ self.pos = _save15
- _save17 = self.pos
+ _save16 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save17
+ self.pos = _save16
break
end
- _save18 = self.pos
- _tmp = apply(:_BlankLine)
+ _save17 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save18
+ self.pos = _save17
unless _tmp
- self.pos = _save17
+ self.pos = _save16
end
break
end # end sequence
break if _tmp
- self.pos = _save16
+ self.pos = _save15
break
end # end choice
unless _tmp
- self.pos = _save13
+ self.pos = _save12
end
break
end # end sequence
@@ -12424,23 +12235,23 @@ class RDoc::Markdown
if _tmp
while true
- _save19 = self.pos
+ _save18 = self.pos
while true # choice
- _save20 = self.pos
+ _save19 = self.pos
- _save21 = self.pos
+ _save20 = self.pos
while true # sequence
- _save22 = self.pos
+ _save21 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save22
+ self.pos = _save21
unless _tmp
- self.pos = _save21
+ self.pos = _save20
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save21
+ self.pos = _save20
end
break
end # end sequence
@@ -12448,19 +12259,19 @@ class RDoc::Markdown
if _tmp
while true
- _save23 = self.pos
+ _save22 = self.pos
while true # sequence
- _save24 = self.pos
+ _save23 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save24
+ self.pos = _save23
unless _tmp
- self.pos = _save23
+ self.pos = _save22
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save23
+ self.pos = _save22
end
break
end # end sequence
@@ -12469,102 +12280,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save20
+ self.pos = _save19
end
break if _tmp
- self.pos = _save19
+ self.pos = _save18
- _save25 = self.pos
+ _save24 = self.pos
while true # sequence
- _save26 = self.pos
+ _save25 = self.pos
_tmp = apply(:_Ticks1)
_tmp = _tmp ? nil : true
- self.pos = _save26
+ self.pos = _save25
unless _tmp
- self.pos = _save25
+ self.pos = _save24
break
end
- _save27 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save27
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save25
+ self.pos = _save24
end
break
end # end sequence
break if _tmp
- self.pos = _save19
+ self.pos = _save18
- _save28 = self.pos
+ _save26 = self.pos
while true # sequence
- _save29 = self.pos
+ _save27 = self.pos
- _save30 = self.pos
+ _save28 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save30
+ self.pos = _save28
break
end
_tmp = apply(:_Ticks1)
unless _tmp
- self.pos = _save30
+ self.pos = _save28
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save29
+ self.pos = _save27
unless _tmp
- self.pos = _save28
+ self.pos = _save26
break
end
- _save31 = self.pos
+ _save29 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save31
+ self.pos = _save29
- _save32 = self.pos
+ _save30 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save32
+ self.pos = _save30
break
end
- _save33 = self.pos
- _tmp = apply(:_BlankLine)
+ _save31 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save33
+ self.pos = _save31
unless _tmp
- self.pos = _save32
+ self.pos = _save30
end
break
end # end sequence
break if _tmp
- self.pos = _save31
+ self.pos = _save29
break
end # end choice
unless _tmp
- self.pos = _save28
+ self.pos = _save26
end
break
end # end sequence
break if _tmp
- self.pos = _save19
+ self.pos = _save18
break
end # end choice
@@ -12581,7 +12382,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -12596,38 +12397,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save34 = self.pos
+ _save32 = self.pos
while true # sequence
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
_text_start = self.pos
- _save35 = self.pos
+ _save33 = self.pos
- _save36 = self.pos
+ _save34 = self.pos
while true # choice
- _save37 = self.pos
+ _save35 = self.pos
- _save38 = self.pos
+ _save36 = self.pos
while true # sequence
- _save39 = self.pos
+ _save37 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save39
+ self.pos = _save37
unless _tmp
- self.pos = _save38
+ self.pos = _save36
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save38
+ self.pos = _save36
end
break
end # end sequence
@@ -12635,19 +12436,19 @@ class RDoc::Markdown
if _tmp
while true
- _save40 = self.pos
+ _save38 = self.pos
while true # sequence
- _save41 = self.pos
+ _save39 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save41
+ self.pos = _save39
unless _tmp
- self.pos = _save40
+ self.pos = _save38
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save40
+ self.pos = _save38
end
break
end # end sequence
@@ -12656,125 +12457,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save37
+ self.pos = _save35
end
break if _tmp
- self.pos = _save36
+ self.pos = _save34
- _save42 = self.pos
+ _save40 = self.pos
while true # sequence
- _save43 = self.pos
+ _save41 = self.pos
_tmp = apply(:_Ticks2)
_tmp = _tmp ? nil : true
- self.pos = _save43
+ self.pos = _save41
unless _tmp
- self.pos = _save42
+ self.pos = _save40
break
end
- _save44 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save44
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save42
+ self.pos = _save40
end
break
end # end sequence
break if _tmp
- self.pos = _save36
+ self.pos = _save34
- _save45 = self.pos
+ _save42 = self.pos
while true # sequence
- _save46 = self.pos
+ _save43 = self.pos
- _save47 = self.pos
+ _save44 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save47
+ self.pos = _save44
break
end
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save47
+ self.pos = _save44
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save46
+ self.pos = _save43
unless _tmp
- self.pos = _save45
+ self.pos = _save42
break
end
- _save48 = self.pos
+ _save45 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save48
+ self.pos = _save45
- _save49 = self.pos
+ _save46 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save49
+ self.pos = _save46
break
end
- _save50 = self.pos
- _tmp = apply(:_BlankLine)
+ _save47 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save50
+ self.pos = _save47
unless _tmp
- self.pos = _save49
+ self.pos = _save46
end
break
end # end sequence
break if _tmp
- self.pos = _save48
+ self.pos = _save45
break
end # end choice
unless _tmp
- self.pos = _save45
+ self.pos = _save42
end
break
end # end sequence
break if _tmp
- self.pos = _save36
+ self.pos = _save34
break
end # end choice
if _tmp
while true
- _save51 = self.pos
+ _save48 = self.pos
while true # choice
- _save52 = self.pos
+ _save49 = self.pos
- _save53 = self.pos
+ _save50 = self.pos
while true # sequence
- _save54 = self.pos
+ _save51 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save54
+ self.pos = _save51
unless _tmp
- self.pos = _save53
+ self.pos = _save50
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save53
+ self.pos = _save50
end
break
end # end sequence
@@ -12782,19 +12573,19 @@ class RDoc::Markdown
if _tmp
while true
- _save55 = self.pos
+ _save52 = self.pos
while true # sequence
- _save56 = self.pos
+ _save53 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save56
+ self.pos = _save53
unless _tmp
- self.pos = _save55
+ self.pos = _save52
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save55
+ self.pos = _save52
end
break
end # end sequence
@@ -12803,102 +12594,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save52
+ self.pos = _save49
end
break if _tmp
- self.pos = _save51
+ self.pos = _save48
- _save57 = self.pos
+ _save54 = self.pos
while true # sequence
- _save58 = self.pos
+ _save55 = self.pos
_tmp = apply(:_Ticks2)
_tmp = _tmp ? nil : true
- self.pos = _save58
+ self.pos = _save55
unless _tmp
- self.pos = _save57
+ self.pos = _save54
break
end
- _save59 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save59
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save57
+ self.pos = _save54
end
break
end # end sequence
break if _tmp
- self.pos = _save51
+ self.pos = _save48
- _save60 = self.pos
+ _save56 = self.pos
while true # sequence
- _save61 = self.pos
+ _save57 = self.pos
- _save62 = self.pos
+ _save58 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save62
+ self.pos = _save58
break
end
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save62
+ self.pos = _save58
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save61
+ self.pos = _save57
unless _tmp
- self.pos = _save60
+ self.pos = _save56
break
end
- _save63 = self.pos
+ _save59 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save63
+ self.pos = _save59
- _save64 = self.pos
+ _save60 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save64
+ self.pos = _save60
break
end
- _save65 = self.pos
- _tmp = apply(:_BlankLine)
+ _save61 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save65
+ self.pos = _save61
unless _tmp
- self.pos = _save64
+ self.pos = _save60
end
break
end # end sequence
break if _tmp
- self.pos = _save63
+ self.pos = _save59
break
end # end choice
unless _tmp
- self.pos = _save60
+ self.pos = _save56
end
break
end # end sequence
break if _tmp
- self.pos = _save51
+ self.pos = _save48
break
end # end choice
@@ -12906,23 +12687,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save35
+ self.pos = _save33
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save34
+ self.pos = _save32
end
break
end # end sequence
@@ -12930,38 +12711,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save66 = self.pos
+ _save62 = self.pos
while true # sequence
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
_text_start = self.pos
- _save67 = self.pos
+ _save63 = self.pos
- _save68 = self.pos
+ _save64 = self.pos
while true # choice
- _save69 = self.pos
+ _save65 = self.pos
- _save70 = self.pos
+ _save66 = self.pos
while true # sequence
- _save71 = self.pos
+ _save67 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save71
+ self.pos = _save67
unless _tmp
- self.pos = _save70
+ self.pos = _save66
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save70
+ self.pos = _save66
end
break
end # end sequence
@@ -12969,19 +12750,19 @@ class RDoc::Markdown
if _tmp
while true
- _save72 = self.pos
+ _save68 = self.pos
while true # sequence
- _save73 = self.pos
+ _save69 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save73
+ self.pos = _save69
unless _tmp
- self.pos = _save72
+ self.pos = _save68
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save72
+ self.pos = _save68
end
break
end # end sequence
@@ -12990,125 +12771,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save69
+ self.pos = _save65
end
break if _tmp
- self.pos = _save68
+ self.pos = _save64
- _save74 = self.pos
+ _save70 = self.pos
while true # sequence
- _save75 = self.pos
+ _save71 = self.pos
_tmp = apply(:_Ticks3)
_tmp = _tmp ? nil : true
- self.pos = _save75
+ self.pos = _save71
unless _tmp
- self.pos = _save74
+ self.pos = _save70
break
end
- _save76 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save76
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save74
+ self.pos = _save70
end
break
end # end sequence
break if _tmp
- self.pos = _save68
+ self.pos = _save64
- _save77 = self.pos
+ _save72 = self.pos
while true # sequence
- _save78 = self.pos
+ _save73 = self.pos
- _save79 = self.pos
+ _save74 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save79
+ self.pos = _save74
break
end
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save79
+ self.pos = _save74
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save78
+ self.pos = _save73
unless _tmp
- self.pos = _save77
+ self.pos = _save72
break
end
- _save80 = self.pos
+ _save75 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save80
+ self.pos = _save75
- _save81 = self.pos
+ _save76 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save81
+ self.pos = _save76
break
end
- _save82 = self.pos
- _tmp = apply(:_BlankLine)
+ _save77 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save82
+ self.pos = _save77
unless _tmp
- self.pos = _save81
+ self.pos = _save76
end
break
end # end sequence
break if _tmp
- self.pos = _save80
+ self.pos = _save75
break
end # end choice
unless _tmp
- self.pos = _save77
+ self.pos = _save72
end
break
end # end sequence
break if _tmp
- self.pos = _save68
+ self.pos = _save64
break
end # end choice
if _tmp
while true
- _save83 = self.pos
+ _save78 = self.pos
while true # choice
- _save84 = self.pos
+ _save79 = self.pos
- _save85 = self.pos
+ _save80 = self.pos
while true # sequence
- _save86 = self.pos
+ _save81 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save86
+ self.pos = _save81
unless _tmp
- self.pos = _save85
+ self.pos = _save80
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save85
+ self.pos = _save80
end
break
end # end sequence
@@ -13116,19 +12887,19 @@ class RDoc::Markdown
if _tmp
while true
- _save87 = self.pos
+ _save82 = self.pos
while true # sequence
- _save88 = self.pos
+ _save83 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save88
+ self.pos = _save83
unless _tmp
- self.pos = _save87
+ self.pos = _save82
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save87
+ self.pos = _save82
end
break
end # end sequence
@@ -13137,102 +12908,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save84
+ self.pos = _save79
end
break if _tmp
- self.pos = _save83
+ self.pos = _save78
- _save89 = self.pos
+ _save84 = self.pos
while true # sequence
- _save90 = self.pos
+ _save85 = self.pos
_tmp = apply(:_Ticks3)
_tmp = _tmp ? nil : true
- self.pos = _save90
+ self.pos = _save85
unless _tmp
- self.pos = _save89
+ self.pos = _save84
break
end
- _save91 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save91
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save89
+ self.pos = _save84
end
break
end # end sequence
break if _tmp
- self.pos = _save83
+ self.pos = _save78
- _save92 = self.pos
+ _save86 = self.pos
while true # sequence
- _save93 = self.pos
+ _save87 = self.pos
- _save94 = self.pos
+ _save88 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save94
+ self.pos = _save88
break
end
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save94
+ self.pos = _save88
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save93
+ self.pos = _save87
unless _tmp
- self.pos = _save92
+ self.pos = _save86
break
end
- _save95 = self.pos
+ _save89 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save95
+ self.pos = _save89
- _save96 = self.pos
+ _save90 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save96
+ self.pos = _save90
break
end
- _save97 = self.pos
- _tmp = apply(:_BlankLine)
+ _save91 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save97
+ self.pos = _save91
unless _tmp
- self.pos = _save96
+ self.pos = _save90
end
break
end # end sequence
break if _tmp
- self.pos = _save95
+ self.pos = _save89
break
end # end choice
unless _tmp
- self.pos = _save92
+ self.pos = _save86
end
break
end # end sequence
break if _tmp
- self.pos = _save83
+ self.pos = _save78
break
end # end choice
@@ -13240,23 +13001,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save67
+ self.pos = _save63
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save66
+ self.pos = _save62
end
break
end # end sequence
@@ -13264,38 +13025,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save98 = self.pos
+ _save92 = self.pos
while true # sequence
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
_text_start = self.pos
- _save99 = self.pos
+ _save93 = self.pos
- _save100 = self.pos
+ _save94 = self.pos
while true # choice
- _save101 = self.pos
+ _save95 = self.pos
- _save102 = self.pos
+ _save96 = self.pos
while true # sequence
- _save103 = self.pos
+ _save97 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save103
+ self.pos = _save97
unless _tmp
- self.pos = _save102
+ self.pos = _save96
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save102
+ self.pos = _save96
end
break
end # end sequence
@@ -13303,19 +13064,19 @@ class RDoc::Markdown
if _tmp
while true
- _save104 = self.pos
+ _save98 = self.pos
while true # sequence
- _save105 = self.pos
+ _save99 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save105
+ self.pos = _save99
unless _tmp
- self.pos = _save104
+ self.pos = _save98
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save104
+ self.pos = _save98
end
break
end # end sequence
@@ -13324,125 +13085,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save101
+ self.pos = _save95
end
break if _tmp
- self.pos = _save100
+ self.pos = _save94
- _save106 = self.pos
+ _save100 = self.pos
while true # sequence
- _save107 = self.pos
+ _save101 = self.pos
_tmp = apply(:_Ticks4)
_tmp = _tmp ? nil : true
- self.pos = _save107
+ self.pos = _save101
unless _tmp
- self.pos = _save106
+ self.pos = _save100
break
end
- _save108 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save108
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save106
+ self.pos = _save100
end
break
end # end sequence
break if _tmp
- self.pos = _save100
+ self.pos = _save94
- _save109 = self.pos
+ _save102 = self.pos
while true # sequence
- _save110 = self.pos
+ _save103 = self.pos
- _save111 = self.pos
+ _save104 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save111
+ self.pos = _save104
break
end
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save111
+ self.pos = _save104
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save110
+ self.pos = _save103
unless _tmp
- self.pos = _save109
+ self.pos = _save102
break
end
- _save112 = self.pos
+ _save105 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save112
+ self.pos = _save105
- _save113 = self.pos
+ _save106 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save113
+ self.pos = _save106
break
end
- _save114 = self.pos
- _tmp = apply(:_BlankLine)
+ _save107 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save114
+ self.pos = _save107
unless _tmp
- self.pos = _save113
+ self.pos = _save106
end
break
end # end sequence
break if _tmp
- self.pos = _save112
+ self.pos = _save105
break
end # end choice
unless _tmp
- self.pos = _save109
+ self.pos = _save102
end
break
end # end sequence
break if _tmp
- self.pos = _save100
+ self.pos = _save94
break
end # end choice
if _tmp
while true
- _save115 = self.pos
+ _save108 = self.pos
while true # choice
- _save116 = self.pos
+ _save109 = self.pos
- _save117 = self.pos
+ _save110 = self.pos
while true # sequence
- _save118 = self.pos
+ _save111 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save118
+ self.pos = _save111
unless _tmp
- self.pos = _save117
+ self.pos = _save110
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save117
+ self.pos = _save110
end
break
end # end sequence
@@ -13450,19 +13201,19 @@ class RDoc::Markdown
if _tmp
while true
- _save119 = self.pos
+ _save112 = self.pos
while true # sequence
- _save120 = self.pos
+ _save113 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save120
+ self.pos = _save113
unless _tmp
- self.pos = _save119
+ self.pos = _save112
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save119
+ self.pos = _save112
end
break
end # end sequence
@@ -13471,102 +13222,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save116
+ self.pos = _save109
end
break if _tmp
- self.pos = _save115
+ self.pos = _save108
- _save121 = self.pos
+ _save114 = self.pos
while true # sequence
- _save122 = self.pos
+ _save115 = self.pos
_tmp = apply(:_Ticks4)
_tmp = _tmp ? nil : true
- self.pos = _save122
+ self.pos = _save115
unless _tmp
- self.pos = _save121
+ self.pos = _save114
break
end
- _save123 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save123
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save121
+ self.pos = _save114
end
break
end # end sequence
break if _tmp
- self.pos = _save115
+ self.pos = _save108
- _save124 = self.pos
+ _save116 = self.pos
while true # sequence
- _save125 = self.pos
+ _save117 = self.pos
- _save126 = self.pos
+ _save118 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save126
+ self.pos = _save118
break
end
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save126
+ self.pos = _save118
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save125
+ self.pos = _save117
unless _tmp
- self.pos = _save124
+ self.pos = _save116
break
end
- _save127 = self.pos
+ _save119 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save127
+ self.pos = _save119
- _save128 = self.pos
+ _save120 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save128
+ self.pos = _save120
break
end
- _save129 = self.pos
- _tmp = apply(:_BlankLine)
+ _save121 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save129
+ self.pos = _save121
unless _tmp
- self.pos = _save128
+ self.pos = _save120
end
break
end # end sequence
break if _tmp
- self.pos = _save127
+ self.pos = _save119
break
end # end choice
unless _tmp
- self.pos = _save124
+ self.pos = _save116
end
break
end # end sequence
break if _tmp
- self.pos = _save115
+ self.pos = _save108
break
end # end choice
@@ -13574,23 +13315,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save99
+ self.pos = _save93
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save98
+ self.pos = _save92
end
break
end # end sequence
@@ -13598,38 +13339,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save130 = self.pos
+ _save122 = self.pos
while true # sequence
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
_text_start = self.pos
- _save131 = self.pos
+ _save123 = self.pos
- _save132 = self.pos
+ _save124 = self.pos
while true # choice
- _save133 = self.pos
+ _save125 = self.pos
- _save134 = self.pos
+ _save126 = self.pos
while true # sequence
- _save135 = self.pos
+ _save127 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save135
+ self.pos = _save127
unless _tmp
- self.pos = _save134
+ self.pos = _save126
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save134
+ self.pos = _save126
end
break
end # end sequence
@@ -13637,19 +13378,19 @@ class RDoc::Markdown
if _tmp
while true
- _save136 = self.pos
+ _save128 = self.pos
while true # sequence
- _save137 = self.pos
+ _save129 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save137
+ self.pos = _save129
unless _tmp
- self.pos = _save136
+ self.pos = _save128
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save136
+ self.pos = _save128
end
break
end # end sequence
@@ -13658,125 +13399,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save133
+ self.pos = _save125
end
break if _tmp
- self.pos = _save132
+ self.pos = _save124
- _save138 = self.pos
+ _save130 = self.pos
while true # sequence
- _save139 = self.pos
+ _save131 = self.pos
_tmp = apply(:_Ticks5)
_tmp = _tmp ? nil : true
- self.pos = _save139
+ self.pos = _save131
unless _tmp
- self.pos = _save138
+ self.pos = _save130
break
end
- _save140 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save140
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save138
+ self.pos = _save130
end
break
end # end sequence
break if _tmp
- self.pos = _save132
+ self.pos = _save124
- _save141 = self.pos
+ _save132 = self.pos
while true # sequence
- _save142 = self.pos
+ _save133 = self.pos
- _save143 = self.pos
+ _save134 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save143
+ self.pos = _save134
break
end
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save143
+ self.pos = _save134
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save142
+ self.pos = _save133
unless _tmp
- self.pos = _save141
+ self.pos = _save132
break
end
- _save144 = self.pos
+ _save135 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save144
+ self.pos = _save135
- _save145 = self.pos
+ _save136 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save145
+ self.pos = _save136
break
end
- _save146 = self.pos
- _tmp = apply(:_BlankLine)
+ _save137 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save146
+ self.pos = _save137
unless _tmp
- self.pos = _save145
+ self.pos = _save136
end
break
end # end sequence
break if _tmp
- self.pos = _save144
+ self.pos = _save135
break
end # end choice
unless _tmp
- self.pos = _save141
+ self.pos = _save132
end
break
end # end sequence
break if _tmp
- self.pos = _save132
+ self.pos = _save124
break
end # end choice
if _tmp
while true
- _save147 = self.pos
+ _save138 = self.pos
while true # choice
- _save148 = self.pos
+ _save139 = self.pos
- _save149 = self.pos
+ _save140 = self.pos
while true # sequence
- _save150 = self.pos
+ _save141 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save150
+ self.pos = _save141
unless _tmp
- self.pos = _save149
+ self.pos = _save140
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save149
+ self.pos = _save140
end
break
end # end sequence
@@ -13784,19 +13515,19 @@ class RDoc::Markdown
if _tmp
while true
- _save151 = self.pos
+ _save142 = self.pos
while true # sequence
- _save152 = self.pos
+ _save143 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save152
+ self.pos = _save143
unless _tmp
- self.pos = _save151
+ self.pos = _save142
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save151
+ self.pos = _save142
end
break
end # end sequence
@@ -13805,102 +13536,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save148
+ self.pos = _save139
end
break if _tmp
- self.pos = _save147
+ self.pos = _save138
- _save153 = self.pos
+ _save144 = self.pos
while true # sequence
- _save154 = self.pos
+ _save145 = self.pos
_tmp = apply(:_Ticks5)
_tmp = _tmp ? nil : true
- self.pos = _save154
+ self.pos = _save145
unless _tmp
- self.pos = _save153
+ self.pos = _save144
break
end
- _save155 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save155
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save153
+ self.pos = _save144
end
break
end # end sequence
break if _tmp
- self.pos = _save147
+ self.pos = _save138
- _save156 = self.pos
+ _save146 = self.pos
while true # sequence
- _save157 = self.pos
+ _save147 = self.pos
- _save158 = self.pos
+ _save148 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save158
+ self.pos = _save148
break
end
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save158
+ self.pos = _save148
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save157
+ self.pos = _save147
unless _tmp
- self.pos = _save156
+ self.pos = _save146
break
end
- _save159 = self.pos
+ _save149 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save159
+ self.pos = _save149
- _save160 = self.pos
+ _save150 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save160
+ self.pos = _save150
break
end
- _save161 = self.pos
- _tmp = apply(:_BlankLine)
+ _save151 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save161
+ self.pos = _save151
unless _tmp
- self.pos = _save160
+ self.pos = _save150
end
break
end # end sequence
break if _tmp
- self.pos = _save159
+ self.pos = _save149
break
end # end choice
unless _tmp
- self.pos = _save156
+ self.pos = _save146
end
break
end # end sequence
break if _tmp
- self.pos = _save147
+ self.pos = _save138
break
end # end choice
@@ -13908,23 +13629,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save131
+ self.pos = _save123
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save130
+ self.pos = _save122
end
break
end # end sequence
@@ -13990,17 +13711,17 @@ class RDoc::Markdown
return _tmp
end
- # BlankLine = Sp Newline { "\n" }
+ # BlankLine = @Sp @Newline { "\n" }
def _BlankLine
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -14394,13 +14115,13 @@ class RDoc::Markdown
return _tmp
end
- # Nonspacechar = !Spacechar !Newline .
+ # Nonspacechar = !@Spacechar !@Newline .
def _Nonspacechar
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -14408,7 +14129,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -14426,10 +14147,10 @@ class RDoc::Markdown
return _tmp
end
- # Sp = Spacechar*
+ # Sp = @Spacechar*
def _Sp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
@@ -14437,12 +14158,12 @@ class RDoc::Markdown
return _tmp
end
- # Spnl = Sp (Newline Sp)?
+ # Spnl = @Sp (@Newline @Sp)?
def _Spnl
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
@@ -14451,12 +14172,12 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
end
@@ -14477,54 +14198,15 @@ class RDoc::Markdown
return _tmp
end
- # SpecialChar = ("*" | "_" | "`" | "&" | "[" | "]" | "(" | ")" | "<" | "!" | "#" | "\\" | "'" | "\"" | ExtendedSpecialChar)
+ # SpecialChar = (/[*_`&\[\]()<!#\\'"]/ | @ExtendedSpecialChar)
def _SpecialChar
_save = self.pos
while true # choice
- _tmp = match_string("*")
- break if _tmp
- self.pos = _save
- _tmp = match_string("_")
- break if _tmp
- self.pos = _save
- _tmp = match_string("`")
+ _tmp = scan(/\A(?-mix:[*_`&\[\]()<!#\\'"])/)
break if _tmp
self.pos = _save
- _tmp = match_string("&")
- break if _tmp
- self.pos = _save
- _tmp = match_string("[")
- break if _tmp
- self.pos = _save
- _tmp = match_string("]")
- break if _tmp
- self.pos = _save
- _tmp = match_string("(")
- break if _tmp
- self.pos = _save
- _tmp = match_string(")")
- break if _tmp
- self.pos = _save
- _tmp = match_string("<")
- break if _tmp
- self.pos = _save
- _tmp = match_string("!")
- break if _tmp
- self.pos = _save
- _tmp = match_string("#")
- break if _tmp
- self.pos = _save
- _tmp = match_string("\\")
- break if _tmp
- self.pos = _save
- _tmp = match_string("'")
- break if _tmp
- self.pos = _save
- _tmp = match_string("\"")
- break if _tmp
- self.pos = _save
- _tmp = apply(:_ExtendedSpecialChar)
+ _tmp = _ExtendedSpecialChar()
break if _tmp
self.pos = _save
break
@@ -14534,7 +14216,7 @@ class RDoc::Markdown
return _tmp
end
- # NormalChar = !(SpecialChar | Spacechar | Newline) .
+ # NormalChar = !(@SpecialChar | @Spacechar | @Newline) .
def _NormalChar
_save = self.pos
@@ -14543,13 +14225,13 @@ class RDoc::Markdown
_save2 = self.pos
while true # choice
- _tmp = apply(:_SpecialChar)
+ _tmp = _SpecialChar()
break if _tmp
self.pos = _save2
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
self.pos = _save2
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save2
break
@@ -14628,22 +14310,12 @@ class RDoc::Markdown
return _tmp
end
- # HexEntity = "&" "#" /[Xx]/ < /[0-9a-fA-F]+/ > ";" { [text.to_i(16)].pack 'U' }
+ # HexEntity = /&#x/i < /[0-9a-fA-F]+/ > ";" { [text.to_i(16)].pack 'U' }
def _HexEntity
_save = self.pos
while true # sequence
- _tmp = match_string("&")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string("#")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = scan(/\A(?-mix:[Xx])/)
+ _tmp = scan(/\A(?i-mx:&#x)/)
unless _tmp
self.pos = _save
break
@@ -14674,17 +14346,12 @@ class RDoc::Markdown
return _tmp
end
- # DecEntity = "&" "#" < /[0-9]+/ > ";" { [text.to_i].pack 'U' }
+ # DecEntity = "&#" < /[0-9]+/ > ";" { [text.to_i].pack 'U' }
def _DecEntity
_save = self.pos
while true # sequence
- _tmp = match_string("&")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string("#")
+ _tmp = match_string("&#")
unless _tmp
self.pos = _save
break
@@ -14756,44 +14423,16 @@ class RDoc::Markdown
return _tmp
end
- # NonindentSpace = (" " | " " | " " | "")
+ # NonindentSpace = / {0,3}/
def _NonindentSpace
-
- _save = self.pos
- while true # choice
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- _tmp = match_string("")
- break if _tmp
- self.pos = _save
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix: {0,3})/)
set_failed_rule :_NonindentSpace unless _tmp
return _tmp
end
- # Indent = ("\t" | " ")
+ # Indent = /\t| /
def _Indent
-
- _save = self.pos
- while true # choice
- _tmp = match_string("\t")
- break if _tmp
- self.pos = _save
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix:\t| )/)
set_failed_rule :_Indent unless _tmp
return _tmp
end
@@ -14869,12 +14508,12 @@ class RDoc::Markdown
return _tmp
end
- # Line = RawLine:a { a }
+ # Line = @RawLine:a { a }
def _Line
_save = self.pos
while true # sequence
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
a = @result
unless _tmp
self.pos = _save
@@ -14892,7 +14531,7 @@ class RDoc::Markdown
return _tmp
end
- # RawLine = (< (!"\r" !"\n" .)* Newline > | < .+ > Eof) { text }
+ # RawLine = (< (!"\r" !"\n" .)* @Newline > | < .+ > @Eof) { text }
def _RawLine
_save = self.pos
@@ -14938,7 +14577,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save2
end
@@ -14972,7 +14611,7 @@ class RDoc::Markdown
self.pos = _save7
break
end
- _tmp = apply(:_Eof)
+ _tmp = _Eof()
unless _tmp
self.pos = _save7
end
@@ -15000,7 +14639,7 @@ class RDoc::Markdown
return _tmp
end
- # SkipBlock = (HtmlBlock | (!"#" !SetextBottom1 !SetextBottom2 !BlankLine RawLine)+ BlankLine* | BlankLine+ | RawLine)
+ # SkipBlock = (HtmlBlock | (!"#" !SetextBottom1 !SetextBottom2 !@BlankLine @RawLine)+ @BlankLine* | @BlankLine+ | @RawLine)
def _SkipBlock
_save = self.pos
@@ -15040,14 +14679,14 @@ class RDoc::Markdown
break
end
_save7 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
self.pos = _save3
break
end
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save3
end
@@ -15084,14 +14723,14 @@ class RDoc::Markdown
break
end
_save12 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save12
unless _tmp
self.pos = _save8
break
end
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save8
end
@@ -15109,7 +14748,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -15122,10 +14761,10 @@ class RDoc::Markdown
break if _tmp
self.pos = _save
_save14 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -15134,7 +14773,7 @@ class RDoc::Markdown
end
break if _tmp
self.pos = _save
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
break if _tmp
self.pos = _save
break
@@ -15197,7 +14836,7 @@ class RDoc::Markdown
return _tmp
end
- # RawNoteReference = "[^" < (!Newline !"]" .)+ > "]" { text }
+ # RawNoteReference = "[^" < (!@Newline !"]" .)+ > "]" { text }
def _RawNoteReference
_save = self.pos
@@ -15213,7 +14852,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -15241,7 +14880,7 @@ class RDoc::Markdown
_save5 = self.pos
while true # sequence
_save6 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save6
unless _tmp
@@ -15293,7 +14932,7 @@ class RDoc::Markdown
return _tmp
end
- # Note = &{ notes? } NonindentSpace RawNoteReference:ref ":" Sp StartList:a RawNoteBlock (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }
+ # Note = &{ notes? } @NonindentSpace RawNoteReference:ref ":" @Sp @StartList:a RawNoteBlock:i { a.concat i } (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }
def _Note
_save = self.pos
@@ -15305,7 +14944,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -15321,18 +14960,25 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
break
end
_tmp = apply(:_RawNoteBlock)
+ i = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a.concat i ; end
+ _tmp = true
unless _tmp
self.pos = _save
break
@@ -15384,7 +15030,7 @@ class RDoc::Markdown
return _tmp
end
- # InlineNote = &{ notes? } "^[" StartList:a (!"]" Inline:l { a << l })+ "]" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }
+ # InlineNote = &{ notes? } "^[" @StartList:a (!"]" Inline:l { a << l })+ "]" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }
def _InlineNote
_save = self.pos
@@ -15401,7 +15047,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -15475,7 +15121,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- @result = begin;
+ @result = begin;
ref = [:inline, @note_order.length]
@footnotes[ref] = paragraph a
@@ -15514,12 +15160,12 @@ class RDoc::Markdown
return _tmp
end
- # RawNoteBlock = StartList:a (!BlankLine OptionallyIndentedLine:l { a << l })+ < BlankLine* > { a << text } { a }
+ # RawNoteBlock = @StartList:a (!@BlankLine OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }
def _RawNoteBlock
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -15530,7 +15176,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
_save3 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -15557,7 +15203,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -15590,7 +15236,7 @@ class RDoc::Markdown
end
_text_start = self.pos
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -15619,7 +15265,7 @@ class RDoc::Markdown
return _tmp
end
- # CodeFence = &{ github? } Ticks3 (Sp StrChunk:format)? Spnl < ((!"`" Nonspacechar)+ | !Ticks3 "`"+ | Spacechar | Newline)+ > Ticks3 Sp Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }
+ # CodeFence = &{ github? } Ticks3 (@Sp StrChunk:format)? Spnl < ((!"`" Nonspacechar)+ | !Ticks3 /`+/ | Spacechar | @Newline)+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }
def _CodeFence
_save = self.pos
@@ -15640,7 +15286,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save3
break
@@ -15729,17 +15375,7 @@ class RDoc::Markdown
self.pos = _save11
break
end
- _save13 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save13
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
self.pos = _save11
end
@@ -15751,7 +15387,7 @@ class RDoc::Markdown
_tmp = apply(:_Spacechar)
break if _tmp
self.pos = _save5
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save5
break
@@ -15760,23 +15396,23 @@ class RDoc::Markdown
if _tmp
while true
- _save14 = self.pos
+ _save13 = self.pos
while true # choice
- _save15 = self.pos
+ _save14 = self.pos
- _save16 = self.pos
+ _save15 = self.pos
while true # sequence
- _save17 = self.pos
+ _save16 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save17
+ self.pos = _save16
unless _tmp
- self.pos = _save16
+ self.pos = _save15
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save16
+ self.pos = _save15
end
break
end # end sequence
@@ -15784,19 +15420,19 @@ class RDoc::Markdown
if _tmp
while true
- _save18 = self.pos
+ _save17 = self.pos
while true # sequence
- _save19 = self.pos
+ _save18 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save19
+ self.pos = _save18
unless _tmp
- self.pos = _save18
+ self.pos = _save17
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save18
+ self.pos = _save17
end
break
end # end sequence
@@ -15805,46 +15441,36 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save15
+ self.pos = _save14
end
break if _tmp
- self.pos = _save14
+ self.pos = _save13
- _save20 = self.pos
+ _save19 = self.pos
while true # sequence
- _save21 = self.pos
+ _save20 = self.pos
_tmp = apply(:_Ticks3)
_tmp = _tmp ? nil : true
- self.pos = _save21
+ self.pos = _save20
unless _tmp
- self.pos = _save20
+ self.pos = _save19
break
end
- _save22 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save22
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save20
+ self.pos = _save19
end
break
end # end sequence
break if _tmp
- self.pos = _save14
+ self.pos = _save13
_tmp = apply(:_Spacechar)
break if _tmp
- self.pos = _save14
- _tmp = apply(:_Newline)
+ self.pos = _save13
+ _tmp = _Newline()
break if _tmp
- self.pos = _save14
+ self.pos = _save13
break
end # end choice
@@ -15866,13 +15492,13 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
while true
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break unless _tmp
end
_tmp = true
@@ -16005,7 +15631,7 @@ class RDoc::Markdown
return _tmp
end
- # DefinitionListLabel = StrChunk:label Sp Newline { label }
+ # DefinitionListLabel = StrChunk:label @Sp @Newline { label }
def _DefinitionListLabel
_save = self.pos
@@ -16016,12 +15642,12 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -16038,12 +15664,12 @@ class RDoc::Markdown
return _tmp
end
- # DefinitionListDefinition = NonindentSpace ":" Space Inlines:a BlankLine+ { paragraph a }
+ # DefinitionListDefinition = @NonindentSpace ":" @Space Inlines:a @BlankLine+ { paragraph a }
def _DefinitionListDefinition
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -16053,7 +15679,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Space)
+ _tmp = _Space()
unless _tmp
self.pos = _save
break
@@ -16065,10 +15691,10 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -16094,35 +15720,35 @@ class RDoc::Markdown
Rules = {}
Rules[:_root] = rule_info("root", "Doc")
Rules[:_Doc] = rule_info("Doc", "BOM? Block*:a { RDoc::Markup::Document.new(*a.compact) }")
- Rules[:_Block] = rule_info("Block", "BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)")
- Rules[:_Para] = rule_info("Para", "NonindentSpace Inlines:a BlankLine+ { paragraph a }")
+ Rules[:_Block] = rule_info("Block", "@BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)")
+ Rules[:_Para] = rule_info("Para", "@NonindentSpace Inlines:a @BlankLine+ { paragraph a }")
Rules[:_Plain] = rule_info("Plain", "Inlines:a { paragraph a }")
- Rules[:_AtxInline] = rule_info("AtxInline", "!Newline !(Sp? \"\#\"* Sp Newline) Inline")
- Rules[:_AtxStart] = rule_info("AtxStart", "< (\"\#\#\#\#\#\#\" | \"\#\#\#\#\#\" | \"\#\#\#\#\" | \"\#\#\#\" | \"\#\#\" | \"\#\") > { text.length }")
- Rules[:_AtxHeading] = rule_info("AtxHeading", "AtxStart:s Sp? AtxInline+:a (Sp? \"\#\"* Sp)? Newline { RDoc::Markup::Heading.new(s, a.join) }")
+ Rules[:_AtxInline] = rule_info("AtxInline", "!@Newline !(@Sp? /\#*/ @Sp @Newline) Inline")
+ Rules[:_AtxStart] = rule_info("AtxStart", "< /\\\#{1,6}/ > { text.length }")
+ Rules[:_AtxHeading] = rule_info("AtxHeading", "AtxStart:s @Sp? AtxInline+:a (@Sp? /\#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) }")
Rules[:_SetextHeading] = rule_info("SetextHeading", "(SetextHeading1 | SetextHeading2)")
- Rules[:_SetextBottom1] = rule_info("SetextBottom1", "\"===\" \"=\"* Newline")
- Rules[:_SetextBottom2] = rule_info("SetextBottom2", "\"---\" \"-\"* Newline")
- Rules[:_SetextHeading1] = rule_info("SetextHeading1", "&(RawLine SetextBottom1) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }")
- Rules[:_SetextHeading2] = rule_info("SetextHeading2", "&(RawLine SetextBottom2) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }")
+ Rules[:_SetextBottom1] = rule_info("SetextBottom1", "/={3,}/ @Newline")
+ Rules[:_SetextBottom2] = rule_info("SetextBottom2", "/-{3,}/ @Newline")
+ Rules[:_SetextHeading1] = rule_info("SetextHeading1", "&(@RawLine SetextBottom1) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }")
+ Rules[:_SetextHeading2] = rule_info("SetextHeading2", "&(@RawLine SetextBottom2) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }")
Rules[:_Heading] = rule_info("Heading", "(SetextHeading | AtxHeading)")
Rules[:_BlockQuote] = rule_info("BlockQuote", "BlockQuoteRaw:a { RDoc::Markup::BlockQuote.new(*a) }")
- Rules[:_BlockQuoteRaw] = rule_info("BlockQuoteRaw", "StartList:a (\">\" \" \"? Line:l { a << l } (!\">\" !BlankLine Line:c { a << c })* (BlankLine:n { a << n })*)+ { inner_parse a.join }")
- Rules[:_NonblankIndentedLine] = rule_info("NonblankIndentedLine", "!BlankLine IndentedLine")
- Rules[:_VerbatimChunk] = rule_info("VerbatimChunk", "BlankLine*:a NonblankIndentedLine+:b { a.concat b }")
+ Rules[:_BlockQuoteRaw] = rule_info("BlockQuoteRaw", "@StartList:a (\">\" \" \"? Line:l { a << l } (!\">\" !@BlankLine Line:c { a << c })* (@BlankLine:n { a << n })*)+ { inner_parse a.join }")
+ Rules[:_NonblankIndentedLine] = rule_info("NonblankIndentedLine", "!@BlankLine IndentedLine")
+ Rules[:_VerbatimChunk] = rule_info("VerbatimChunk", "@BlankLine*:a NonblankIndentedLine+:b { a.concat b }")
Rules[:_Verbatim] = rule_info("Verbatim", "VerbatimChunk+:a { RDoc::Markup::Verbatim.new(*a.flatten) }")
- Rules[:_HorizontalRule] = rule_info("HorizontalRule", "NonindentSpace (\"*\" Sp \"*\" Sp \"*\" (Sp \"*\")* | \"-\" Sp \"-\" Sp \"-\" (Sp \"-\")* | \"_\" Sp \"_\" Sp \"_\" (Sp \"_\")*) Sp Newline BlankLine+ { RDoc::Markup::Rule.new 1 }")
- Rules[:_Bullet] = rule_info("Bullet", "!HorizontalRule NonindentSpace (\"+\" | \"*\" | \"-\") Spacechar+")
+ Rules[:_HorizontalRule] = rule_info("HorizontalRule", "@NonindentSpace (\"*\" @Sp \"*\" @Sp \"*\" (@Sp \"*\")* | \"-\" @Sp \"-\" @Sp \"-\" (@Sp \"-\")* | \"_\" @Sp \"_\" @Sp \"_\" (@Sp \"_\")*) @Sp @Newline @BlankLine+ { RDoc::Markup::Rule.new 1 }")
+ Rules[:_Bullet] = rule_info("Bullet", "!HorizontalRule @NonindentSpace /[+*-]/ @Spacechar+")
Rules[:_BulletList] = rule_info("BulletList", "&Bullet (ListTight | ListLoose):a { RDoc::Markup::List.new(:BULLET, *a) }")
- Rules[:_ListTight] = rule_info("ListTight", "ListItemTight+:a BlankLine* !(Bullet | Enumerator) { a }")
- Rules[:_ListLoose] = rule_info("ListLoose", "StartList:a (ListItem:b BlankLine* { a << b })+ { a }")
- Rules[:_ListItem] = rule_info("ListItem", "(Bullet | Enumerator) StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }")
- Rules[:_ListItemTight] = rule_info("ListItemTight", "(Bullet | Enumerator) ListBlock:a (!BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }")
- Rules[:_ListBlock] = rule_info("ListBlock", "!BlankLine Line:a ListBlockLine*:c { [a, *c] }")
- Rules[:_ListContinuationBlock] = rule_info("ListContinuationBlock", "StartList:a BlankLine* { a << \"\\n\" } (Indent ListBlock:b { a.concat b })+ { a }")
- Rules[:_Enumerator] = rule_info("Enumerator", "NonindentSpace [0-9]+ \".\" Spacechar+")
+ Rules[:_ListTight] = rule_info("ListTight", "ListItemTight+:a @BlankLine* !(Bullet | Enumerator) { a }")
+ Rules[:_ListLoose] = rule_info("ListLoose", "@StartList:a (ListItem:b @BlankLine* { a << b })+ { a }")
+ Rules[:_ListItem] = rule_info("ListItem", "(Bullet | Enumerator) @StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }")
+ Rules[:_ListItemTight] = rule_info("ListItemTight", "(Bullet | Enumerator) ListBlock:a (!@BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }")
+ Rules[:_ListBlock] = rule_info("ListBlock", "!@BlankLine Line:a ListBlockLine*:c { [a, *c] }")
+ Rules[:_ListContinuationBlock] = rule_info("ListContinuationBlock", "@StartList:a @BlankLine* { a << \"\\n\" } (Indent ListBlock:b { a.concat b })+ { a }")
+ Rules[:_Enumerator] = rule_info("Enumerator", "@NonindentSpace [0-9]+ \".\" @Spacechar+")
Rules[:_OrderedList] = rule_info("OrderedList", "&Enumerator (ListTight | ListLoose):a { RDoc::Markup::List.new(:NUMBER, *a) }")
- Rules[:_ListBlockLine] = rule_info("ListBlockLine", "!BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine")
+ Rules[:_ListBlockLine] = rule_info("ListBlockLine", "!@BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine")
Rules[:_HtmlBlockOpenAddress] = rule_info("HtmlBlockOpenAddress", "\"<\" Spnl (\"address\" | \"ADDRESS\") Spnl HtmlAttribute* \">\"")
Rules[:_HtmlBlockCloseAddress] = rule_info("HtmlBlockCloseAddress", "\"<\" Spnl \"/\" (\"address\" | \"ADDRESS\") Spnl \">\"")
Rules[:_HtmlBlockAddress] = rule_info("HtmlBlockAddress", "HtmlBlockOpenAddress (HtmlBlockAddress | !HtmlBlockCloseAddress .)* HtmlBlockCloseAddress")
@@ -16223,7 +15849,7 @@ class RDoc::Markdown
Rules[:_HtmlBlockCloseScript] = rule_info("HtmlBlockCloseScript", "\"<\" Spnl \"/\" (\"script\" | \"SCRIPT\") Spnl \">\"")
Rules[:_HtmlBlockScript] = rule_info("HtmlBlockScript", "HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript")
Rules[:_HtmlBlockInTags] = rule_info("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)")
- Rules[:_HtmlBlock] = rule_info("HtmlBlock", "< (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > BlankLine+ { if html? then RDoc::Markup::Raw.new text end }")
+ Rules[:_HtmlBlock] = rule_info("HtmlBlock", "< (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ { if html? then RDoc::Markup::Raw.new text end }")
Rules[:_HtmlUnclosed] = rule_info("HtmlUnclosed", "\"<\" Spnl HtmlUnclosedType Spnl HtmlAttribute* Spnl \">\"")
Rules[:_HtmlUnclosedType] = rule_info("HtmlUnclosedType", "(\"HR\" | \"hr\")")
Rules[:_HtmlBlockSelfClosing] = rule_info("HtmlBlockSelfClosing", "\"<\" Spnl HtmlBlockType Spnl HtmlAttribute* \"/\" Spnl \">\"")
@@ -16231,77 +15857,77 @@ class RDoc::Markdown
Rules[:_StyleOpen] = rule_info("StyleOpen", "\"<\" Spnl (\"style\" | \"STYLE\") Spnl HtmlAttribute* \">\"")
Rules[:_StyleClose] = rule_info("StyleClose", "\"<\" Spnl \"/\" (\"style\" | \"STYLE\") Spnl \">\"")
Rules[:_InStyleTags] = rule_info("InStyleTags", "StyleOpen (!StyleClose .)* StyleClose")
- Rules[:_StyleBlock] = rule_info("StyleBlock", "< InStyleTags > BlankLine* { if css? then RDoc::Markup::Raw.new text end }")
- Rules[:_Inlines] = rule_info("Inlines", "(!Endline Inline:i { i } | Endline:c &Inline { c })+:chunks Endline? { chunks }")
- Rules[:_Inline] = rule_info("Inline", "(Str | Endline | UlOrStarLine | Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)")
- Rules[:_Space] = rule_info("Space", "Spacechar+ { \" \" }")
- Rules[:_Str] = rule_info("Str", "StartList:a < NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }")
- Rules[:_StrChunk] = rule_info("StrChunk", "< (NormalChar | \"_\"+ &Alphanumeric)+ > { text }")
- Rules[:_EscapedChar] = rule_info("EscapedChar", "\"\\\\\" !Newline < /[:\\\\`|*_{}\\[\\]()\#+.!><-]/ > { text }")
+ Rules[:_StyleBlock] = rule_info("StyleBlock", "< InStyleTags > @BlankLine* { if css? then RDoc::Markup::Raw.new text end }")
+ Rules[:_Inlines] = rule_info("Inlines", "(!@Endline Inline:i { i } | @Endline:c &Inline { c })+:chunks @Endline? { chunks }")
+ Rules[:_Inline] = rule_info("Inline", "(Str | @Endline | UlOrStarLine | @Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)")
+ Rules[:_Space] = rule_info("Space", "@Spacechar+ { \" \" }")
+ Rules[:_Str] = rule_info("Str", "@StartList:a < @NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }")
+ Rules[:_StrChunk] = rule_info("StrChunk", "< (@NormalChar | /_+/ &Alphanumeric)+ > { text }")
+ Rules[:_EscapedChar] = rule_info("EscapedChar", "\"\\\\\" !@Newline < /[:\\\\`|*_{}\\[\\]()\#+.!><-]/ > { text }")
Rules[:_Entity] = rule_info("Entity", "(HexEntity | DecEntity | CharEntity):a { a }")
- Rules[:_Endline] = rule_info("Endline", "(LineBreak | TerminalEndline | NormalEndline)")
- Rules[:_NormalEndline] = rule_info("NormalEndline", "Sp Newline !BlankLine !\">\" !AtxStart !(Line (\"===\" \"=\"* | \"---\" \"-\"*) Newline) { \"\\n\" }")
- Rules[:_TerminalEndline] = rule_info("TerminalEndline", "Sp Newline Eof")
- Rules[:_LineBreak] = rule_info("LineBreak", "\" \" NormalEndline { RDoc::Markup::HardBreak.new }")
- Rules[:_Symbol] = rule_info("Symbol", "< SpecialChar > { text }")
+ Rules[:_Endline] = rule_info("Endline", "(@LineBreak | @TerminalEndline | @NormalEndline)")
+ Rules[:_NormalEndline] = rule_info("NormalEndline", "@Sp @Newline !@BlankLine !\">\" !AtxStart !(Line /={3,}|-{3,}=/ @Newline) { \"\\n\" }")
+ Rules[:_TerminalEndline] = rule_info("TerminalEndline", "@Sp @Newline @Eof")
+ Rules[:_LineBreak] = rule_info("LineBreak", "\" \" @NormalEndline { RDoc::Markup::HardBreak.new }")
+ Rules[:_Symbol] = rule_info("Symbol", "< @SpecialChar > { text }")
Rules[:_UlOrStarLine] = rule_info("UlOrStarLine", "(UlLine | StarLine):a { a }")
- Rules[:_StarLine] = rule_info("StarLine", "(< \"****\" \"*\"* > { text } | < Spacechar \"*\"+ &Spacechar > { text })")
- Rules[:_UlLine] = rule_info("UlLine", "(< \"____\" \"_\"* > { text } | < Spacechar \"_\"+ &Spacechar > { text })")
+ Rules[:_StarLine] = rule_info("StarLine", "(< /\\*{4,}/ > { text } | < @Spacechar /\\*+/ &@Spacechar > { text })")
+ Rules[:_UlLine] = rule_info("UlLine", "(< /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text })")
Rules[:_Emph] = rule_info("Emph", "(EmphStar | EmphUl)")
- Rules[:_OneStarOpen] = rule_info("OneStarOpen", "!StarLine \"*\" !Spacechar !Newline")
- Rules[:_OneStarClose] = rule_info("OneStarClose", "!Spacechar !Newline Inline:a \"*\" { a }")
- Rules[:_EmphStar] = rule_info("EmphStar", "OneStarOpen StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }")
- Rules[:_OneUlOpen] = rule_info("OneUlOpen", "!UlLine \"_\" !Spacechar !Newline")
- Rules[:_OneUlClose] = rule_info("OneUlClose", "!Spacechar !Newline Inline:a \"_\" { a }")
- Rules[:_EmphUl] = rule_info("EmphUl", "OneUlOpen StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }")
+ Rules[:_OneStarOpen] = rule_info("OneStarOpen", "!StarLine \"*\" !@Spacechar !@Newline")
+ Rules[:_OneStarClose] = rule_info("OneStarClose", "!@Spacechar !@Newline Inline:a \"*\" { a }")
+ Rules[:_EmphStar] = rule_info("EmphStar", "OneStarOpen @StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }")
+ Rules[:_OneUlOpen] = rule_info("OneUlOpen", "!UlLine \"_\" !@Spacechar !@Newline")
+ Rules[:_OneUlClose] = rule_info("OneUlClose", "!@Spacechar !@Newline Inline:a \"_\" { a }")
+ Rules[:_EmphUl] = rule_info("EmphUl", "OneUlOpen @StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }")
Rules[:_Strong] = rule_info("Strong", "(StrongStar | StrongUl)")
- Rules[:_TwoStarOpen] = rule_info("TwoStarOpen", "!StarLine \"**\" !Spacechar !Newline")
- Rules[:_TwoStarClose] = rule_info("TwoStarClose", "!Spacechar !Newline Inline:a \"**\" { a }")
- Rules[:_StrongStar] = rule_info("StrongStar", "TwoStarOpen StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }")
- Rules[:_TwoUlOpen] = rule_info("TwoUlOpen", "!UlLine \"__\" !Spacechar !Newline")
- Rules[:_TwoUlClose] = rule_info("TwoUlClose", "!Spacechar !Newline Inline:a \"__\" { a }")
- Rules[:_StrongUl] = rule_info("StrongUl", "TwoUlOpen StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }")
- Rules[:_Image] = rule_info("Image", "\"!\" (ExplicitLink | ReferenceLink):a { a }")
+ Rules[:_TwoStarOpen] = rule_info("TwoStarOpen", "!StarLine \"**\" !@Spacechar !@Newline")
+ Rules[:_TwoStarClose] = rule_info("TwoStarClose", "!@Spacechar !@Newline Inline:a \"**\" { a }")
+ Rules[:_StrongStar] = rule_info("StrongStar", "TwoStarOpen @StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }")
+ Rules[:_TwoUlOpen] = rule_info("TwoUlOpen", "!UlLine \"__\" !@Spacechar !@Newline")
+ Rules[:_TwoUlClose] = rule_info("TwoUlClose", "!@Spacechar !@Newline Inline:a \"__\" { a }")
+ Rules[:_StrongUl] = rule_info("StrongUl", "TwoUlOpen @StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }")
+ Rules[:_Image] = rule_info("Image", "\"!\" (ExplicitLink | ReferenceLink):a { \"rdoc-image:\#{a[/\\[(.*)\\]/, 1]}\" }")
Rules[:_Link] = rule_info("Link", "(ExplicitLink | ReferenceLink | AutoLink)")
Rules[:_ReferenceLink] = rule_info("ReferenceLink", "(ReferenceLinkDouble | ReferenceLinkSingle)")
Rules[:_ReferenceLinkDouble] = rule_info("ReferenceLinkDouble", "Label:content < Spnl > !\"[]\" Label:label { link_to content, label, text }")
Rules[:_ReferenceLinkSingle] = rule_info("ReferenceLinkSingle", "Label:content < (Spnl \"[]\")? > { link_to content, content, text }")
- Rules[:_ExplicitLink] = rule_info("ExplicitLink", "Label:l Spnl \"(\" Sp Source:s Spnl Title Sp \")\" { \"{\#{l}}[\#{s}]\" }")
+ Rules[:_ExplicitLink] = rule_info("ExplicitLink", "Label:l Spnl \"(\" @Sp Source:s Spnl Title @Sp \")\" { \"{\#{l}}[\#{s}]\" }")
Rules[:_Source] = rule_info("Source", "(\"<\" < SourceContents > \">\" | < SourceContents >) { text }")
Rules[:_SourceContents] = rule_info("SourceContents", "(((!\"(\" !\")\" !\">\" Nonspacechar)+ | \"(\" SourceContents \")\")* | \"\")")
Rules[:_Title] = rule_info("Title", "(TitleSingle | TitleDouble | \"\"):a { a }")
- Rules[:_TitleSingle] = rule_info("TitleSingle", "\"'\" (!(\"'\" Sp (\")\" | Newline)) .)* \"'\"")
- Rules[:_TitleDouble] = rule_info("TitleDouble", "\"\\\"\" (!(\"\\\"\" Sp (\")\" | Newline)) .)* \"\\\"\"")
+ Rules[:_TitleSingle] = rule_info("TitleSingle", "\"'\" (!(\"'\" @Sp (\")\" | @Newline)) .)* \"'\"")
+ Rules[:_TitleDouble] = rule_info("TitleDouble", "\"\\\"\" (!(\"\\\"\" @Sp (\")\" | @Newline)) .)* \"\\\"\"")
Rules[:_AutoLink] = rule_info("AutoLink", "(AutoLinkUrl | AutoLinkEmail)")
- Rules[:_AutoLinkUrl] = rule_info("AutoLinkUrl", "\"<\" < /[A-Za-z]+/ \"://\" (!Newline !\">\" .)+ > \">\" { text }")
- Rules[:_AutoLinkEmail] = rule_info("AutoLinkEmail", "\"<\" \"mailto:\"? < /[\\w+.\\/!%~$-]+/i \"@\" (!Newline !\">\" .)+ > \">\" { \"mailto:\#{text}\" }")
- Rules[:_Reference] = rule_info("Reference", "NonindentSpace !\"[]\" Label:label \":\" Spnl RefSrc:link RefTitle BlankLine+ { \# TODO use title reference label, link nil }")
- Rules[:_Label] = rule_info("Label", "\"[\" (!\"^\" &{ notes? } | &. &{ !notes? }) StartList:a (!\"]\" Inline:l { a << l })* \"]\" { a.join.gsub(/\\s+/, ' ') }")
+ Rules[:_AutoLinkUrl] = rule_info("AutoLinkUrl", "\"<\" < /[A-Za-z]+/ \"://\" (!@Newline !\">\" .)+ > \">\" { text }")
+ Rules[:_AutoLinkEmail] = rule_info("AutoLinkEmail", "\"<\" \"mailto:\"? < /[\\w+.\\/!%~$-]+/i \"@\" (!@Newline !\">\" .)+ > \">\" { \"mailto:\#{text}\" }")
+ Rules[:_Reference] = rule_info("Reference", "@NonindentSpace !\"[]\" Label:label \":\" Spnl RefSrc:link RefTitle @BlankLine+ { \# TODO use title reference label, link nil }")
+ Rules[:_Label] = rule_info("Label", "\"[\" (!\"^\" &{ notes? } | &. &{ !notes? }) @StartList:a (!\"]\" Inline:l { a << l })* \"]\" { a.join.gsub(/\\s+/, ' ') }")
Rules[:_RefSrc] = rule_info("RefSrc", "< Nonspacechar+ > { text }")
Rules[:_RefTitle] = rule_info("RefTitle", "(RefTitleSingle | RefTitleDouble | RefTitleParens | EmptyTitle)")
Rules[:_EmptyTitle] = rule_info("EmptyTitle", "\"\"")
- Rules[:_RefTitleSingle] = rule_info("RefTitleSingle", "Spnl \"'\" < (!(\"'\" Sp Newline | Newline) .)* > \"'\" { text }")
- Rules[:_RefTitleDouble] = rule_info("RefTitleDouble", "Spnl \"\\\"\" < (!(\"\\\"\" Sp Newline | Newline) .)* > \"\\\"\" { text }")
- Rules[:_RefTitleParens] = rule_info("RefTitleParens", "Spnl \"(\" < (!(\")\" Sp Newline | Newline) .)* > \")\" { text }")
+ Rules[:_RefTitleSingle] = rule_info("RefTitleSingle", "Spnl \"'\" < (!(\"'\" @Sp @Newline | @Newline) .)* > \"'\" { text }")
+ Rules[:_RefTitleDouble] = rule_info("RefTitleDouble", "Spnl \"\\\"\" < (!(\"\\\"\" @Sp @Newline | @Newline) .)* > \"\\\"\" { text }")
+ Rules[:_RefTitleParens] = rule_info("RefTitleParens", "Spnl \"(\" < (!(\")\" @Sp @Newline | @Newline) .)* > \")\" { text }")
Rules[:_References] = rule_info("References", "(Reference | SkipBlock)*")
Rules[:_Ticks1] = rule_info("Ticks1", "\"`\" !\"`\"")
Rules[:_Ticks2] = rule_info("Ticks2", "\"``\" !\"`\"")
Rules[:_Ticks3] = rule_info("Ticks3", "\"```\" !\"`\"")
Rules[:_Ticks4] = rule_info("Ticks4", "\"````\" !\"`\"")
Rules[:_Ticks5] = rule_info("Ticks5", "\"`````\" !\"`\"")
- Rules[:_Code] = rule_info("Code", "(Ticks1 Sp < ((!\"`\" Nonspacechar)+ | !Ticks1 \"`\"+ | !(Sp Ticks1) (Spacechar | Newline !BlankLine))+ > Sp Ticks1 | Ticks2 Sp < ((!\"`\" Nonspacechar)+ | !Ticks2 \"`\"+ | !(Sp Ticks2) (Spacechar | Newline !BlankLine))+ > Sp Ticks2 | Ticks3 Sp < ((!\"`\" Nonspacechar)+ | !Ticks3 \"`\"+ | !(Sp Ticks3) (Spacechar | Newline !BlankLine))+ > Sp Ticks3 | Ticks4 Sp < ((!\"`\" Nonspacechar)+ | !Ticks4 \"`\"+ | !(Sp Ticks4) (Spacechar | Newline !BlankLine))+ > Sp Ticks4 | Ticks5 Sp < ((!\"`\" Nonspacechar)+ | !Ticks5 \"`\"+ | !(Sp Ticks5) (Spacechar | Newline !BlankLine))+ > Sp Ticks5) { \"<code>\#{text}</code>\" }")
+ Rules[:_Code] = rule_info("Code", "(Ticks1 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks1 /`+/ | !(@Sp Ticks1) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks1 | Ticks2 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks2 /`+/ | !(@Sp Ticks2) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks2 | Ticks3 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks3 /`+/ | !(@Sp Ticks3) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks3 | Ticks4 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks4 /`+/ | !(@Sp Ticks4) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks4 | Ticks5 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks5 /`+/ | !(@Sp Ticks5) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks5) { \"<code>\#{text}</code>\" }")
Rules[:_RawHtml] = rule_info("RawHtml", "< (HtmlComment | HtmlBlockScript | HtmlTag) > { if html? then text else '' end }")
- Rules[:_BlankLine] = rule_info("BlankLine", "Sp Newline { \"\\n\" }")
+ Rules[:_BlankLine] = rule_info("BlankLine", "@Sp @Newline { \"\\n\" }")
Rules[:_Quoted] = rule_info("Quoted", "(\"\\\"\" (!\"\\\"\" .)* \"\\\"\" | \"'\" (!\"'\" .)* \"'\")")
Rules[:_HtmlAttribute] = rule_info("HtmlAttribute", "(AlphanumericAscii | \"-\")+ Spnl (\"=\" Spnl (Quoted | (!\">\" Nonspacechar)+))? Spnl")
Rules[:_HtmlComment] = rule_info("HtmlComment", "\"<!--\" (!\"-->\" .)* \"-->\"")
Rules[:_HtmlTag] = rule_info("HtmlTag", "\"<\" Spnl \"/\"? AlphanumericAscii+ Spnl HtmlAttribute* \"/\"? Spnl \">\"")
Rules[:_Eof] = rule_info("Eof", "!.")
- Rules[:_Nonspacechar] = rule_info("Nonspacechar", "!Spacechar !Newline .")
- Rules[:_Sp] = rule_info("Sp", "Spacechar*")
- Rules[:_Spnl] = rule_info("Spnl", "Sp (Newline Sp)?")
- Rules[:_SpecialChar] = rule_info("SpecialChar", "(\"*\" | \"_\" | \"`\" | \"&\" | \"[\" | \"]\" | \"(\" | \")\" | \"<\" | \"!\" | \"\#\" | \"\\\\\" | \"'\" | \"\\\"\" | ExtendedSpecialChar)")
- Rules[:_NormalChar] = rule_info("NormalChar", "!(SpecialChar | Spacechar | Newline) .")
+ Rules[:_Nonspacechar] = rule_info("Nonspacechar", "!@Spacechar !@Newline .")
+ Rules[:_Sp] = rule_info("Sp", "@Spacechar*")
+ Rules[:_Spnl] = rule_info("Spnl", "@Sp (@Newline @Sp)?")
+ Rules[:_SpecialChar] = rule_info("SpecialChar", "(/[*_`&\\[\\]()<!\#\\\\'\"]/ | @ExtendedSpecialChar)")
+ Rules[:_NormalChar] = rule_info("NormalChar", "!(@SpecialChar | @Spacechar | @Newline) .")
Rules[:_Digit] = rule_info("Digit", "[0-9]")
Rules[:_Alphanumeric] = rule_info("Alphanumeric", "%literals.Alphanumeric")
Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "%literals.AlphanumericAscii")
@@ -16309,28 +15935,28 @@ class RDoc::Markdown
Rules[:_Newline] = rule_info("Newline", "%literals.Newline")
Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "%literals.NonAlphanumeric")
Rules[:_Spacechar] = rule_info("Spacechar", "%literals.Spacechar")
- Rules[:_HexEntity] = rule_info("HexEntity", "\"&\" \"\#\" /[Xx]/ < /[0-9a-fA-F]+/ > \";\" { [text.to_i(16)].pack 'U' }")
- Rules[:_DecEntity] = rule_info("DecEntity", "\"&\" \"\#\" < /[0-9]+/ > \";\" { [text.to_i].pack 'U' }")
+ Rules[:_HexEntity] = rule_info("HexEntity", "/&\#x/i < /[0-9a-fA-F]+/ > \";\" { [text.to_i(16)].pack 'U' }")
+ Rules[:_DecEntity] = rule_info("DecEntity", "\"&\#\" < /[0-9]+/ > \";\" { [text.to_i].pack 'U' }")
Rules[:_CharEntity] = rule_info("CharEntity", "\"&\" < /[A-Za-z0-9]+/ > \";\" { if entity = HTML_ENTITIES[text] then entity.pack 'U*' else \"&\#{text};\" end }")
- Rules[:_NonindentSpace] = rule_info("NonindentSpace", "(\" \" | \" \" | \" \" | \"\")")
- Rules[:_Indent] = rule_info("Indent", "(\"\\t\" | \" \")")
+ Rules[:_NonindentSpace] = rule_info("NonindentSpace", "/ {0,3}/")
+ Rules[:_Indent] = rule_info("Indent", "/\\t| /")
Rules[:_IndentedLine] = rule_info("IndentedLine", "Indent Line")
Rules[:_OptionallyIndentedLine] = rule_info("OptionallyIndentedLine", "Indent? Line")
Rules[:_StartList] = rule_info("StartList", "&. { [] }")
- Rules[:_Line] = rule_info("Line", "RawLine:a { a }")
- Rules[:_RawLine] = rule_info("RawLine", "(< (!\"\r\" !\"\\n\" .)* Newline > | < .+ > Eof) { text }")
- Rules[:_SkipBlock] = rule_info("SkipBlock", "(HtmlBlock | (!\"\#\" !SetextBottom1 !SetextBottom2 !BlankLine RawLine)+ BlankLine* | BlankLine+ | RawLine)")
+ Rules[:_Line] = rule_info("Line", "@RawLine:a { a }")
+ Rules[:_RawLine] = rule_info("RawLine", "(< (!\"\\r\" !\"\\n\" .)* @Newline > | < .+ > @Eof) { text }")
+ Rules[:_SkipBlock] = rule_info("SkipBlock", "(HtmlBlock | (!\"\#\" !SetextBottom1 !SetextBottom2 !@BlankLine @RawLine)+ @BlankLine* | @BlankLine+ | @RawLine)")
Rules[:_ExtendedSpecialChar] = rule_info("ExtendedSpecialChar", "&{ notes? } \"^\"")
Rules[:_NoteReference] = rule_info("NoteReference", "&{ notes? } RawNoteReference:ref { note_for ref }")
- Rules[:_RawNoteReference] = rule_info("RawNoteReference", "\"[^\" < (!Newline !\"]\" .)+ > \"]\" { text }")
- Rules[:_Note] = rule_info("Note", "&{ notes? } NonindentSpace RawNoteReference:ref \":\" Sp StartList:a RawNoteBlock (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }")
- Rules[:_InlineNote] = rule_info("InlineNote", "&{ notes? } \"^[\" StartList:a (!\"]\" Inline:l { a << l })+ \"]\" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }")
+ Rules[:_RawNoteReference] = rule_info("RawNoteReference", "\"[^\" < (!@Newline !\"]\" .)+ > \"]\" { text }")
+ Rules[:_Note] = rule_info("Note", "&{ notes? } @NonindentSpace RawNoteReference:ref \":\" @Sp @StartList:a RawNoteBlock:i { a.concat i } (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }")
+ Rules[:_InlineNote] = rule_info("InlineNote", "&{ notes? } \"^[\" @StartList:a (!\"]\" Inline:l { a << l })+ \"]\" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }")
Rules[:_Notes] = rule_info("Notes", "(Note | SkipBlock)*")
- Rules[:_RawNoteBlock] = rule_info("RawNoteBlock", "StartList:a (!BlankLine OptionallyIndentedLine:l { a << l })+ < BlankLine* > { a << text } { a }")
- Rules[:_CodeFence] = rule_info("CodeFence", "&{ github? } Ticks3 (Sp StrChunk:format)? Spnl < ((!\"`\" Nonspacechar)+ | !Ticks3 \"`\"+ | Spacechar | Newline)+ > Ticks3 Sp Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }")
+ Rules[:_RawNoteBlock] = rule_info("RawNoteBlock", "@StartList:a (!@BlankLine OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }")
+ Rules[:_CodeFence] = rule_info("CodeFence", "&{ github? } Ticks3 (@Sp StrChunk:format)? Spnl < ((!\"`\" Nonspacechar)+ | !Ticks3 /`+/ | Spacechar | @Newline)+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }")
Rules[:_DefinitionList] = rule_info("DefinitionList", "&{ definition_lists? } DefinitionListItem+:list { RDoc::Markup::List.new :NOTE, *list.flatten }")
Rules[:_DefinitionListItem] = rule_info("DefinitionListItem", "DefinitionListLabel+:label DefinitionListDefinition+:defns { list_items = [] list_items << RDoc::Markup::ListItem.new(label, defns.shift) list_items.concat defns.map { |defn| RDoc::Markup::ListItem.new nil, defn } unless list_items.empty? list_items }")
- Rules[:_DefinitionListLabel] = rule_info("DefinitionListLabel", "StrChunk:label Sp Newline { label }")
- Rules[:_DefinitionListDefinition] = rule_info("DefinitionListDefinition", "NonindentSpace \":\" Space Inlines:a BlankLine+ { paragraph a }")
+ Rules[:_DefinitionListLabel] = rule_info("DefinitionListLabel", "StrChunk:label @Sp @Newline { label }")
+ Rules[:_DefinitionListDefinition] = rule_info("DefinitionListDefinition", "@NonindentSpace \":\" @Space Inlines:a @BlankLine+ { paragraph a }")
# :startdoc:
end
diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals_1_9.rb
index 3d1cf02e55..6782eb7910 100644
--- a/lib/rdoc/markdown/literals_1_9.rb
+++ b/lib/rdoc/markdown/literals_1_9.rb
@@ -37,7 +37,7 @@ class RDoc::Markdown::Literals
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
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index 0b6e187d97..e1d75fa52b 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -59,7 +59,7 @@
#
# require 'rdoc'
#
-# h = RDoc::Markup::ToHtml.new
+# h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
#
# puts h.convert(input_string)
#
@@ -171,22 +171,13 @@
# === Rules
#
# A line starting with three or more hyphens (at the current indent)
-# generates a horizontal rule. The more hyphens, the thicker the rule
-# (within reason, and if supported by the output device).
-#
-# In the case of HTML output, three dashes generate a 1-pixel high rule,
-# four dashes result in 2 pixels, and so on. The actual height is limited
-# to 10 pixels:
+# generates a horizontal rule.
#
# ---
-# -----
-# -----------------------------------------------------
#
# produces:
#
# ---
-# -----
-# -----------------------------------------------------
#
# === Simple Lists
#
@@ -356,12 +347,18 @@
# with <tt>+</tt> like <tt>RDoc::Markup@Escaping+Text+Markup</tt>.
# Punctuation and other special characters must be escaped like CGI.escape.
#
+# The <tt>@</tt> can also be used to link to sections. If a section and a
+# heading share the same name the section is preferred for the link.
+#
# Links can also be of the form <tt>label[url]</tt>, in which case +label+ is
# used in the displayed text, and +url+ is used as the target. If +label+
# contains multiple words, put it in braces: <tt>{multi word label}[url]</tt>.
# The +url+ may be an +http:+-type link or a cross-reference to a class,
# module or method with a label.
#
+# Links with the <code>rdoc-image:</code> scheme will create an image tag for
+# HTML output. Only fully-qualified URLs are supported.
+#
# Links with the <tt>rdoc-ref:</tt> scheme will link to the referenced class,
# module, method, file, etc. If the referenced item is does not exist
# no link will be generated and <tt>rdoc-ref:</tt> will be removed from the
@@ -713,7 +710,7 @@
# def some_method
# # ...
#
-# See Markup@DEVELOPERS for instructions on adding a new markup format.
+# See Markup@CONTRIBUTING for instructions on adding a new markup format.
#
# [+:include:+ _filename_]
# Include the contents of the named file at this point. This directive
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index 7ee6f423d6..c5a50d519c 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -186,8 +186,9 @@ class RDoc::Markup::AttributeManager
# protect __send__, __FILE__, etc.
@str.gsub!(/__([a-z]+)__/i,
"_#{PROTECT_ATTR}_#{PROTECT_ATTR}\\1_#{PROTECT_ATTR}_#{PROTECT_ATTR}")
- @str.gsub!(/\\([#{Regexp.escape @protectable.join('')}])/,
- "\\1#{PROTECT_ATTR}")
+ @str.gsub!(/(\A|[^\\])\\([#{Regexp.escape @protectable.join}])/m,
+ "\\1\\2#{PROTECT_ATTR}")
+ @str.gsub!(/\\(\\[#{Regexp.escape @protectable.join}])/m, "\\1")
end
##
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index b668746c7a..7661c95239 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -80,7 +80,7 @@ class RDoc::Markup::Formatter
# Adds a special for links of the form rdoc-...:
def add_special_RDOCLINK
- @markup.add_special(/rdoc-[a-z]+:\S+/, :RDOCLINK)
+ @markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
end
##
@@ -88,7 +88,7 @@ class RDoc::Markup::Formatter
def add_special_TIDYLINK
@markup.add_special(/(?:
- \{.*?\} | # multi-word label
+ \{.*?\} | # multi-word label
\b[^\s{}]+? # single-word label
)
@@ -239,7 +239,7 @@ class RDoc::Markup::Formatter
else
scheme = 'http'
path = url
- url = "http://#{url}"
+ url = url
end
if scheme == 'link' then
diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb
index b1f372222f..535e310e54 100644
--- a/lib/rdoc/markup/heading.rb
+++ b/lib/rdoc/markup/heading.rb
@@ -48,6 +48,19 @@ RDoc::Markup::Heading =
end
##
+ # Creates a fully-qualified label which will include the label from
+ # +context+. This helps keep ids unique in HTML.
+
+ def label context = nil
+ label = aref
+
+ label = [context.aref, label].compact.join '-' if
+ context and context.respond_to? :aref
+
+ label
+ end
+
+ ##
# HTML markup of the text of this label without the surrounding header
# element.
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index 3fce2b4c3b..4d0cf1127e 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -389,7 +389,7 @@ class RDoc::Markup::Parser
skip :NEWLINE
when :TEXT then
unget
- parent << build_paragraph(indent)
+ parse_text parent, indent
when *LIST_TOKENS then
unget
parent << build_list(indent)
@@ -406,6 +406,13 @@ class RDoc::Markup::Parser
end
##
+ # Small hook that is overridden by RDoc::TomDoc
+
+ def parse_text parent, indent # :nodoc:
+ parent << build_paragraph(indent)
+ end
+
+ ##
# Returns the next token on the stream without modifying the stream
def peek_token
diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb
index 6024edcd27..01fb293462 100644
--- a/lib/rdoc/markup/pre_process.rb
+++ b/lib/rdoc/markup/pre_process.rb
@@ -151,7 +151,7 @@ class RDoc::Markup::PreProcess
case directive
when 'arg', 'args' then
- return blankline unless code_object
+ return "#{prefix}:#{directive}: #{param}\n" unless code_object
code_object.params = param
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 37b9492e23..823b023e72 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -65,6 +65,30 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
#
# These methods handle special markup added by RDoc::Markup#add_special.
+ def handle_RDOCLINK url # :nodoc:
+ case url
+ when /^rdoc-ref:/
+ $'
+ when /^rdoc-label:/
+ text = $'
+
+ text = case text
+ when /\Alabel-/ then $'
+ when /\Afootmark-/ then $'
+ when /\Afoottext-/ then $'
+ else text
+ end
+
+ gen_url url, text
+ when /^rdoc-image:/
+ "<img src=\"#{$'}\">"
+ else
+ url =~ /\Ardoc-[a-z]+:/
+
+ $'
+ end
+ end
+
##
# +special+ is a <code><br></code>
@@ -100,27 +124,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
# when creating a link. All other contents will be linked verbatim.
def handle_special_RDOCLINK special
- url = special.text
-
- case url
- when /\Ardoc-ref:/
- $'
- when /\Ardoc-label:/
- text = $'
-
- text = case text
- when /\Alabel-/ then $'
- when /\Afootmark-/ then "^#{$'}"
- when /\Afoottext-/ then "*#{$'}"
- else text
- end
-
- gen_url url, text
- else
- url =~ /\Ardoc-[a-z]+:/
-
- $'
- end
+ handle_RDOCLINK special.text
end
##
@@ -130,10 +134,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def handle_special_TIDYLINK(special)
text = special.text
- return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
+ return text unless
+ text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/
label = $1
url = $2
+
+ label = handle_RDOCLINK label if /^rdoc-image:/ =~ label
+
gen_url url, label
end
@@ -176,6 +184,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def accept_paragraph paragraph
@res << "\n<p>"
text = paragraph.text @hard_break
+ text = text.gsub(/\r?\n/, ' ')
@res << wrap(to_html(text))
@res << "</p>\n"
end
@@ -186,28 +195,33 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def accept_verbatim verbatim
text = verbatim.text.rstrip
- @res << if verbatim.ruby? or parseable? text then
- begin
- tokens = RDoc::RubyLex.tokenize text, @options
+ klass = nil
- html = RDoc::TokenStream.to_html tokens
+ content = if verbatim.ruby? or parseable? text then
+ begin
+ tokens = RDoc::RubyLex.tokenize text, @options
+ klass = ' class="ruby"'
- "\n<pre class=\"ruby\">#{html}</pre>\n"
- rescue RDoc::RubyLex::Error
- "\n<pre>#{CGI.escapeHTML text}</pre>\n"
+ RDoc::TokenStream.to_html tokens
+ rescue RDoc::RubyLex::Error
+ CGI.escapeHTML text
+ end
+ else
+ CGI.escapeHTML text
end
- else
- "\n<pre>#{CGI.escapeHTML text}</pre>\n"
- end
+
+ if @options.pipe then
+ @res << "\n<pre><code>#{CGI.escapeHTML text}</code></pre>\n"
+ else
+ @res << "\n<pre#{klass}>#{content}</pre>\n"
+ end
end
##
# Adds +rule+ to the output
- def accept_rule(rule)
- size = rule.weight
- size = 10 if size > 10
- @res << "<hr style=\"height: #{size}px\">\n"
+ def accept_rule rule
+ @res << "<hr>\n"
end
##
@@ -262,11 +276,13 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def accept_heading heading
level = [6, heading.level].min
- label = heading.aref
- label = [@code_object.aref, label].compact.join '-' if
- @code_object and @code_object.respond_to? :aref
+ label = heading.label @code_object
- @res << "\n<h#{level} id=\"#{label}\">"
+ @res << if @options.output_decoration
+ "\n<h#{level} id=\"#{label}\">"
+ else
+ "\n<h#{level}>"
+ end
@res << to_html(heading.text)
unless @options.pipe then
@res << "<span><a href=\"##{label}\">&para;</a>"
@@ -302,7 +318,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
"<img src=\"#{url}\" />"
else
- "<a#{id} href=\"#{url}\">#{text.sub(%r{^#{scheme}:/*}i, '')}</a>"
+ text = text.sub %r%^#{scheme}:/*%i, ''
+ text = text.sub %r%^[*\^](\d+)$%, '\1'
+
+ link = "<a#{id} href=\"#{url}\">#{text}</a>"
+
+ link = "<sup>#{link}</sup>" if /"foot/ =~ id
+
+ link
end
end
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index 405f68c14f..d27e0ab627 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -145,6 +145,9 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
if path =~ /#/ then
path << "-label-#{label}"
+ elsif ref.sections and
+ ref.sections.any? { |section| label == section.title } then
+ path << "##{label}"
else
path << "#label-#{label}"
end if label
diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb
index 62ad3ad13e..d4b15bf41b 100644
--- a/lib/rdoc/markup/to_markdown.rb
+++ b/lib/rdoc/markup/to_markdown.rb
@@ -147,15 +147,17 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
def handle_rdoc_link url
case url
- when /\Ardoc-ref:/ then
+ when /^rdoc-ref:/ then
$'
- when /\Ardoc-label:footmark-(\d+)/ then
+ when /^rdoc-label:footmark-(\d+)/ then
"[^#{$1}]:"
- when /\Ardoc-label:foottext-(\d+)/ then
+ when /^rdoc-label:foottext-(\d+)/ then
"[^#{$1}]"
- when /\Ardoc-label:label-/ then
+ when /^rdoc-label:label-/ then
gen_url url, $'
- when /\Ardoc-[a-z]+:/ then
+ when /^rdoc-image:/ then
+ "![](#{$'})"
+ when /^rdoc-[a-z]+:/ then
$'
end
end
diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb
index c9c377f671..8bde102640 100644
--- a/lib/rdoc/method_attr.rb
+++ b/lib/rdoc/method_attr.rb
@@ -95,6 +95,18 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
##
+ # Resets cached data for the object so it can be rebuilt by accessor methods
+
+ def initialize_copy other # :nodoc:
+ @full_name = nil
+ end
+
+ def initialize_visibility # :nodoc:
+ super
+ @see = nil
+ end
+
+ ##
# Order by #singleton then #name
def <=>(other)
diff --git a/lib/rdoc/mixin.rb b/lib/rdoc/mixin.rb
new file mode 100644
index 0000000000..547744f870
--- /dev/null
+++ b/lib/rdoc/mixin.rb
@@ -0,0 +1,120 @@
+##
+# A Mixin adds features from a module into another context. RDoc::Include and
+# RDoc::Extend are both mixins.
+
+class RDoc::Mixin < RDoc::CodeObject
+
+ ##
+ # Name of included module
+
+ attr_accessor :name
+
+ ##
+ # Creates a new Mixin for +name+ with +comment+
+
+ def initialize(name, comment)
+ super()
+ @name = name
+ self.comment = comment
+ @module = nil # cache for module if found
+ end
+
+ ##
+ # Mixins 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? == # :nodoc:
+
+ ##
+ # 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.%s %s>" % [
+ self.class,
+ object_id,
+ parent_name, self.class.name.downcase, @name,
+ ]
+ end
+
+ ##
+ # Attempts to locate the included module object. Returns the name if not
+ # known.
+ #
+ # The scoping rules of Ruby to resolve the name of an included module are:
+ # - first look into the children of the current context;
+ # - 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
+
+ # 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.includes.take_while { |i| i != self }.reverse
+ searched.each do |i|
+ inc = i.module
+ next if String === inc
+ full_name = inc.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:
+ "#{self.class.name.downcase} #@name in: #{parent}"
+ end
+
+end
+
diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb
index dd7482c37c..7589e2686c 100644
--- a/lib/rdoc/normal_class.rb
+++ b/lib/rdoc/normal_class.rb
@@ -20,6 +20,10 @@ class RDoc::NormalClass < RDoc::ClassModule
end
end
+ def aref_prefix # :nodoc:
+ 'class'
+ end
+
##
# The definition of this class, <tt>class MyClassName</tt>
diff --git a/lib/rdoc/normal_module.rb b/lib/rdoc/normal_module.rb
index cd77b1e39e..961c431ed6 100644
--- a/lib/rdoc/normal_module.rb
+++ b/lib/rdoc/normal_module.rb
@@ -3,6 +3,10 @@
class RDoc::NormalModule < RDoc::ClassModule
+ def aref_prefix # :nodoc:
+ 'module'
+ end
+
def inspect # :nodoc:
"#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
self.class, object_id,
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 9a9d99d3df..e27be89dbf 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -52,6 +52,18 @@ require 'pathname'
# end
# end
#
+# Of course, RDoc::Options does not respond to +spell_dictionary+ by default
+# so you will need to add it:
+#
+# class RDoc::Options
+#
+# ##
+# # The spell dictionary used by the spell-checking plugin.
+#
+# attr_accessor :spell_dictionary
+#
+# end
+#
# == Option Validators
#
# OptionParser validators will validate and cast user input values. In
@@ -229,6 +241,10 @@ class RDoc::Options
attr_accessor :option_parser
##
+ # Output heading decorations?
+ attr_accessor :output_decoration
+
+ ##
# Directory where guides, FAQ, and other pages not associated with a class
# live. You may leave this unset if these are at the root of your project.
@@ -277,6 +293,11 @@ class RDoc::Options
attr_accessor :template_dir
##
+ # Additional template stylesheets
+
+ attr_accessor :template_stylesheets
+
+ ##
# Documentation title
attr_accessor :title
@@ -297,9 +318,12 @@ class RDoc::Options
attr_accessor :webcvs
##
- # Minimum visibility of a documented method. One of +:public+,
- # +:protected+, +:private+. May be overridden on a per-method
- # basis with the :doc: directive.
+ # Minimum visibility of a documented method. One of +:public+, +:protected+,
+ # +:private+ or +:nodoc+.
+ #
+ # The +:nodoc+ visibility ignores all directives related to visibility. The
+ # other visibilities may be overridden on a per-method basis with the :doc:
+ # directive.
attr_accessor :visibility
@@ -325,6 +349,7 @@ class RDoc::Options
@op_dir = nil
@page_dir = nil
@pipe = false
+ @output_decoration = true
@rdoc_include = []
@root = Pathname(Dir.pwd)
@show_hash = false
@@ -333,6 +358,7 @@ class RDoc::Options
@tab_width = 8
@template = nil
@template_dir = nil
+ @template_stylesheets = []
@title = nil
@update_output_dir = true
@verbosity = 1
@@ -466,7 +492,7 @@ class RDoc::Options
@op_dir ||= 'doc'
@rdoc_include << "." if @rdoc_include.empty?
- root = @root.to_path
+ root = @root.to_s
@rdoc_include << root unless @rdoc_include.include?(root)
if @exclude.nil? or Regexp === @exclude then
@@ -583,6 +609,7 @@ Usage: #{opt.program_name} [options] [names...]
parsers.sort.each do |parser, regexp|
opt.banner << " - #{parser}: #{regexp.join ', '}\n"
end
+ opt.banner << " - TomDoc: Only in ruby files\n"
opt.banner << "\n The following options are deprecated:\n\n"
@@ -697,17 +724,19 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--tab-width=WIDTH", "-w", OptionParser::DecimalInteger,
+ opt.on("--tab-width=WIDTH", "-w", Integer,
"Set the width of tab characters.") do |value|
+ raise OptionParser::InvalidArgument,
+ "#{value} is an invalid tab width" if value <= 0
@tab_width = value
end
opt.separator nil
- opt.on("--visibility=VISIBILITY", "-V", RDoc::VISIBILITIES,
+ opt.on("--visibility=VISIBILITY", "-V", RDoc::VISIBILITIES + [:nodoc],
"Minimum visibility to document a method.",
- "One of 'public', 'protected' (the default)",
- "or 'private'. Can be abbreviated.") do |value|
+ "One of 'public', 'protected' (the default),",
+ "'private' or 'nodoc' (show everything)") do |value|
@visibility = value
end
@@ -863,6 +892,14 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
+ opt.on("--template-stylesheets=FILES", PathArray,
+ "Set (or add to) the list of files to",
+ "include with the html template.") do |value|
+ @template_stylesheets << value
+ end
+
+ opt.separator nil
+
opt.on("--title=TITLE", "-t",
"Set TITLE as the title for HTML output.") do |value|
@title = value
@@ -918,7 +955,7 @@ Usage: #{opt.program_name} [options] [names...]
check_generator
@generator_name = "ri"
- @op_dir = RDoc::RI::Paths::SITEDIR
+ @op_dir = RDoc::RI::Paths.site_dir
setup_generator
end
@@ -965,13 +1002,20 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--verbose", "-v",
+ opt.on("--verbose", "-V",
"Display extra progress as RDoc parses") do |value|
@verbosity = 2
end
opt.separator nil
+ opt.on("--version", "-v", "print the version") do
+ puts opt.version
+ exit
+ end
+
+ opt.separator nil
+
opt.on("--help",
"Display this help") do
RDoc::RDoc::GENERATORS.each_key do |generator|
@@ -993,7 +1037,7 @@ Usage: #{opt.program_name} [options] [names...]
begin
opts.parse! argv
- rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+ rescue OptionParser::ParseError => e
if DEPRECATED[e.args.first] then
deprecated << e.args.first
elsif %w[--format --ri -r --ri-site -R].include? e.args.first then
@@ -1019,18 +1063,22 @@ Usage: #{opt.program_name} [options] [names...]
deprecated.each do |opt|
$stderr.puts 'option ' << opt << ' is deprecated: ' << DEPRECATED[opt]
end
+ end
- unless invalid.empty? then
- invalid = "invalid options: #{invalid.join ', '}"
+ unless invalid.empty? then
+ invalid = "invalid options: #{invalid.join ', '}"
- if ignore_invalid then
+ if ignore_invalid then
+ unless quiet then
$stderr.puts invalid
$stderr.puts '(invalid options are ignored)'
- else
+ end
+ else
+ unless quiet then
$stderr.puts opts
- $stderr.puts invalid
- exit 1
end
+ $stderr.puts invalid
+ exit 1
end
end
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 47ecd746d0..5c6a0a8983 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -218,6 +218,8 @@ class RDoc::Parser
return unless parser
+ content = remove_modeline content
+
parser.new top_level, file_name, content, options, stats
rescue SystemCallError
nil
@@ -233,6 +235,13 @@ class RDoc::Parser
end
##
+ # Removes an emacs-style modeline from the first line of the document
+
+ def self.remove_modeline content
+ content.sub(/\A.*-\*-\s*(.*?\S)\s*-\*-.*\r?\n/, '')
+ end
+
+ ##
# If there is a <tt>markup: parser_name</tt> comment at the front of the
# file, use it to determine the parser. For example:
#
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index 9f8d7ac020..f7d0a9afa0 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -173,6 +173,9 @@ class RDoc::Parser::C < RDoc::Parser
@classes = load_variable_map :c_class_variables
@singleton_classes = load_variable_map :c_singleton_class_variables
+ # class_variable => { function => [method, ...] }
+ @methods = Hash.new { |h, f| h[f] = Hash.new { |i, m| i[m] = [] } }
+
# missing variable => [handle_class_module arguments]
@missing_dependencies = {}
@@ -207,6 +210,47 @@ class RDoc::Parser::C < RDoc::Parser
end
##
+ # Removes duplicate call-seq entries for methods using the same
+ # implementation.
+
+ def deduplicate_call_seq
+ @methods.each do |var_name, functions|
+ class_name = @known_classes[var_name]
+ class_obj = find_class var_name, class_name
+
+ functions.each_value do |method_names|
+ next if method_names.length == 1
+
+ method_names.each do |method_name|
+ deduplicate_method_name class_obj, method_name
+ end
+ end
+ end
+ end
+
+ ##
+ # If two ruby methods share a C implementation (and comment) this
+ # deduplicates the examples in the call_seq for the method to reduce
+ # confusion in the output.
+
+ def deduplicate_method_name class_obj, method_name # :nodoc:
+ return unless
+ method = class_obj.method_list.find { |m| m.name == method_name }
+ return unless call_seq = method.call_seq
+
+ method_name = method_name[0, 1] if method_name =~ /\A\[/
+
+ entries = call_seq.split "\n"
+
+ matching = entries.select do |entry|
+ entry =~ /^\w*\.?#{Regexp.escape method_name}/ or
+ entry =~ /\s#{Regexp.escape method_name}\s/
+ end
+
+ method.call_seq = matching.join "\n"
+ end
+
+ ##
# Scans #content for rb_define_alias
def do_aliases
@@ -422,7 +466,7 @@ class RDoc::Parser::C < RDoc::Parser
)
\s*\(\s*([\w\.]+),
\s*"([^"]+)",
- \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
+ \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(METHOD\))?(\w+)\)?,
\s*(-?\w+)\s*\)
(?:;\s*/[*/]\s+in\s+(\w+?\.(?:cpp|c|y)))?
%xm) do |type, var_name, meth_name, function, param_count, source_file|
@@ -938,6 +982,8 @@ class RDoc::Parser::C < RDoc::Parser
class_name = @known_classes[var_name]
singleton = @singleton_classes.key? var_name
+ @methods[var_name][function] << meth_name
+
return unless class_name
class_obj = find_class var_name, class_name
@@ -1172,6 +1218,8 @@ class RDoc::Parser::C < RDoc::Parser
do_aliases
do_attrs
+ deduplicate_call_seq
+
@store.add_c_variables self
@top_level
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index 6e3e834c24..1c4b637640 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -107,6 +107,9 @@ $TOKEN_DEBUG ||= nil
# ##
# # :singleton-method: some_method!
#
+# You can define arguments for metaprogrammed methods via either the
+# :call-seq:, :arg: or :args: directives.
+#
# Additionally you can mark a method as an attribute by
# using :attr:, :attr_reader:, :attr_writer: or :attr_accessor:. Just like
# for :method:, the name is optional.
@@ -165,6 +168,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
@scanner.exception_on_syntax_error = false
@prev_seek = nil
@markup = @options.markup
+ @track_visibility = :nodoc != @options.visibility
@encoding = nil
@encoding = @options.encoding if Object.const_defined? :Encoding
@@ -173,6 +177,48 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Retrieves the read token stream and replaces +pattern+ with +replacement+
+ # using gsub. If the result is only a ";" returns an empty string.
+
+ def get_tkread_clean pattern, replacement # :nodoc:
+ read = get_tkread.gsub(pattern, replacement).strip
+ return '' if read == ';'
+ read
+ end
+
+ ##
+ # Extracts the visibility information for the visibility token +tk+.
+ #
+ # Returns the visibility type (a string), the visibility (a symbol) and
+ # +singleton+ if the methods following should be converted to singleton
+ # methods.
+
+ def get_visibility_information tk # :nodoc:
+ vis_type = tk.name
+ singleton = false
+
+ vis =
+ case vis_type
+ when 'private' then :private
+ when 'protected' then :protected
+ when 'public' then :public
+ when 'private_class_method' then
+ singleton = true
+ :private
+ when 'public_class_method' then
+ singleton = true
+ :public
+ when 'module_function' then
+ singleton = true
+ :public
+ else
+ raise RDoc::Error, "Invalid visibility: #{tk.name}"
+ end
+
+ return vis_type, vis, singleton
+ end
+
+ ##
# Look for the first comment in a file that isn't a shebang line.
def collect_first_comment
@@ -209,6 +255,41 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Consumes trailing whitespace from the token stream
+
+ def consume_trailing_spaces # :nodoc:
+ get_tkread
+ skip_tkspace false
+ end
+
+ ##
+ # Creates a new attribute in +container+ with +name+.
+
+ def create_attr container, single, name, rw, comment # :nodoc:
+ att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
+ record_location att
+
+ container.add_attribute att
+ @stats.add_attribute att
+
+ att
+ end
+
+ ##
+ # Creates a module alias in +container+ at +rhs_name+ (or at the top-level
+ # for "::") with the name from +constant+.
+
+ def create_module_alias container, constant, rhs_name # :nodoc:
+ mod = if rhs_name =~ /^::/ then
+ @store.find_class_or_module rhs_name
+ else
+ container.find_module_named rhs_name
+ end
+
+ container.add_module_alias mod, constant.name, @top_level if mod
+ end
+
+ ##
# Aborts with +msg+
def error(msg)
@@ -265,10 +346,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
else
c = prev_container.add_module RDoc::NormalModule, name_t.name
c.ignore unless prev_container.document_children
+ @top_level.add_to_classes_or_modules c
c
end
- container.record_location @top_level
+ record_location container
get_tk
skip_tkspace false
@@ -285,17 +367,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Return a superclass, which can be either a constant of an expression
def get_class_specification
- tk = get_tk
- return 'self' if TkSELF === tk
- return '' if TkGVAR === tk
-
- res = ''
- while TkCOLON2 === tk or TkCOLON3 === tk or TkCONSTANT === tk do
- res += tk.name
- tk = get_tk
+ case peek_tk
+ when TkSELF then return 'self'
+ when TkGVAR then return ''
end
- unget_tk(tk)
+ res = get_constant
+
skip_tkspace false
get_tkread # empty out read buffer
@@ -326,9 +404,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
-# if res.empty?
-# warn("Unexpected token #{tk} in constant")
-# end
unget_tk(tk)
res
end
@@ -359,6 +434,68 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Little hack going on here. In the statement:
+ #
+ # f = 2*(1+yield)
+ #
+ # We see the RPAREN as the next token, so we need to exit early. This still
+ # won't catch all cases (such as "a = yield + 1"
+
+ def get_end_token tk # :nodoc:
+ case tk
+ when TkLPAREN, TkfLPAREN
+ TkRPAREN
+ when TkRPAREN
+ nil
+ else
+ TkNL
+ end
+ end
+
+ ##
+ # Retrieves the method container for a singleton method.
+
+ def get_method_container container, name_t # :nodoc:
+ prev_container = container
+ container = container.find_module_named(name_t.name)
+
+ unless container then
+ constant = prev_container.constants.find do |const|
+ const.name == name_t.name
+ end
+
+ if constant then
+ parse_method_dummy prev_container
+ return
+ end
+ end
+
+ unless container then
+ # TODO seems broken, should starting at Object in @store
+ obj = name_t.name.split("::").inject(Object) do |state, item|
+ state.const_get(item)
+ end rescue nil
+
+ type = obj.class == Class ? RDoc::NormalClass : RDoc::NormalModule
+
+ unless [Class, Module].include?(obj.class) then
+ warn("Couldn't find #{name_t.name}. Assuming it's a module")
+ end
+
+ if type == RDoc::NormalClass then
+ sclass = obj.superclass ? obj.superclass.name : nil
+ container = prev_container.add_class type, name_t.name, sclass
+ else
+ container = prev_container.add_module type, name_t.name
+ end
+
+ record_location container
+ end
+
+ container
+ end
+
+ ##
# Extracts a name or symbol from the token stream.
def get_symbol_or_name
@@ -385,6 +522,20 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
end
+ def stop_at_EXPR_END # :nodoc:
+ @scanner.lex_state == :EXPR_END || !@scanner.continue
+ end
+
+ ##
+ # Marks containers between +container+ and +ancestor+ as ignored
+
+ def suppress_parents container, ancestor # :nodoc:
+ while container and container != ancestor do
+ container.suppress unless container.documented?
+ container = container.parent
+ end
+ end
+
##
# Look for directives in a normal comment block:
#
@@ -450,16 +601,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
unget_tk tk
end
- att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
- att.record_location @top_level
+ att = create_attr context, single, name, rw, comment
att.offset = offset
att.line = line_no
read_documentation_modifiers att, RDoc::ATTR_MODIFIERS
-
- context.add_attribute att
-
- @stats.add_attribute att
else
warn "'attr' ignored - looks like a variable"
end
@@ -480,7 +626,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
# TODO In most other places we let the context keep track of document_self
# and add found items appropriately but here we do not. I'm not sure why.
- return unless tmp.document_self
+ return if @track_visibility and not tmp.document_self
case tk.name
when "attr_reader" then rw = "R"
@@ -491,13 +637,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
for name in args
- att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
- att.record_location @top_level
+ att = create_attr context, single, name, rw, comment
att.offset = offset
att.line = line_no
-
- context.add_attribute att
- @stats.add_attribute att
end
end
@@ -517,7 +659,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
new_name = get_symbol_or_name
- @scanner.instance_eval { @lex_state = EXPR_FNAME }
+ @scanner.lex_state = :EXPR_FNAME
skip_tkspace
if TkCOMMA === peek_tk then
@@ -533,7 +675,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
al = RDoc::Alias.new(get_tkread, old_name, new_name, comment,
single == SINGLE)
- al.record_location @top_level
+ record_location al
al.offset = offset
al.line = line_no
@@ -567,7 +709,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
when end_token
if end_token == TkRPAREN
nest -= 1
- break if @scanner.lex_state == EXPR_END and nest <= 0
+ break if @scanner.lex_state == :EXPR_END and nest <= 0
else
break unless @scanner.continue
end
@@ -579,9 +721,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
tk = get_tk
end
- res = get_tkread.tr("\n", " ").strip
- res = "" if res == ";"
- res
+
+ get_tkread_clean "\n", " "
end
##
@@ -594,79 +735,105 @@ class RDoc::Parser::Ruby < RDoc::Parser
declaration_context = container
container, name_t, given_name = get_class_or_module container
- case name_t
- when TkCONSTANT
- name = name_t.name
- superclass = '::Object'
-
- if given_name =~ /^::/ then
- declaration_context = @top_level
- given_name = $'
+ cls =
+ case name_t
+ when TkCONSTANT
+ parse_class_regular container, declaration_context, single,
+ name_t, given_name, comment
+ when TkLSHFT
+ case name = get_class_specification
+ when 'self', container.name
+ parse_statements container, SINGLE
+ return # don't update offset or line
+ else
+ parse_class_singleton container, name, comment
+ end
+ else
+ warn "Expected class name or '<<'. Got #{name_t.class}: #{name_t.text.inspect}"
+ return
end
- if TkLT === peek_tk then
- get_tk
- skip_tkspace
- superclass = get_class_specification
- superclass = '(unknown)' if superclass.empty?
- end
+ cls.offset = offset
+ cls.line = line_no
+
+ cls
+ end
- cls_type = single == SINGLE ? RDoc::SingleClass : RDoc::NormalClass
- cls = declaration_context.add_class cls_type, given_name, superclass
- cls.ignore unless container.document_children
+ ##
+ # Parses and creates a regular class
- read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
- cls.record_location @top_level
- cls.offset = offset
- cls.line = line_no
+ def parse_class_regular container, declaration_context, single, # :nodoc:
+ name_t, given_name, comment
+ superclass = '::Object'
- cls.add_comment comment, @top_level
+ if given_name =~ /^::/ then
+ declaration_context = @top_level
+ given_name = $'
+ end
- @top_level.add_to_classes_or_modules cls
- @stats.add_class cls
+ if TkLT === peek_tk then
+ get_tk
+ skip_tkspace
+ superclass = get_class_specification
+ superclass = '(unknown)' if superclass.empty?
+ end
- parse_statements cls
- when TkLSHFT
- case name = get_class_specification
- when 'self', container.name
- parse_statements container, SINGLE
- else
- other = @store.find_class_named name
+ cls_type = single == SINGLE ? RDoc::SingleClass : RDoc::NormalClass
+ cls = declaration_context.add_class cls_type, given_name, superclass
+ cls.ignore unless container.document_children
- unless other then
- if name =~ /^::/ then
- name = $'
- container = @top_level
- end
+ read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
+ record_location cls
- other = container.add_module RDoc::NormalModule, name
- other.record_location @top_level
- other.offset = offset
- other.line = line_no
+ cls.add_comment comment, @top_level
- # class << $gvar
- other.ignore if name.empty?
+ @top_level.add_to_classes_or_modules cls
+ @stats.add_class cls
- other.add_comment comment, @top_level
- end
+ suppress_parents container, declaration_context unless cls.document_self
- # notify :nodoc: all if not a constant-named class/module
- # (and remove any comment)
- unless name =~ /\A(::)?[A-Z]/ then
- other.document_self = nil
- other.document_children = false
- other.clear_comment
- end
+ parse_statements cls
+
+ cls
+ end
+
+ ##
+ # Parses a singleton class in +container+ with the given +name+ and
+ # +comment+.
- @top_level.add_to_classes_or_modules other
- @stats.add_class other
+ def parse_class_singleton container, name, comment # :nodoc:
+ other = @store.find_class_named name
- read_documentation_modifiers other, RDoc::CLASS_MODIFIERS
- parse_statements(other, SINGLE)
+ unless other then
+ if name =~ /^::/ then
+ name = $'
+ container = @top_level
end
- else
- warn("Expected class name or '<<'. Got #{name_t.class}: #{name_t.text.inspect}")
+
+ other = container.add_module RDoc::NormalModule, name
+ record_location other
+
+ # class << $gvar
+ other.ignore if name.empty?
+
+ other.add_comment comment, @top_level
+ end
+
+ # notify :nodoc: all if not a constant-named class/module
+ # (and remove any comment)
+ unless name =~ /\A(::)?[A-Z]/ then
+ other.document_self = nil
+ other.document_children = false
+ other.clear_comment
end
+
+ @top_level.add_to_classes_or_modules other
+ @stats.add_class other
+
+ read_documentation_modifiers other, RDoc::CLASS_MODIFIERS
+ parse_statements(other, SINGLE)
+
+ other
end
##
@@ -674,6 +841,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
# true, no found constants will be added to RDoc.
def parse_constant container, tk, comment, ignore_constants = false
+ prev_container = container
offset = tk.seek
line_no = tk.line_no
@@ -696,25 +864,44 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
unless TkASSIGN === eq_tk then
+ suppress_parents container, prev_container
+
unget_tk eq_tk
return false
end
+ if TkGT === peek_tk then
+ unget_tk eq_tk
+ return
+ end
+
value = ''
con = RDoc::Constant.new name, value, comment
- nest = 0
- get_tkread
- tk = get_tk
+ body = parse_constant_body container, con
- if TkGT === tk then
- unget_tk tk
- unget_tk eq_tk
- return false
- end
+ return unless body
+
+ value.replace body
+ record_location con
+ con.offset = offset
+ con.line = line_no
+ read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
+
+ @stats.add_constant con
+ con = container.add_constant con
+
+ true
+ end
+ def parse_constant_body container, constant # :nodoc:
+ nest = 0
rhs_name = ''
+ get_tkread
+
+ tk = get_tk
+
loop do
case tk
when TkSEMICOLON then
@@ -725,30 +912,22 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkRPAREN, TkRBRACE, TkRBRACK, TkEND then
nest -= 1
when TkCOMMENT then
- if nest <= 0 &&
- (@scanner.lex_state == EXPR_END || !@scanner.continue) then
+ if nest <= 0 and stop_at_EXPR_END then
unget_tk tk
break
else
unget_tk tk
- read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
+ read_documentation_modifiers constant, RDoc::CONSTANT_MODIFIERS
end
when TkCONSTANT then
rhs_name << tk.name
if nest <= 0 and TkNL === peek_tk then
- mod = if rhs_name =~ /^::/ then
- @store.find_class_or_module rhs_name
- else
- container.find_module_named rhs_name
- end
-
- container.add_module_alias mod, name, @top_level if mod
+ create_module_alias container, constant, rhs_name
break
end
when TkNL then
- if nest <= 0 &&
- (@scanner.lex_state == EXPR_END || !@scanner.continue) then
+ if nest <= 0 and stop_at_EXPR_END then
unget_tk tk
break
end
@@ -760,19 +939,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
- res = get_tkread.gsub(/^[ \t]+/, '').strip
- res = "" if res == ";"
-
- value.replace res
- con.record_location @top_level
- con.offset = offset
- con.line = line_no
- read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
-
- @stats.add_constant con
- con = container.add_constant con
-
- true
+ get_tkread_clean(/^[ \t]+/, '')
end
##
@@ -789,56 +956,72 @@ class RDoc::Parser::Ruby < RDoc::Parser
singleton = !!text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
- # REFACTOR
- if text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
- name = $1 unless $1.empty?
+ co =
+ if text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
+ parse_comment_ghost container, text, $1, column, line_no, comment
+ elsif text.sub!(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
+ parse_comment_attr container, $1, $3, comment
+ end
- meth = RDoc::GhostMethod.new get_tkread, name
- meth.record_location @top_level
- meth.singleton = singleton
- meth.offset = offset
- meth.line = line_no
+ if co then
+ co.singleton = singleton
+ co.offset = offset
+ co.line = line_no
+ end
- meth.start_collecting_tokens
- indent = TkSPACE.new 0, 1, 1
- indent.set_text " " * column
+ true
+ end
- position_comment = TkCOMMENT.new 0, line_no, 1
- position_comment.set_text "# File #{@top_level.relative_name}, line #{line_no}"
- meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
+ ##
+ # Parse a comment that is describing an attribute in +container+ with the
+ # given +name+ and +comment+.
- meth.params = ''
+ def parse_comment_attr container, type, name, comment # :nodoc:
+ return if name.empty?
- comment.normalize
- comment.extract_call_seq meth
+ rw = case type
+ when 'attr_reader' then 'R'
+ when 'attr_writer' then 'W'
+ else 'RW'
+ end
- return unless meth.name
+ create_attr container, NORMAL, name, rw, comment
+ end
- container.add_method meth
+ def parse_comment_ghost container, text, name, column, line_no, # :nodoc:
+ comment
+ name = nil if name.empty?
- meth.comment = comment
+ meth = RDoc::GhostMethod.new get_tkread, name
+ record_location meth
- @stats.add_method meth
- elsif text.sub!(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
- rw = case $1
- when 'attr_reader' then 'R'
- when 'attr_writer' then 'W'
- else 'RW'
- end
+ meth.start_collecting_tokens
+ indent = TkSPACE.new 0, 1, 1
+ indent.set_text " " * column
- name = $3 unless $3.empty?
+ position_comment = TkCOMMENT.new 0, line_no, 1
+ position_comment.set_text "# File #{@top_level.relative_name}, line #{line_no}"
+ meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
- # TODO authorize 'singleton-attr...'?
- att = RDoc::Attr.new get_tkread, name, rw, comment
- att.record_location @top_level
- att.offset = offset
- att.line = line_no
+ meth.params =
+ if text.sub!(/^#\s+:?args?:\s*(.*?)\s*$/i, '') then
+ $1
+ else
+ ''
+ end
- container.add_attribute att
- @stats.add_attribute att
- end
+ comment.normalize
+ comment.extract_call_seq meth
- true
+ return unless meth.name
+
+ container.add_method meth
+
+ meth.comment = comment
+
+ @stats.add_method meth
+
+ meth
end
##
@@ -853,7 +1036,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
name, = signature.split %r%[ \(]%, 2
meth = RDoc::GhostMethod.new get_tkread, name
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
@@ -879,17 +1062,18 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Parses an +include+ in +context+ with +comment+
+ # Parses an +include+ or +extend+, indicated by the +klass+ and adds it to
+ # +container+ # with +comment+
- def parse_include context, comment
+ def parse_extend_or_include klass, container, comment # :nodoc:
loop do
skip_tkspace_comment
name = get_constant_with_optional_parens
unless name.empty? then
- incl = context.add_include RDoc::Include.new(name, comment)
- incl.record_location @top_level
+ obj = container.add klass, name, comment
+ record_location obj
end
return unless TkCOMMA === peek_tk
@@ -899,23 +1083,40 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Parses an +extend+ in +context+ with +comment+
-
- def parse_extend context, comment
- loop do
- skip_tkspace_comment
-
- name = get_constant_with_optional_parens
+ # Parses identifiers that can create new methods or change visibility.
+ #
+ # Returns true if the comment was not consumed.
- unless name.empty? then
- incl = context.add_extend RDoc::Extend.new(name, comment)
- incl.record_location @top_level
+ def parse_identifier container, single, tk, comment # :nodoc:
+ case tk.name
+ when 'private', 'protected', 'public', 'private_class_method',
+ 'public_class_method', 'module_function' then
+ parse_visibility container, single, tk
+ return true
+ when 'attr' then
+ parse_attr container, single, tk, comment
+ when /^attr_(reader|writer|accessor)$/ then
+ parse_attr_accessor container, single, tk, comment
+ when 'alias_method' then
+ parse_alias container, single, tk, comment
+ when 'require', 'include' then
+ # ignore
+ else
+ if comment.text =~ /\A#\#$/ then
+ case comment.text
+ when /^# +:?attr(_reader|_writer|_accessor)?:/ then
+ parse_meta_attr container, single, tk, comment
+ else
+ method = parse_meta_method container, single, tk, comment
+ method.params = container.params if
+ container.params
+ method.block_params = container.block_params if
+ container.block_params
+ end
end
-
- return unless TkCOMMA === peek_tk
-
- get_tk
end
+
+ false
end
##
@@ -966,19 +1167,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
if name then
- att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
- att.record_location @top_level
-
- context.add_attribute att
- @stats.add_attribute att
+ att = create_attr context, single, name, rw, comment
else
args.each do |attr_name|
- att = RDoc::Attr.new(get_tkread, attr_name, rw, comment,
- single == SINGLE)
- att.record_location @top_level
-
- context.add_attribute att
- @stats.add_attribute att
+ att = create_attr context, single, attr_name, rw, comment
end
end
@@ -1001,28 +1193,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
singleton = !!comment.text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
- if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
- name = $1 unless $1.empty?
- end
+ name = parse_meta_method_name comment, tk
- if name.nil? then
- name_t = get_tk
- case name_t
- when TkSYMBOL then
- name = name_t.text[1..-1]
- when TkSTRING then
- name = name_t.value[1..-2]
- when TkASSIGN then # ignore
- remove_token_listener self
- return
- else
- warn "unknown name token #{name_t.inspect} for meta-method '#{tk.name}'"
- name = 'unknown'
- end
- end
+ return unless name
meth = RDoc::MetaMethod.new get_tkread, name
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
meth.singleton = singleton
@@ -1038,6 +1214,46 @@ class RDoc::Parser::Ruby < RDoc::Parser
meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
meth.add_tokens @token_stream
+ parse_meta_method_params container, single, meth, tk, comment
+
+ meth.comment = comment
+
+ @stats.add_method meth
+
+ meth
+ end
+
+ ##
+ # Parses the name of a metaprogrammed method. +comment+ is used to
+ # determine the name while +tk+ is used in an error message if the name
+ # cannot be determined.
+
+ def parse_meta_method_name comment, tk # :nodoc:
+ if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
+ return $1 unless $1.empty?
+ end
+
+ name_t = get_tk
+
+ case name_t
+ when TkSYMBOL then
+ name_t.text[1..-1]
+ when TkSTRING then
+ name_t.value[1..-2]
+ when TkASSIGN then # ignore
+ remove_token_listener self
+
+ nil
+ else
+ warn "unknown name token #{name_t.inspect} for meta-method '#{tk.name}'"
+ 'unknown'
+ end
+ end
+
+ ##
+ # Parses the parameters and block for a meta-programmed method.
+
+ def parse_meta_method_params container, single, meth, tk, comment # :nodoc:
token_listener meth do
meth.params = ''
@@ -1064,20 +1280,14 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
end
end
-
- meth.comment = comment
-
- @stats.add_method meth
-
- meth
end
##
# Parses a normal method defined by +def+
def parse_method(container, single, tk, comment)
- added_container = nil
- meth = nil
+ singleton = nil
+ added_container = false
name = nil
column = tk.char_no
offset = tk.seek
@@ -1087,110 +1297,17 @@ class RDoc::Parser::Ruby < RDoc::Parser
add_token tk
token_listener self do
- @scanner.instance_eval do @lex_state = EXPR_FNAME end
-
- skip_tkspace
- name_t = get_tk
- back_tk = skip_tkspace
- meth = nil
- added_container = false
-
- case dot = get_tk
- when TkDOT, TkCOLON2 then
- @scanner.instance_eval do @lex_state = EXPR_FNAME end
- skip_tkspace
- name_t2 = get_tk
-
- case name_t
- when TkSELF, TkMOD then
- name = case name_t2
- # NOTE: work around '[' being consumed early and not being
- # re-tokenized as a TkAREF
- when TkfLBRACK then
- get_tk
- '[]'
- else
- name_t2.name
- end
- when TkCONSTANT then
- name = name_t2.name
- prev_container = container
- container = container.find_module_named(name_t.name)
-
- unless container then
- constant = prev_container.constants.find do |const|
- const.name == name_t.name
- end
-
- if constant then
- parse_method_dummy prev_container
- return
- end
- end
-
- unless container then
- added_container = true
- obj = name_t.name.split("::").inject(Object) do |state, item|
- state.const_get(item)
- end rescue nil
-
- type = obj.class == Class ? RDoc::NormalClass : RDoc::NormalModule
-
- unless [Class, Module].include?(obj.class) then
- warn("Couldn't find #{name_t.name}. Assuming it's a module")
- end
-
- if type == RDoc::NormalClass then
- sclass = obj.superclass ? obj.superclass.name : nil
- container = prev_container.add_class type, name_t.name, sclass
- else
- container = prev_container.add_module type, name_t.name
- end
-
- container.record_location @top_level
- end
- when TkIDENTIFIER, TkIVAR, TkGVAR then
- parse_method_dummy container
- return
- when TkTRUE, TkFALSE, TkNIL then
- klass_name = "#{name_t.name.capitalize}Class"
- container = @store.find_class_named klass_name
- container ||= @top_level.add_class RDoc::NormalClass, klass_name
-
- name = name_t2.name
- else
- warn "unexpected method name token #{name_t.inspect}"
- # break
- skip_method container
- return
- end
+ prev_container = container
+ name, container, singleton = parse_method_name container
+ added_container = container != prev_container
+ end
- meth = RDoc::AnyMethod.new(get_tkread, name)
- meth.singleton = true
- else
- unget_tk dot
- back_tk.reverse_each do |token|
- unget_tk token
- end
+ return unless name
- name = case name_t
- when TkSTAR, TkAMPER then
- name_t.text
- else
- unless name_t.respond_to? :name then
- warn "expected method name token, . or ::, got #{name_t.inspect}"
- skip_method container
- return
- end
- name_t.name
- end
-
- meth = RDoc::AnyMethod.new get_tkread, name
- meth.singleton = (single == SINGLE)
- end
- end
+ meth = RDoc::AnyMethod.new get_tkread, name
+ meth.singleton = singleton
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
@@ -1203,11 +1320,25 @@ class RDoc::Parser::Ruby < RDoc::Parser
meth.add_tokens [token, NEWLINE_TOKEN, indent]
meth.add_tokens @token_stream
+ parse_method_params_and_body container, single, meth, added_container
+
+ comment.normalize
+ comment.extract_call_seq meth
+
+ meth.comment = comment
+
+ @stats.add_method meth
+ end
+
+ ##
+ # Parses the parameters and body of +meth+
+
+ def parse_method_params_and_body container, single, meth, added_container
token_listener meth do
- @scanner.instance_eval do @continue = false end
+ @scanner.continue = false
parse_method_parameters meth
- if meth.document_self then
+ if meth.document_self or not @track_visibility then
container.add_method meth
elsif added_container then
container.document_self = false
@@ -1216,7 +1347,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Having now read the method parameters and documentation modifiers, we
# now know whether we have to rename #initialize to ::new
- if name == "initialize" && !meth.singleton then
+ if meth.name == "initialize" && !meth.singleton then
if meth.dont_rename_initialize then
meth.visibility = :protected
else
@@ -1228,13 +1359,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
parse_statements container, single, meth
end
-
- comment.normalize
- comment.extract_call_seq meth
-
- meth.comment = comment
-
- @stats.add_method meth
end
##
@@ -1248,26 +1372,115 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Parses the name of a method in +container+.
+ #
+ # Returns the method name, the container it is in (for def Foo.name) and if
+ # it is a singleton or regular method.
+
+ def parse_method_name container # :nodoc:
+ @scanner.lex_state = :EXPR_FNAME
+
+ skip_tkspace
+ name_t = get_tk
+ back_tk = skip_tkspace
+ singleton = false
+
+ case dot = get_tk
+ when TkDOT, TkCOLON2 then
+ singleton = true
+
+ name, container = parse_method_name_singleton container, name_t
+ else
+ unget_tk dot
+ back_tk.reverse_each do |token|
+ unget_tk token
+ end
+
+ name = parse_method_name_regular container, name_t
+ end
+
+ return name, container, singleton
+ end
+
+ ##
+ # For the given +container+ and initial name token +name_t+ the method name
+ # is parsed from the token stream for a regular method.
+
+ def parse_method_name_regular container, name_t # :nodoc:
+ case name_t
+ when TkSTAR, TkAMPER then
+ name_t.text
+ else
+ unless name_t.respond_to? :name then
+ warn "expected method name token, . or ::, got #{name_t.inspect}"
+ skip_method container
+ return
+ end
+ name_t.name
+ end
+ end
+
+ ##
+ # For the given +container+ and initial name token +name_t+ the method name
+ # and the new +container+ (if necessary) are parsed from the token stream
+ # for a singleton method.
+
+ def parse_method_name_singleton container, name_t # :nodoc:
+ @scanner.lex_state = :EXPR_FNAME
+ skip_tkspace
+ name_t2 = get_tk
+
+ name =
+ case name_t
+ when TkSELF, TkMOD then
+ case name_t2
+ # NOTE: work around '[' being consumed early and not being re-tokenized
+ # as a TkAREF
+ when TkfLBRACK then
+ get_tk
+ '[]'
+ else
+ name_t2.name
+ end
+ when TkCONSTANT then
+ name = name_t2.name
+
+ container = get_method_container container, name_t
+
+ return unless container
+
+ name
+ when TkIDENTIFIER, TkIVAR, TkGVAR then
+ parse_method_dummy container
+
+ nil
+ when TkTRUE, TkFALSE, TkNIL then
+ klass_name = "#{name_t.name.capitalize}Class"
+ container = @store.find_class_named klass_name
+ container ||= @top_level.add_class RDoc::NormalClass, klass_name
+
+ name_t2.name
+ else
+ warn "unexpected method name token #{name_t.inspect}"
+ # break
+ skip_method container
+
+ nil
+ end
+
+ return name, container
+ end
+
+ ##
# Extracts +yield+ parameters from +method+
def parse_method_or_yield_parameters(method = nil,
modifiers = RDoc::METHOD_MODIFIERS)
skip_tkspace false
tk = get_tk
+ end_token = get_end_token tk
+ return '' unless end_token
- # Little hack going on here. In the statement
- # f = 2*(1+yield)
- # We see the RPAREN as the next token, so we need
- # to exit early. This still won't catch all cases
- # (such as "a = yield + 1"
- end_token = case tk
- when TkLPAREN, TkfLPAREN
- TkRPAREN
- when TkRPAREN
- return ""
- else
- TkNL
- end
nest = 0
loop do
@@ -1306,9 +1519,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
- res = get_tkread.gsub(/\s+/, ' ').strip
- res = '' if res == ';'
- res
+ get_tkread_clean(/\s+/, ' ')
end
##
@@ -1341,13 +1552,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
mod = container.add_module RDoc::NormalModule, name
mod.ignore unless container.document_children
- mod.record_location @top_level
+ record_location mod
read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS
mod.add_comment comment, @top_level
parse_statements mod
- @top_level.add_to_classes_or_modules mod
@stats.add_module mod
end
@@ -1443,6 +1653,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
look_for_directives_in container, comment
if container.done_documenting then
+ throw :eof if RDoc::TopLevel === container
container.ongoing_visibility = save_visibility
end
end
@@ -1504,42 +1715,16 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkIDENTIFIER then
if nest == 1 and current_method.nil? then
- case tk.name
- when 'private', 'protected', 'public', 'private_class_method',
- 'public_class_method', 'module_function' then
- parse_visibility container, single, tk
- keep_comment = true
- when 'attr' then
- parse_attr container, single, tk, comment
- when /^attr_(reader|writer|accessor)$/ then
- parse_attr_accessor container, single, tk, comment
- when 'alias_method' then
- parse_alias container, single, tk, comment
- when 'require', 'include' then
- # ignore
- else
- if comment.text =~ /\A#\#$/ then
- case comment.text
- when /^# +:?attr(_reader|_writer|_accessor)?:/ then
- parse_meta_attr container, single, tk, comment
- else
- method = parse_meta_method container, single, tk, comment
- method.params = container.params if
- container.params
- method.block_params = container.block_params if
- container.block_params
- end
- end
- end
+ keep_comment = parse_identifier container, single, tk, comment
end
case tk.name
when "require" then
parse_require container, comment
when "include" then
- parse_include container, comment
+ parse_extend_or_include RDoc::Include, container, comment
when "extend" then
- parse_extend container, comment
+ parse_extend_or_include RDoc::Extend, container, comment
end
when TkEND then
@@ -1570,10 +1755,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
container.block_params = nil
end
- begin
- get_tkread
- skip_tkspace false
- end while peek_tk == TkNL
+ consume_trailing_spaces
end
container.params = nil
@@ -1584,50 +1766,70 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Parse up to +no+ symbol arguments
def parse_symbol_arg(no = nil)
- args = []
-
skip_tkspace_comment
case tk = get_tk
when TkLPAREN
- loop do
- skip_tkspace_comment
- if tk1 = parse_symbol_in_arg
- args.push tk1
- break if no and args.size >= no
- end
+ parse_symbol_arg_paren no
+ else
+ parse_symbol_arg_space no, tk
+ end
+ end
- skip_tkspace_comment
- case tk2 = get_tk
- when TkRPAREN
- break
- when TkCOMMA
- else
- warn("unexpected token: '#{tk2.inspect}'") if $DEBUG_RDOC
- break
- end
+ ##
+ # Parses up to +no+ symbol arguments surrounded by () and places them in
+ # +args+.
+
+ def parse_symbol_arg_paren no # :nodoc:
+ args = []
+
+ loop do
+ skip_tkspace_comment
+ if tk1 = parse_symbol_in_arg
+ args.push tk1
+ break if no and args.size >= no
end
- else
- unget_tk tk
- if tk = parse_symbol_in_arg
- args.push tk
- return args if no and args.size >= no
+
+ skip_tkspace_comment
+ case tk2 = get_tk
+ when TkRPAREN
+ break
+ when TkCOMMA
+ else
+ warn("unexpected token: '#{tk2.inspect}'") if $DEBUG_RDOC
+ break
end
+ end
- loop do
- skip_tkspace false
+ args
+ end
- tk1 = get_tk
- unless TkCOMMA === tk1 then
- unget_tk tk1
- break
- end
+ ##
+ # Parses up to +no+ symbol arguments separated by spaces and places them in
+ # +args+.
- skip_tkspace_comment
- if tk = parse_symbol_in_arg
- args.push tk
- break if no and args.size >= no
- end
+ def parse_symbol_arg_space no, tk # :nodoc:
+ args = []
+
+ unget_tk tk
+ if tk = parse_symbol_in_arg
+ args.push tk
+ return args if no and args.size >= no
+ end
+
+ loop do
+ skip_tkspace false
+
+ tk1 = get_tk
+ unless TkCOMMA === tk1 then
+ unget_tk tk1
+ break
+ end
+
+ skip_tkspace_comment
+ if tk = parse_symbol_in_arg
+ args.push tk
+ break if no and args.size >= no
end
end
@@ -1659,6 +1861,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
look_for_directives_in container, comment
+ throw :eof if container.done_documenting
+
@markup = comment.format
# HACK move if to RDoc::Context#comment=
@@ -1673,24 +1877,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
def parse_visibility(container, single, tk)
singleton = (single == SINGLE)
- vis_type = tk.name
-
- vis = case vis_type
- when 'private' then :private
- when 'protected' then :protected
- when 'public' then :public
- when 'private_class_method' then
- singleton = true
- :private
- when 'public_class_method' then
- singleton = true
- :public
- when 'module_function' then
- singleton = true
- :public
- else
- raise RDoc::Error, "Invalid visibility: #{tk.name}"
- end
+ vis_type, vis, singleton = get_visibility_information tk
skip_tkspace_comment false
@@ -1703,45 +1890,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkNL, TkUNLESS_MOD, TkIF_MOD, TkSEMICOLON then
container.ongoing_visibility = vis
else
- new_methods = []
-
- case vis_type
- when 'module_function' then
- args = parse_symbol_arg
- container.set_visibility_for args, :private, false
-
- container.methods_matching args do |m|
- s_m = m.dup
- s_m.record_location @top_level
- s_m.singleton = true
- new_methods << s_m
- end
- when 'public_class_method', 'private_class_method' then
- args = parse_symbol_arg
-
- container.methods_matching args, true do |m|
- if m.parent != container then
- m = m.dup
- m.record_location @top_level
- new_methods << m
- end
-
- m.visibility = vis
- end
- else
- args = parse_symbol_arg
- container.set_visibility_for args, vis, singleton
- end
-
- new_methods.each do |method|
- case method
- when RDoc::AnyMethod then
- container.add_method method
- when RDoc::Attr then
- container.add_attribute method
- end
- method.visibility = vis
- end
+ update_visibility container, vis_type, vis, singleton
end
end
@@ -1752,7 +1901,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
return if method.block_params
get_tkread
- @scanner.instance_eval { @continue = false }
+ @scanner.continue = false
method.block_params = parse_method_or_yield_parameters
end
@@ -1777,7 +1926,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
tokens << tk
case tk
- when TkNL then return
+ when TkNL, TkDEF then
+ return
when TkCOMMENT then
return unless tk.text =~ /\s*:?([\w-]+):\s*(.*)/
@@ -1817,6 +1967,19 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Records the location of this +container+ in the file for this parser and
+ # adds it to the list of classes and modules in the file.
+
+ def record_location container # :nodoc:
+ case container
+ when RDoc::ClassModule then
+ @top_level.add_to_classes_or_modules container
+ end
+
+ container.record_location @top_level
+ end
+
+ ##
# Removes private comments from +comment+
#--
# TODO remove
@@ -1874,16 +2037,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
def skip_optional_do_after_expression
skip_tkspace false
tk = get_tk
- case tk
- when TkLPAREN, TkfLPAREN then
- end_token = TkRPAREN
- else
- end_token = TkNL
- end
+ end_token = get_end_token tk
b_nest = 0
nest = 0
- @scanner.instance_eval { @continue = false }
+ @scanner.continue = false
loop do
case tk
@@ -1900,7 +2058,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
when end_token then
if end_token == TkRPAREN
nest -= 1
- break if @scanner.lex_state == EXPR_END and nest.zero?
+ break if @scanner.lex_state == :EXPR_END and nest.zero?
else
break unless @scanner.continue
end
@@ -1947,6 +2105,51 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Updates visibility in +container+ from +vis_type+ and +vis+.
+
+ def update_visibility container, vis_type, vis, singleton # :nodoc:
+ new_methods = []
+
+ case vis_type
+ when 'module_function' then
+ args = parse_symbol_arg
+ container.set_visibility_for args, :private, false
+
+ container.methods_matching args do |m|
+ s_m = m.dup
+ record_location s_m
+ s_m.singleton = true
+ new_methods << s_m
+ end
+ when 'public_class_method', 'private_class_method' then
+ args = parse_symbol_arg
+
+ container.methods_matching args, true do |m|
+ if m.parent != container then
+ m = m.dup
+ record_location m
+ new_methods << m
+ end
+
+ m.visibility = vis
+ end
+ else
+ args = parse_symbol_arg
+ container.set_visibility_for args, vis, singleton
+ end
+
+ new_methods.each do |method|
+ case method
+ when RDoc::AnyMethod then
+ container.add_method method
+ when RDoc::Attr then
+ container.add_attribute method
+ end
+ method.visibility = vis
+ end
+ end
+
+ ##
# Prints +message+ to +$stderr+ unless we're being quiet
def warn message
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb
index bd08677fcf..d031b76416 100644
--- a/lib/rdoc/rd/block_parser.rb
+++ b/lib/rdoc/rd/block_parser.rb
@@ -1,7 +1,7 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.9
-# from Racc grammar file "".
+# from Racc grammer file "".
#
require 'racc/parser.rb'
@@ -253,7 +253,7 @@ def next_token # :nodoc:
[:STRINGLINE, line]
end
else
- raise "[BUG] parsing error may occurred."
+ raise "[BUG] parsing error may occured."
end
end
@@ -677,54 +677,54 @@ Racc_debug_parser = false
# reduce 0 omitted
def _reduce_1(val, _values, result)
- result = RDoc::Markup::Document.new(*val[0])
+ result = RDoc::Markup::Document.new(*val[0])
result
end
def _reduce_2(val, _values, result)
- raise ParseError, "file empty"
+ raise ParseError, "file empty"
result
end
def _reduce_3(val, _values, result)
- result = val[0].concat val[1]
+ result = val[0].concat val[1]
result
end
def _reduce_4(val, _values, result)
- result = val[0]
+ result = val[0]
result
end
def _reduce_5(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_6(val, _values, result)
- result = val
+ result = val
result
end
# reduce 7 omitted
def _reduce_8(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_9(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_10(val, _values, result)
- result = [RDoc::Markup::BlankLine.new]
+ result = [RDoc::Markup::BlankLine.new]
result
end
def _reduce_11(val, _values, result)
- result = val[0].parts
+ result = val[0].parts
result
end
@@ -732,30 +732,30 @@ def _reduce_12(val, _values, result)
# val[0] is like [level, title]
title = @inline_parser.parse(val[0][1])
result = RDoc::Markup::Heading.new(val[0][0], title)
-
+
result
end
def _reduce_13(val, _values, result)
result = RDoc::Markup::Include.new val[0], @include_path
-
+
result
end
def _reduce_14(val, _values, result)
# val[0] is Array of String
result = paragraph val[0]
-
+
result
end
def _reduce_15(val, _values, result)
- result << val[1].rstrip
+ result << val[1].rstrip
result
end
def _reduce_16(val, _values, result)
- result = [val[0].rstrip]
+ result = [val[0].rstrip]
result
end
@@ -766,7 +766,7 @@ def _reduce_17(val, _values, result)
# imform to lexer.
@in_verbatim = false
-
+
result
end
@@ -777,25 +777,25 @@ def _reduce_18(val, _values, result)
# imform to lexer.
@in_verbatim = false
-
+
result
end
def _reduce_19(val, _values, result)
result << val[1]
-
+
result
end
def _reduce_20(val, _values, result)
result.concat val[2]
-
+
result
end
def _reduce_21(val, _values, result)
result << "\n"
-
+
result
end
@@ -803,7 +803,7 @@ def _reduce_22(val, _values, result)
result = val
# inform to lexer.
@in_verbatim = true
-
+
result
end
@@ -817,89 +817,89 @@ end
def _reduce_27(val, _values, result)
result = val[0]
-
+
result
end
def _reduce_28(val, _values, result)
result = val[1]
-
+
result
end
def _reduce_29(val, _values, result)
result = val[1].push(val[2])
-
+
result
end
def _reduce_30(val, _values, result)
- result = val[0] << val[1]
+ result = val[0] << val[1]
result
end
def _reduce_31(val, _values, result)
- result = [val[0]]
+ result = [val[0]]
result
end
def _reduce_32(val, _values, result)
result = RDoc::Markup::List.new :BULLET, *val[0]
-
+
result
end
def _reduce_33(val, _values, result)
- result.push(val[1])
+ result.push(val[1])
result
end
def _reduce_34(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_35(val, _values, result)
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
-
+
result
end
def _reduce_36(val, _values, result)
result = RDoc::Markup::List.new :NUMBER, *val[0]
-
+
result
end
def _reduce_37(val, _values, result)
- result.push(val[1])
+ result.push(val[1])
result
end
def _reduce_38(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_39(val, _values, result)
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
-
+
result
end
def _reduce_40(val, _values, result)
result = RDoc::Markup::List.new :NOTE, *val[0]
-
+
result
end
def _reduce_41(val, _values, result)
- result.push(val[1])
+ result.push(val[1])
result
end
def _reduce_42(val, _values, result)
- result = val
+ result = val
result
end
@@ -907,77 +907,77 @@ def _reduce_43(val, _values, result)
term = @inline_parser.parse val[0].strip
result = RDoc::Markup::ListItem.new term, *val[1]
-
+
result
end
def _reduce_44(val, _values, result)
result = RDoc::Markup::List.new :LABEL, *val[0]
-
+
result
end
def _reduce_45(val, _values, result)
- result.push(val[1])
+ result.push(val[1])
result
end
def _reduce_46(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_47(val, _values, result)
result = RDoc::Markup::ListItem.new "<tt>#{val[0].strip}</tt>", *val[1]
-
+
result
end
def _reduce_48(val, _values, result)
result = [val[1]].concat(val[2])
-
+
result
end
def _reduce_49(val, _values, result)
result = [val[1]]
-
+
result
end
def _reduce_50(val, _values, result)
result = val[2]
-
+
result
end
def _reduce_51(val, _values, result)
result = []
-
+
result
end
def _reduce_52(val, _values, result)
- result.concat val[1]
+ result.concat val[1]
result
end
# reduce 53 omitted
def _reduce_54(val, _values, result)
- result = val
+ result = val
result
end
def _reduce_55(val, _values, result)
- result = val
+ result = val
result
end
# reduce 56 omitted
def _reduce_57(val, _values, result)
- result = []
+ result = []
result
end
@@ -991,58 +991,58 @@ end
def _reduce_62(val, _values, result)
result = paragraph [val[0]].concat(val[1])
-
+
result
end
def _reduce_63(val, _values, result)
result = paragraph [val[0]]
-
+
result
end
def _reduce_64(val, _values, result)
result = paragraph [val[0]].concat(val[1])
-
+
result
end
def _reduce_65(val, _values, result)
result = paragraph [val[0]]
-
+
result
end
def _reduce_66(val, _values, result)
result = [val[0]].concat(val[1])
-
+
result
end
def _reduce_67(val, _values, result)
- result.concat val[1]
+ result.concat val[1]
result
end
def _reduce_68(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
def _reduce_69(val, _values, result)
- result = val
+ result = val
result
end
# reduce 70 omitted
def _reduce_71(val, _values, result)
- result = []
+ result = []
result
end
def _reduce_72(val, _values, result)
- result = []
+ result = []
result
end
diff --git a/lib/rdoc/rd/inline_parser.rb b/lib/rdoc/rd/inline_parser.rb
index 693eecda21..382922b4d4 100644
--- a/lib/rdoc/rd/inline_parser.rb
+++ b/lib/rdoc/rd/inline_parser.rb
@@ -1,7 +1,7 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.9
-# from Racc grammar file "".
+# from Racc grammer file "".
#
require 'racc/parser.rb'
@@ -732,12 +732,12 @@ Racc_debug_parser = false
# reduce 1 omitted
def _reduce_2(val, _values, result)
- result.append val[1]
+ result.append val[1]
result
end
def _reduce_3(val, _values, result)
- result = val[0]
+ result = val[0]
result
end
@@ -762,28 +762,28 @@ end
def _reduce_13(val, _values, result)
content = val[1]
result = inline "<em>#{content}</em>", content
-
+
result
end
def _reduce_14(val, _values, result)
content = val[1]
result = inline "<code>#{content}</code>", content
-
+
result
end
def _reduce_15(val, _values, result)
content = val[1]
result = inline "+#{content}+", content
-
+
result
end
def _reduce_16(val, _values, result)
content = val[1]
result = inline "<tt>#{content}</tt>", content
-
+
result
end
@@ -791,13 +791,13 @@ def _reduce_17(val, _values, result)
label = val[1]
@block_parser.add_label label.reference
result = "<span id=\"label-#{label}\">#{label}</span>"
-
+
result
end
def _reduce_18(val, _values, result)
result = "{#{val[1]}}[#{val[2].join}]"
-
+
result
end
@@ -805,13 +805,13 @@ def _reduce_19(val, _values, result)
scheme, inline = val[1]
result = "{#{inline}}[#{scheme}#{inline.reference}]"
-
+
result
end
def _reduce_20(val, _values, result)
result = [nil, inline(val[1])]
-
+
result
end
@@ -820,25 +820,25 @@ def _reduce_21(val, _values, result)
'rdoc-label:',
inline("#{val[0].reference}/#{val[1].reference}")
]
-
+
result
end
def _reduce_22(val, _values, result)
result = ['rdoc-label:', val[0].reference]
-
+
result
end
def _reduce_23(val, _values, result)
result = ['rdoc-label:', "#{val[0].reference}/"]
-
+
result
end
def _reduce_24(val, _values, result)
result = [nil, inline(val[1])]
-
+
result
end
@@ -847,92 +847,92 @@ def _reduce_25(val, _values, result)
'rdoc-label:',
inline("#{val[0].reference}/#{val[1].reference}")
]
-
+
result
end
def _reduce_26(val, _values, result)
result = ['rdoc-label:', val[0]]
-
+
result
end
def _reduce_27(val, _values, result)
ref = val[0].reference
result = ['rdoc-label:', inline(ref, "#{ref}/")]
-
+
result
end
# reduce 28 omitted
def _reduce_29(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
def _reduce_30(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
def _reduce_31(val, _values, result)
result = inline val[0]
-
+
result
end
def _reduce_32(val, _values, result)
result = inline "\"#{val[1]}\""
-
+
result
end
def _reduce_33(val, _values, result)
result = inline val[0]
-
+
result
end
def _reduce_34(val, _values, result)
result = inline "\"#{val[1]}\""
-
+
result
end
# reduce 35 omitted
def _reduce_36(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
def _reduce_37(val, _values, result)
- result = inline val[1]
+ result = inline val[1]
result
end
def _reduce_38(val, _values, result)
result = val[0].append val[1]
-
+
result
end
def _reduce_39(val, _values, result)
result = val[0].append val[1]
-
+
result
end
def _reduce_40(val, _values, result)
result = val[0]
-
+
result
end
def _reduce_41(val, _values, result)
result = inline val[0]
-
+
result
end
@@ -940,25 +940,25 @@ end
def _reduce_43(val, _values, result)
result = val[0].append val[1]
-
+
result
end
def _reduce_44(val, _values, result)
result = inline val[0]
-
+
result
end
def _reduce_45(val, _values, result)
result = val[0].append val[1]
-
+
result
end
def _reduce_46(val, _values, result)
result = val[0]
-
+
result
end
@@ -984,24 +984,24 @@ end
def _reduce_57(val, _values, result)
result = val[0]
-
+
result
end
def _reduce_58(val, _values, result)
result = inline val[0]
-
+
result
end
def _reduce_59(val, _values, result)
result = inline val[0]
-
+
result
end
def _reduce_60(val, _values, result)
- result << val[1]
+ result << val[1]
result
end
@@ -1009,7 +1009,7 @@ end
def _reduce_62(val, _values, result)
result << val[1]
-
+
result
end
@@ -1017,7 +1017,7 @@ end
def _reduce_64(val, _values, result)
result << val[1]
-
+
result
end
@@ -1048,7 +1048,7 @@ end
# reduce 77 omitted
def _reduce_78(val, _values, result)
- result << val[1]
+ result << val[1]
result
end
@@ -1099,13 +1099,13 @@ end
def _reduce_101(val, _values, result)
index = @block_parser.add_footnote val[1].rdoc
result = "{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]"
-
+
result
end
def _reduce_102(val, _values, result)
result = inline "<tt>#{val[1]}</tt>", val[1]
-
+
result
end
@@ -1122,7 +1122,7 @@ end
# reduce 108 omitted
def _reduce_109(val, _values, result)
- result << val[1]
+ result << val[1]
result
end
@@ -1130,24 +1130,24 @@ end
def _reduce_111(val, _values, result)
result = inline val[0]
-
+
result
end
# reduce 112 omitted
def _reduce_113(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
def _reduce_114(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
def _reduce_115(val, _values, result)
- result = val[1]
+ result = val[1]
result
end
@@ -1192,7 +1192,7 @@ end
# reduce 135 omitted
def _reduce_136(val, _values, result)
- result << val[1]
+ result << val[1]
result
end
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index cff5e78a20..b41434ba39 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -217,7 +217,7 @@ option)
end unless @options.force_output
else
FileUtils.mkdir_p dir
- FileUtils.touch output_flag_file dir
+ FileUtils.touch flag_file
end
last
@@ -289,6 +289,7 @@ option)
file_list = []
relative_files.each do |rel_file_name|
+ next if rel_file_name.end_with? 'created.rid'
next if exclude_pattern && exclude_pattern =~ rel_file_name
stat = File.stat rel_file_name rescue next
@@ -342,6 +343,8 @@ option)
@stats.add_file filename
+ return if RDoc::Parser.binary? filename
+
content = RDoc::Encoding.read_file filename, encoding
return unless content
@@ -493,7 +496,7 @@ The internal error was:
if @options.coverage_report then
puts
- puts @stats.report
+ puts @stats.report.accept RDoc::Markup::ToRdoc.new
elsif file_info.empty? then
$stderr.puts "\nNo newer files." unless @options.quiet
else
@@ -506,7 +509,7 @@ The internal error was:
if @stats and (@options.coverage_report or not @options.quiet) then
puts
- puts @stats.summary
+ puts @stats.summary.accept RDoc::Markup::ToRdoc.new
end
exit @stats.fully_documented? if @options.coverage_report
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 88d87f8084..39064c1384 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -197,7 +197,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
opt.separator nil
- opt.on("--[no-]pager", "-T",
+ opt.on("--[no-]pager",
"Send output directly to stdout,",
"rather than to a pager.") do |use_pager|
options[:use_stdout] = !use_pager
@@ -205,6 +205,13 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
opt.separator nil
+ opt.on("-T",
+ "Synonym for --no-pager") do
+ options[:use_stdout] = true
+ end
+
+ opt.separator nil
+
opt.on("--width=WIDTH", "-w", OptionParser::DecimalInteger,
"Set the width of the output.") do |width|
options[:width] = width
@@ -459,38 +466,51 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
extensions.each do |modules, store|
if modules.length == 1 then
- include = modules.first
- name = include.name
- path = store.friendly_path
- out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
-
- if include.comment then
- out << RDoc::Markup::BlankLine.new
- out << include.comment
- end
+ add_extension_modules_single out, store, modules.first
else
- out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
+ add_extension_modules_multiple out, store, modules
+ end
+ end
+ end
- wout, with = modules.partition { |incl| incl.comment.empty? }
+ ##
+ # Renders multiple included +modules+ from +store+ to +out+.
- out << RDoc::Markup::BlankLine.new unless with.empty?
+ def add_extension_modules_multiple out, store, modules # :nodoc:
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
- with.each do |incl|
- out << RDoc::Markup::Paragraph.new(incl.name)
- out << RDoc::Markup::BlankLine.new
- out << incl.comment
- end
+ wout, with = modules.partition { |incl| incl.comment.empty? }
- unless wout.empty? then
- verb = RDoc::Markup::Verbatim.new
+ out << RDoc::Markup::BlankLine.new unless with.empty?
- wout.each do |incl|
- verb.push incl.name, "\n"
- end
+ with.each do |incl|
+ out << RDoc::Markup::Paragraph.new(incl.name)
+ out << RDoc::Markup::BlankLine.new
+ out << incl.comment
+ end
- out << verb
- end
+ unless wout.empty? then
+ verb = RDoc::Markup::Verbatim.new
+
+ wout.each do |incl|
+ verb.push incl.name, "\n"
end
+
+ out << verb
+ end
+ end
+
+ ##
+ # Adds a single extension module +include+ from +store+ to +out+
+
+ def add_extension_modules_single out, store, include # :nodoc:
+ name = include.name
+ path = store.friendly_path
+ out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
+
+ if include.comment then
+ out << RDoc::Markup::BlankLine.new
+ out << include.comment
end
end
@@ -596,68 +616,56 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
add_extends out, extends
found.each do |store, klass|
- comment = klass.comment
- # TODO the store's cache should always return an empty Array
- class_methods = store.class_methods[klass.full_name] || []
- instance_methods = store.instance_methods[klass.full_name] || []
- attributes = store.attributes[klass.full_name] || []
-
- if comment.empty? and
- instance_methods.empty? and class_methods.empty? then
- also_in << store
- next
- end
-
- add_from out, store
+ render_class out, store, klass, also_in
+ end
- unless comment.empty? then
- out << RDoc::Markup::Rule.new(1)
+ add_also_in out, also_in
- if comment.merged? then
- parts = comment.parts
- parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
- parts.flatten!
- parts.pop
+ out
+ end
- out.concat parts
- else
- out << comment
- end
- end
+ ##
+ # Adds the class +comment+ to +out+.
- if class_methods or instance_methods or not klass.constants.empty? then
- out << RDoc::Markup::Rule.new(1)
- end
+ def class_document_comment out, comment # :nodoc:
+ unless comment.empty? then
+ out << RDoc::Markup::Rule.new(1)
- unless klass.constants.empty? then
- out << RDoc::Markup::Heading.new(1, "Constants:")
- out << RDoc::Markup::BlankLine.new
- list = RDoc::Markup::List.new :NOTE
+ if comment.merged? then
+ parts = comment.parts
+ parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
+ parts.flatten!
+ parts.pop
- constants = klass.constants.sort_by { |constant| constant.name }
+ out.concat parts
+ else
+ out << comment
+ end
+ end
+ end
- list.items.concat constants.map { |constant|
- parts = constant.comment.parts if constant.comment
- parts << RDoc::Markup::Paragraph.new('[not documented]') if
- parts.empty?
+ ##
+ # Adds the constants from +klass+ to the Document +out+.
- RDoc::Markup::ListItem.new(constant.name, *parts)
- }
+ def class_document_constants out, klass # :nodoc:
+ return if klass.constants.empty?
- out << list
- out << RDoc::Markup::BlankLine.new
- end
+ out << RDoc::Markup::Heading.new(1, "Constants:")
+ out << RDoc::Markup::BlankLine.new
+ list = RDoc::Markup::List.new :NOTE
- add_method_list out, class_methods, 'Class methods'
- add_method_list out, instance_methods, 'Instance methods'
- add_method_list out, attributes, 'Attributes'
+ constants = klass.constants.sort_by { |constant| constant.name }
- add_method_documentation out, klass if @show_all
- end
+ list.items.concat constants.map { |constant|
+ parts = constant.comment.parts if constant.comment
+ parts << RDoc::Markup::Paragraph.new('[not documented]') if
+ parts.empty?
- add_also_in out, also_in
+ RDoc::Markup::ListItem.new(constant.name, *parts)
+ }
- out
+ out << list
+ out << RDoc::Markup::BlankLine.new
end
##
@@ -709,16 +717,24 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
# Completes +name+ based on the caches. For Readline
def complete name
- klasses = classes.keys
completions = []
klass, selector, method = parse_name name
+ complete_klass name, klass, selector, method, completions
+ complete_method name, klass, selector, completions
+
+ completions.sort.uniq
+ end
+
+ def complete_klass name, klass, selector, method, completions # :nodoc:
+ klasses = classes.keys
+
# may need to include Foo when given Foo::
klass_name = method ? name : klass
if name !~ /#|\./ then
- completions = klasses.grep(/^#{Regexp.escape klass_name}[^:]*$/)
+ completions.replace klasses.grep(/^#{Regexp.escape klass_name}[^:]*$/)
completions.concat klasses.grep(/^#{Regexp.escape name}[^:]*$/) if
name =~ /::$/
@@ -728,7 +744,9 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
elsif classes.key? klass_name then
completions << klass_name
end
+ end
+ def complete_method name, klass, selector, completions # :nodoc:
if completions.include? klass and name =~ /#|\.|::/ then
methods = list_methods_matching name
@@ -743,8 +761,6 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
completions.concat methods
end
-
- completions.sort.uniq
end
##
@@ -804,7 +820,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
true
rescue NotFoundError
matches = list_methods_matching name if name =~ /::|#|\./
- matches = classes.keys.grep(/^#{name}/) if matches.empty?
+ matches = classes.keys.grep(/^#{Regexp.escape name}/) if matches.empty?
raise if matches.empty?
@@ -1183,6 +1199,12 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
return unless method
store.load_method klass, "#{type}#{method}"
+ rescue RDoc::Store::MissingFileError => e
+ comment = RDoc::Comment.new("missing documentation at #{e.file}").parse
+
+ method = RDoc::AnyMethod.new nil, name
+ method.comment = comment
+ method
end
##
@@ -1228,30 +1250,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
filtered.each do |store, methods|
methods.each do |method|
- out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
-
- unless name =~ /^#{Regexp.escape method.parent_name}/ then
- out << RDoc::Markup::Heading.new(3, "Implementation from #{method.parent_name}")
- end
-
- out << RDoc::Markup::Rule.new(1)
-
- if method.arglists then
- arglists = method.arglists.chomp.split "\n"
- arglists = arglists.map { |line| line + "\n" }
- out << RDoc::Markup::Verbatim.new(*arglists)
- out << RDoc::Markup::Rule.new(1)
- end
-
- if method.respond_to?(:superclass_method) and method.superclass_method
- out << RDoc::Markup::BlankLine.new
- out << RDoc::Markup::Heading.new(4, "(Uses superclass method #{method.superclass_method})")
- out << RDoc::Markup::Rule.new(1)
- end
-
- out << RDoc::Markup::BlankLine.new
- out << method.comment
- out << RDoc::Markup::BlankLine.new
+ render_method out, store, method, name
end
end
@@ -1346,6 +1345,78 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
end
##
+ # Renders the +klass+ from +store+ to +out+. If the klass has no
+ # documentable items the class is added to +also_in+ instead.
+
+ def render_class out, store, klass, also_in # :nodoc:
+ comment = klass.comment
+ # TODO the store's cache should always return an empty Array
+ class_methods = store.class_methods[klass.full_name] || []
+ instance_methods = store.instance_methods[klass.full_name] || []
+ attributes = store.attributes[klass.full_name] || []
+
+ if comment.empty? and
+ instance_methods.empty? and class_methods.empty? then
+ also_in << store
+ return
+ end
+
+ add_from out, store
+
+ class_document_comment out, comment
+
+ if class_methods or instance_methods or not klass.constants.empty? then
+ out << RDoc::Markup::Rule.new(1)
+ end
+
+ class_document_constants out, klass
+
+ add_method_list out, class_methods, 'Class methods'
+ add_method_list out, instance_methods, 'Instance methods'
+ add_method_list out, attributes, 'Attributes'
+
+ add_method_documentation out, klass if @show_all
+ end
+
+ def render_method out, store, method, name # :nodoc:
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
+
+ unless name =~ /^#{Regexp.escape method.parent_name}/ then
+ out << RDoc::Markup::Heading.new(3, "Implementation from #{method.parent_name}")
+ end
+
+ out << RDoc::Markup::Rule.new(1)
+
+ render_method_arguments out, method.arglists
+ render_method_superclass out, method
+ render_method_comment out, method
+ end
+
+ def render_method_arguments out, arglists # :nodoc:
+ return unless arglists
+
+ arglists = arglists.chomp.split "\n"
+ arglists = arglists.map { |line| line + "\n" }
+ out << RDoc::Markup::Verbatim.new(*arglists)
+ out << RDoc::Markup::Rule.new(1)
+ end
+
+ def render_method_comment out, method # :nodoc:
+ out << RDoc::Markup::BlankLine.new
+ out << method.comment
+ out << RDoc::Markup::BlankLine.new
+ end
+
+ def render_method_superclass out, method # :nodoc:
+ return unless
+ method.respond_to?(:superclass_method) and method.superclass_method
+
+ out << RDoc::Markup::BlankLine.new
+ out << RDoc::Markup::Heading.new(4, "(Uses superclass method #{method.superclass_method})")
+ out << RDoc::Markup::Rule.new(1)
+ end
+
+ ##
# Looks up and displays ri data according to the options given.
def run
@@ -1412,7 +1483,9 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
server = WEBrick::HTTPServer.new :Port => @server
- server.mount '/', RDoc::Servlet
+ extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.compact
+
+ server.mount '/', RDoc::Servlet, nil, extra_doc_dirs
trap 'INT' do server.shutdown end
trap 'TERM' do server.shutdown end
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index e6e0b41aab..06a82ef978 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -42,8 +42,8 @@ class RDoc::RubyLex
include RDoc::RubyToken
include IRB
- attr_reader :continue
- attr_reader :lex_state
+ attr_accessor :continue
+ attr_accessor :lex_state
attr_reader :reader
class << self
@@ -107,7 +107,7 @@ class RDoc::RubyLex
@here_header = false
@indent = 0
@indent_stack = []
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
@space_seen = false
@continue = false
@@ -280,7 +280,7 @@ class RDoc::RubyLex
@quoted = nil
@indent = 0
@indent_stack = []
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
@space_seen = false
@here_header = false
@@ -450,11 +450,11 @@ class RDoc::RubyLex
@OP.def_rule("\n") do |op, io|
print "\\n\n" if RDoc::RubyLex.debug?
case @lex_state
- when EXPR_BEG, EXPR_FNAME, EXPR_DOT
+ when :EXPR_BEG, :EXPR_FNAME, :EXPR_DOT
@continue = true
else
@continue = false
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
until (@indent_stack.empty? ||
[TkLPAREN, TkLBRACK, TkLBRACE,
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@@ -473,25 +473,25 @@ class RDoc::RubyLex
">", ">=", ">>") do
|op, io|
case @lex_state
- when EXPR_FNAME, EXPR_DOT
- @lex_state = EXPR_ARG
+ when :EXPR_FNAME, :EXPR_DOT
+ @lex_state = :EXPR_ARG
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
Token(op)
end
@OP.def_rules("!", "!=", "!~") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@OP.def_rules("<<") do
|op, io|
tk = nil
- if @lex_state != EXPR_END && @lex_state != EXPR_CLASS &&
- (@lex_state != EXPR_ARG || @space_seen)
+ if @lex_state != :EXPR_END && @lex_state != :EXPR_CLASS &&
+ (@lex_state != :EXPR_ARG || @space_seen)
c = peek(0)
if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-")
tk = identify_here_document
@@ -500,10 +500,10 @@ class RDoc::RubyLex
unless tk
tk = Token(op)
case @lex_state
- when EXPR_FNAME, EXPR_DOT
- @lex_state = EXPR_ARG
+ when :EXPR_FNAME, :EXPR_DOT
+ @lex_state = :EXPR_ARG
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
end
tk
@@ -516,8 +516,8 @@ class RDoc::RubyLex
@OP.def_rules("`") do
|op, io|
- if @lex_state == EXPR_FNAME
- @lex_state = EXPR_END
+ if @lex_state == :EXPR_FNAME
+ @lex_state = :EXPR_END
Token(op)
else
identify_string(op)
@@ -526,61 +526,61 @@ class RDoc::RubyLex
@OP.def_rules('?') do
|op, io|
- if @lex_state == EXPR_END
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_END
+ @lex_state = :EXPR_BEG
Token(TkQUESTION)
else
ch = getc
- if @lex_state == EXPR_ARG && ch =~ /\s/
+ if @lex_state == :EXPR_ARG && ch =~ /\s/
ungetc
- @lex_state = EXPR_BEG;
+ @lex_state = :EXPR_BEG;
Token(TkQUESTION)
else
- @lex_state = EXPR_END
- Token(TkSTRING, ch)
+ @lex_state = :EXPR_END
+ Token(TkCHAR, "?#{ch}")
end
end
end
@OP.def_rules("&", "&&", "|", "||") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@OP.def_rules("+=", "-=", "*=", "**=",
"&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
op =~ /^(.*)=$/
Token(TkOPASGN, $1)
end
- @OP.def_rule("+@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("+@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token(op)
end
- @OP.def_rule("-@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("-@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token(op)
end
@OP.def_rules("+", "-") do
|op, io|
catch(:RET) do
- if @lex_state == EXPR_ARG
+ if @lex_state == :EXPR_ARG
if @space_seen and peek(0) =~ /[0-9]/
throw :RET, identify_number(op)
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
- elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/
+ elsif @lex_state != :EXPR_END and peek(0) =~ /[0-9]/
throw :RET, identify_number(op)
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
Token(op)
end
@@ -588,20 +588,20 @@ class RDoc::RubyLex
@OP.def_rule(".") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
if peek(0) =~ /[0-9]/
ungetc
identify_number
else
# for "obj.if" etc.
- @lex_state = EXPR_DOT
+ @lex_state = :EXPR_DOT
Token(TkDOT)
end
end
@OP.def_rules("..", "...") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@@ -611,7 +611,7 @@ class RDoc::RubyLex
def lex_int2
@OP.def_rules("]", "}", ")") do
|op, io|
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
@indent -= 1
@indent_stack.pop
Token(op)
@@ -619,11 +619,11 @@ class RDoc::RubyLex
@OP.def_rule(":") do
|op, io|
- if @lex_state == EXPR_END || peek(0) =~ /\s/
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_END || peek(0) =~ /\s/
+ @lex_state = :EXPR_BEG
Token(TkCOLON)
else
- @lex_state = EXPR_FNAME;
+ @lex_state = :EXPR_FNAME;
Token(TkSYMBEG)
end
end
@@ -631,51 +631,51 @@ class RDoc::RubyLex
@OP.def_rule("::") do
|op, io|
# p @lex_state.id2name, @space_seen
- if @lex_state == EXPR_BEG or @lex_state == EXPR_ARG && @space_seen
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_BEG or @lex_state == :EXPR_ARG && @space_seen
+ @lex_state = :EXPR_BEG
Token(TkCOLON3)
else
- @lex_state = EXPR_DOT
+ @lex_state = :EXPR_DOT
Token(TkCOLON2)
end
end
@OP.def_rule("/") do
|op, io|
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
identify_string(op)
elsif peek(0) == '='
getc
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(TkOPASGN, "/") #/)
- elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
+ elsif @lex_state == :EXPR_ARG and @space_seen and peek(0) !~ /\s/
identify_string(op)
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("/") #/)
end
end
@OP.def_rules("^") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("^")
end
# @OP.def_rules("^=") do
- # @lex_state = EXPR_BEG
+ # @lex_state = :EXPR_BEG
# Token(OP_ASGN, :^)
# end
@OP.def_rules(",") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@OP.def_rules(";") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
until (@indent_stack.empty? ||
[TkLPAREN, TkLBRACK, TkLBRACE,
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@@ -686,56 +686,56 @@ class RDoc::RubyLex
@OP.def_rule("~") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("~")
end
- @OP.def_rule("~@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("~@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("~")
end
@OP.def_rule("(") do
|op, io|
@indent += 1
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
+ @lex_state = :EXPR_BEG
tk_c = TkfLPAREN
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
tk_c = TkLPAREN
end
@indent_stack.push tk_c
Token tk_c
end
- @OP.def_rule("[]", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("[]", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token("[]")
end
- @OP.def_rule("[]=", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("[]=", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token("[]=")
end
@OP.def_rule("[") do
|op, io|
@indent += 1
- if @lex_state == EXPR_FNAME
+ if @lex_state == :EXPR_FNAME
tk_c = TkfLBRACK
else
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
tk_c = TkLBRACK
- elsif @lex_state == EXPR_ARG && @space_seen
+ elsif @lex_state == :EXPR_ARG && @space_seen
tk_c = TkLBRACK
else
tk_c = TkfLBRACK
end
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
@indent_stack.push tk_c
Token(tk_c)
@@ -744,12 +744,12 @@ class RDoc::RubyLex
@OP.def_rule("{") do
|op, io|
@indent += 1
- if @lex_state != EXPR_END && @lex_state != EXPR_ARG
+ if @lex_state != :EXPR_END && @lex_state != :EXPR_ARG
tk_c = TkLBRACE
else
tk_c = TkfLBRACE
end
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
@indent_stack.push tk_c
Token(tk_c)
end
@@ -768,15 +768,15 @@ class RDoc::RubyLex
@OP.def_rule('%') do
|op, io|
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
identify_quotation
elsif peek(0) == '='
getc
Token(TkOPASGN, :%)
- elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
+ elsif @lex_state == :EXPR_ARG and @space_seen and peek(0) !~ /\s/
identify_quotation
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("%") #))
end
end
@@ -799,15 +799,15 @@ class RDoc::RubyLex
# @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
# |op, io|
# @indent += 1
- # @lex_state = EXPR_FNAME
- # # @lex_state = EXPR_END
+ # @lex_state = :EXPR_FNAME
+ # # @lex_state = :EXPR_END
# # until @rests[0] == "\n" or @rests[0] == ";"
# # rests.shift
# # end
# end
@OP.def_rule("_") do
- if peek_match?(/_END__/) and @lex_state == EXPR_BEG then
+ if peek_match?(/_END__/) and @lex_state == :EXPR_BEG then
6.times { getc }
Token(TkEND_OF_SCRIPT, '__END__')
else
@@ -832,7 +832,7 @@ class RDoc::RubyLex
end
def identify_gvar
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
case ch = getc
when /[~_*$?!@\/\\;,=:<>".]/ #"
@@ -888,32 +888,33 @@ class RDoc::RubyLex
when /^\$/
return Token(TkGVAR, token)
when /^\@\@/
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
# p Token(TkCVAR, token)
return Token(TkCVAR, token)
when /^\@/
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
return Token(TkIVAR, token)
end
- if @lex_state != EXPR_DOT
+ if @lex_state != :EXPR_DOT
print token, "\n" if RDoc::RubyLex.debug?
token_c, *trans = TkReading2Token[token]
if token_c
# reserved word?
- if (@lex_state != EXPR_BEG &&
- @lex_state != EXPR_FNAME &&
+ if (@lex_state != :EXPR_BEG &&
+ @lex_state != :EXPR_FNAME &&
trans[1])
# modifiers
token_c = TkSymbol2Token[trans[1]]
@lex_state = trans[0]
else
- if @lex_state != EXPR_FNAME
+ if @lex_state != :EXPR_FNAME
if ENINDENT_CLAUSE.include?(token)
+ valid = peek(0) != ':'
+
# check for ``class = val'' etc.
- valid = true
case token
when "class"
valid = false unless peek_match?(/^\s*(<<|\w|::)/)
@@ -925,7 +926,8 @@ class RDoc::RubyLex
valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&|\|)/)
else
# no nothing
- end
+ end if valid
+
if valid
if token == "do"
if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last)
@@ -946,23 +948,23 @@ class RDoc::RubyLex
end
@lex_state = trans[0]
else
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
end
return Token(token_c, token)
end
end
- if @lex_state == EXPR_FNAME
- @lex_state = EXPR_END
+ if @lex_state == :EXPR_FNAME
+ @lex_state = :EXPR_END
if peek(0) == '='
token.concat getc
end
- elsif @lex_state == EXPR_BEG || @lex_state == EXPR_DOT ||
- @lex_state == EXPR_ARG
- @lex_state = EXPR_ARG
+ elsif @lex_state == :EXPR_BEG || @lex_state == :EXPR_DOT ||
+ @lex_state == :EXPR_ARG
+ @lex_state = :EXPR_ARG
else
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
if token[0, 1] =~ /[A-Z]/
@@ -1028,6 +1030,8 @@ class RDoc::RubyLex
end
if output_heredoc then
+ raise Error, "Missing terminating #{quoted} for string" unless l
+
doc << l.chomp
else
doc << '"'
@@ -1041,7 +1045,7 @@ class RDoc::RubyLex
token_class = output_heredoc ? RDoc::RubyLex::TkHEREDOC : Ltype2Token[lt]
@ltype = ltback
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
Token(token_class, doc)
end
@@ -1065,7 +1069,7 @@ class RDoc::RubyLex
end
def identify_number(op = "")
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
num = op
@@ -1240,7 +1244,7 @@ class RDoc::RubyLex
ensure
@ltype = nil
@quoted = nil
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
end
@@ -1283,18 +1287,19 @@ class RDoc::RubyLex
def read_escape
escape = ''
ch = getc
- escape << ch
case ch
when "\n", "\r", "\f"
+ escape << ch
when "\\", "n", "t", "r", "f", "v", "a", "e", "b", "s" #"
+ escape << ch
when /[0-7]/
ungetc ch
3.times do
ch = getc
- escape << ch
case ch
when /[0-7]/
+ escape << ch
when nil
break
else
@@ -1304,11 +1309,13 @@ class RDoc::RubyLex
end
when "x"
+ escape << ch
+
2.times do
ch = getc
- escape << ch
case ch
when /[0-9a-fA-F]/
+ escape << ch
when nil
break
else
@@ -1318,26 +1325,44 @@ class RDoc::RubyLex
end
when "M"
- ch = getc
escape << ch
+
+ ch = getc
if ch != '-'
ungetc
else
- ch = getc
escape << ch
+
+ ch = getc
if ch == "\\" #"
+ ungetc
escape << read_escape
+ else
+ escape << ch
end
end
when "C", "c" #, "^"
- if ch == "C" and (ch = getc) != "-"
- escape << ch
- ungetc
+ escape << ch
+
+ if ch == "C"
+ ch = getc
+
+ if ch == "-"
+ escape << ch
+ ch = getc
+ escape << ch
+
+ escape << read_escape if ch == "\\"
+ else
+ ungetc
+ end
elsif (ch = getc) == "\\" #"
escape << ch << read_escape
end
else
+ escape << ch
+
# other characters
end
diff --git a/lib/rdoc/ruby_token.rb b/lib/rdoc/ruby_token.rb
index 7878e4c22a..8010475b92 100644
--- a/lib/rdoc/ruby_token.rb
+++ b/lib/rdoc/ruby_token.rb
@@ -276,50 +276,50 @@ module RDoc::RubyToken
end
TokenDefinitions = [
- [:TkCLASS, TkKW, "class", EXPR_CLASS],
- [:TkMODULE, TkKW, "module", EXPR_BEG],
- [:TkDEF, TkKW, "def", EXPR_FNAME],
- [:TkUNDEF, TkKW, "undef", EXPR_FNAME],
- [:TkBEGIN, TkKW, "begin", EXPR_BEG],
- [:TkRESCUE, TkKW, "rescue", EXPR_MID],
- [:TkENSURE, TkKW, "ensure", EXPR_BEG],
- [:TkEND, TkKW, "end", EXPR_END],
- [:TkIF, TkKW, "if", EXPR_BEG, :TkIF_MOD],
- [:TkUNLESS, TkKW, "unless", EXPR_BEG, :TkUNLESS_MOD],
- [:TkTHEN, TkKW, "then", EXPR_BEG],
- [:TkELSIF, TkKW, "elsif", EXPR_BEG],
- [:TkELSE, TkKW, "else", EXPR_BEG],
- [:TkCASE, TkKW, "case", EXPR_BEG],
- [:TkWHEN, TkKW, "when", EXPR_BEG],
- [:TkWHILE, TkKW, "while", EXPR_BEG, :TkWHILE_MOD],
- [:TkUNTIL, TkKW, "until", EXPR_BEG, :TkUNTIL_MOD],
- [:TkFOR, TkKW, "for", EXPR_BEG],
- [:TkBREAK, TkKW, "break", EXPR_MID],
- [:TkNEXT, TkKW, "next", EXPR_END],
- [:TkREDO, TkKW, "redo", EXPR_END],
- [:TkRETRY, TkKW, "retry", EXPR_END],
- [:TkIN, TkKW, "in", EXPR_BEG],
- [:TkDO, TkKW, "do", EXPR_BEG],
- [:TkRETURN, TkKW, "return", EXPR_MID],
- [:TkYIELD, TkKW, "yield", EXPR_END],
- [:TkSUPER, TkKW, "super", EXPR_END],
- [:TkSELF, TkKW, "self", EXPR_END],
- [:TkNIL, TkKW, "nil", EXPR_END],
- [:TkTRUE, TkKW, "true", EXPR_END],
- [:TkFALSE, TkKW, "false", EXPR_END],
- [:TkAND, TkKW, "and", EXPR_BEG],
- [:TkOR, TkKW, "or", EXPR_BEG],
- [:TkNOT, TkKW, "not", EXPR_BEG],
+ [:TkCLASS, TkKW, "class", :EXPR_CLASS],
+ [:TkMODULE, TkKW, "module", :EXPR_BEG],
+ [:TkDEF, TkKW, "def", :EXPR_FNAME],
+ [:TkUNDEF, TkKW, "undef", :EXPR_FNAME],
+ [:TkBEGIN, TkKW, "begin", :EXPR_BEG],
+ [:TkRESCUE, TkKW, "rescue", :EXPR_MID],
+ [:TkENSURE, TkKW, "ensure", :EXPR_BEG],
+ [:TkEND, TkKW, "end", :EXPR_END],
+ [:TkIF, TkKW, "if", :EXPR_BEG, :TkIF_MOD],
+ [:TkUNLESS, TkKW, "unless", :EXPR_BEG, :TkUNLESS_MOD],
+ [:TkTHEN, TkKW, "then", :EXPR_BEG],
+ [:TkELSIF, TkKW, "elsif", :EXPR_BEG],
+ [:TkELSE, TkKW, "else", :EXPR_BEG],
+ [:TkCASE, TkKW, "case", :EXPR_BEG],
+ [:TkWHEN, TkKW, "when", :EXPR_BEG],
+ [:TkWHILE, TkKW, "while", :EXPR_BEG, :TkWHILE_MOD],
+ [:TkUNTIL, TkKW, "until", :EXPR_BEG, :TkUNTIL_MOD],
+ [:TkFOR, TkKW, "for", :EXPR_BEG],
+ [:TkBREAK, TkKW, "break", :EXPR_MID],
+ [:TkNEXT, TkKW, "next", :EXPR_END],
+ [:TkREDO, TkKW, "redo", :EXPR_END],
+ [:TkRETRY, TkKW, "retry", :EXPR_END],
+ [:TkIN, TkKW, "in", :EXPR_BEG],
+ [:TkDO, TkKW, "do", :EXPR_BEG],
+ [:TkRETURN, TkKW, "return", :EXPR_MID],
+ [:TkYIELD, TkKW, "yield", :EXPR_END],
+ [:TkSUPER, TkKW, "super", :EXPR_END],
+ [:TkSELF, TkKW, "self", :EXPR_END],
+ [:TkNIL, TkKW, "nil", :EXPR_END],
+ [:TkTRUE, TkKW, "true", :EXPR_END],
+ [:TkFALSE, TkKW, "false", :EXPR_END],
+ [:TkAND, TkKW, "and", :EXPR_BEG],
+ [:TkOR, TkKW, "or", :EXPR_BEG],
+ [:TkNOT, TkKW, "not", :EXPR_BEG],
[:TkIF_MOD, TkKW],
[:TkUNLESS_MOD, TkKW],
[:TkWHILE_MOD, TkKW],
[:TkUNTIL_MOD, TkKW],
- [:TkALIAS, TkKW, "alias", EXPR_FNAME],
- [:TkDEFINED, TkKW, "defined?", EXPR_END],
- [:TklBEGIN, TkKW, "BEGIN", EXPR_END],
- [:TklEND, TkKW, "END", EXPR_END],
- [:Tk__LINE__, TkKW, "__LINE__", EXPR_END],
- [:Tk__FILE__, TkKW, "__FILE__", EXPR_END],
+ [:TkALIAS, TkKW, "alias", :EXPR_FNAME],
+ [:TkDEFINED, TkKW, "defined?", :EXPR_END],
+ [:TklBEGIN, TkKW, "BEGIN", :EXPR_END],
+ [:TklEND, TkKW, "END", :EXPR_END],
+ [:Tk__LINE__, TkKW, "__LINE__", :EXPR_END],
+ [:Tk__FILE__, TkKW, "__FILE__", :EXPR_END],
[:TkIDENTIFIER, TkId],
[:TkFID, TkId],
@@ -335,6 +335,7 @@ module RDoc::RubyToken
[:TkXSTRING, TkVal],
[:TkREGEXP, TkVal],
[:TkSYMBOL, TkVal],
+ [:TkCHAR, TkVal],
[:TkDSTRING, TkNode],
[:TkDXSTRING, TkNode],
diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb
index f001c6d66c..b4393114f1 100644
--- a/lib/rdoc/rubygems_hook.rb
+++ b/lib/rdoc/rubygems_hook.rb
@@ -12,6 +12,7 @@ require 'rdoc'
class RDoc::RubygemsHook
include Gem::UserInteraction
+ extend Gem::UserInteraction
@rdoc_version = nil
@specs = []
@@ -45,7 +46,8 @@ class RDoc::RubygemsHook
# +specs+
def self.generation_hook installer, specs
- types = installer.document
+ start = Time.now
+ types = installer.document
generate_rdoc = types.include? 'rdoc'
generate_ri = types.include? 'ri'
@@ -53,6 +55,13 @@ class RDoc::RubygemsHook
specs.each do |spec|
new(spec, generate_rdoc, generate_ri).generate
end
+
+ return unless generate_rdoc or generate_ri
+
+ duration = (Time.now - start).to_i
+ names = specs.map(&:name).join ', '
+
+ say "Done installing documentation for #{names} after #{duration} seconds"
end
##
diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
index 1dca7596db..ec8fd739f1 100644
--- a/lib/rdoc/servlet.rb
+++ b/lib/rdoc/servlet.rb
@@ -53,14 +53,17 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
#
# Use +mount_path+ when mounting the servlet somewhere other than /.
#
+ # Use +extra_doc_dirs+ for additional documentation directories.
+ #
# +server+ is provided automatically by WEBrick when mounting. +stores+ and
# +cache+ are provided automatically by the servlet.
- def initialize server, stores, cache, mount_path = nil
+ def initialize server, stores, cache, mount_path = nil, extra_doc_dirs = []
super server
@cache = cache
@mount_path = mount_path
+ @extra_doc_dirs = extra_doc_dirs
@stores = stores
@options = RDoc::Options.new
@@ -121,6 +124,10 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
else
show_documentation req, res
end
+ rescue WEBrick::HTTPStatus::NotFound => e
+ generator = generator_for RDoc::Store.new
+
+ not_found generator, req, res, e.message
rescue WEBrick::HTTPStatus::Status
raise
rescue => e
@@ -270,6 +277,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
# and the filesystem to the RDoc::Store for the documentation.
def installed_docs
+ extra_counter = 0
ri_paths.map do |path, type|
store = RDoc::Store.new path, type
exists = File.exist? store.cache_path
@@ -284,6 +292,11 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
['Site Documentation', 'site/', exists, type, path]
when :home then
['Home Documentation', 'home/', exists, type, path]
+ when :extra then
+ extra_counter += 1
+ store.load_cache if exists
+ title = store.title || "Extra Documentation"
+ [title, "extra-#{extra_counter}/", exists, type, path]
end
end
end
@@ -291,8 +304,9 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
##
# Returns a 404 page built by +generator+ for +req+ on +res+.
- def not_found generator, req, res
- res.body = generator.generate_servlet_not_found req.path
+ def not_found generator, req, res, message = nil
+ message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
+ res.body = generator.generate_servlet_not_found message
res.status = 404
end
@@ -300,7 +314,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
# Enumerates the ri paths. See RDoc::RI::Paths#each
def ri_paths &block
- RDoc::RI::Paths.each true, true, true, :all, &block
+ RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
end
##
@@ -344,6 +358,8 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
when :home then
path = 'home'
comment = 'Documentation from your home directory'
+ when :extra
+ comment = name
end
info << [name, '', path, '', comment]
@@ -397,6 +413,10 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
RDoc::Store.new RDoc::RI::Paths.system_dir, :system
when 'site' then
RDoc::Store.new RDoc::RI::Paths.site_dir, :site
+ when /^extra-(\d+)$/ then
+ index = $1.to_i - 1
+ ri_dir = installed_docs[index][4]
+ RDoc::Store.new ri_dir, :extra
else
ri_dir, type = ri_paths.find do |dir, dir_type|
next unless dir_type == :gem
@@ -404,11 +424,16 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
source_name == dir[%r%/([^/]*)/ri$%, 1]
end
- raise RDoc::Error,
- "could not find ri documentation for #{source_name}" unless
- ri_dir
+ raise WEBrick::HTTPStatus::NotFound,
+ "Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir
+
+ store = RDoc::Store.new ri_dir, type
+
+ return store if File.exist? store.cache_path
+
+ raise WEBrick::HTTPStatus::NotFound,
+ "Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`"
- RDoc::Store.new ri_dir, type
end
end
diff --git a/lib/rdoc/stats.rb b/lib/rdoc/stats.rb
index 4fa519d243..b5a21915b4 100644
--- a/lib/rdoc/stats.rb
+++ b/lib/rdoc/stats.rb
@@ -187,12 +187,12 @@ class RDoc::Stats
# A report that says you did a great job!
def great_job
- report = []
- report << '100% documentation!'
- report << nil
- report << 'Great Job!'
+ report = RDoc::Markup::Document.new
+
+ report << RDoc::Markup::Paragraph.new('100% documentation!')
+ report << RDoc::Markup::Paragraph.new('Great Job!')
- report.join "\n"
+ report
end
##
@@ -217,8 +217,6 @@ class RDoc::Stats
extend RDoc::Text
end
- report = []
-
if @coverage_level.zero? then
calculate
@@ -227,14 +225,20 @@ class RDoc::Stats
ucm = @store.unique_classes_and_modules
+ report = RDoc::Markup::Document.new
+ report << RDoc::Markup::Paragraph.new('The following items are not documented:')
+ report << RDoc::Markup::BlankLine.new
+
ucm.sort.each do |cm|
- report << report_class_module(cm) {
+ body = report_class_module(cm) {
[
report_constants(cm),
report_attributes(cm),
report_methods(cm),
].compact
}
+
+ report << body if body
end
if @coverage_level > 0 then
@@ -243,10 +247,7 @@ class RDoc::Stats
return great_job if @num_items == @doc_items
end
- report.unshift nil
- report.unshift 'The following items are not documented:'
-
- report.join "\n"
+ report
end
##
@@ -260,7 +261,8 @@ class RDoc::Stats
cm.each_attribute do |attr|
next if attr.documented?
line = attr.line ? ":#{attr.line}" : nil
- report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}"
+ report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
+ report << "\n"
end
report
@@ -273,38 +275,47 @@ class RDoc::Stats
return if cm.fully_documented? and @coverage_level.zero?
return unless cm.display?
- report = []
+ report = RDoc::Markup::Document.new
if cm.in_files.empty? then
- report << "# #{cm.definition} is referenced but empty."
- report << "#"
- report << "# It probably came from another project. I'm sorry I'm holding it against you."
- report << nil
+ report << RDoc::Markup::Paragraph.new("#{cm.definition} is referenced but empty.")
+ report << RDoc::Markup::Paragraph.new("It probably came from another project. I'm sorry I'm holding it against you.")
return report
elsif cm.documented? then
documented = true
- report << "#{cm.definition} # is documented"
+ klass = RDoc::Markup::Verbatim.new("#{cm.definition} # is documented\n")
else
- report << '# in files:'
+ report << RDoc::Markup::Paragraph.new('In files:')
+
+ list = RDoc::Markup::List.new :BULLET
cm.in_files.each do |file|
- report << "# #{file.full_name}"
+ para = RDoc::Markup::Paragraph.new file.full_name
+ list << RDoc::Markup::ListItem.new(nil, para)
end
- report << nil
+ report << list
+ report << RDoc::Markup::BlankLine.new
- report << "#{cm.definition}"
+ klass = RDoc::Markup::Verbatim.new("#{cm.definition}\n")
end
+ klass << "\n"
+
body = yield.flatten # HACK remove #flatten
- return if body.empty? and documented
+ if body.empty? then
+ return if documented
+
+ klass.parts.pop
+ else
+ klass.parts.concat body
+ end
- report << nil << body unless body.empty?
+ klass << "end\n"
- report << 'end'
- report << nil
+ report << klass
report
end
@@ -323,8 +334,9 @@ class RDoc::Stats
next if constant.documented? || constant.is_alias_for
line = constant.line ? ":#{constant.line}" : line
- report << " # in file #{constant.file.full_name}#{line}"
- report << " #{constant.name} = nil"
+ report << " # in file #{constant.file.full_name}#{line}\n"
+ report << " #{constant.name} = nil\n"
+ report << "\n"
end
report
@@ -350,7 +362,7 @@ class RDoc::Stats
@undoc_params += undoc.length
undoc = undoc.map do |param| "+#{param}+" end
- param_report = " # #{undoc.join ', '} is not documented"
+ param_report = " # #{undoc.join ', '} is not documented\n"
end
end
@@ -359,10 +371,10 @@ class RDoc::Stats
line = method.line ? ":#{method.line}" : nil
scope = method.singleton ? 'self.' : nil
- report << " # in file #{method.file.full_name}#{line}"
+ report << " # in file #{method.file.full_name}#{line}\n"
report << param_report if param_report
- report << " def #{scope}#{method.name}#{method.params}; end"
- report << nil
+ report << " def #{scope}#{method.name}#{method.params}; end\n"
+ report << "\n"
end
report
@@ -385,35 +397,36 @@ class RDoc::Stats
@undoc_params,
].max.to_s.length
- report = []
- report << 'Files: %*d' % [num_width, @num_files]
+ report = RDoc::Markup::Verbatim.new
+
+ report << "Files: %*d\n" % [num_width, @num_files]
- report << nil
+ report << "\n"
- report << 'Classes: %*d (%*d undocumented)' % [
+ report << "Classes: %*d (%*d undocumented)\n" % [
num_width, @num_classes, undoc_width, @undoc_classes]
- report << 'Modules: %*d (%*d undocumented)' % [
+ report << "Modules: %*d (%*d undocumented)\n" % [
num_width, @num_modules, undoc_width, @undoc_modules]
- report << 'Constants: %*d (%*d undocumented)' % [
+ report << "Constants: %*d (%*d undocumented)\n" % [
num_width, @num_constants, undoc_width, @undoc_constants]
- report << 'Attributes: %*d (%*d undocumented)' % [
+ report << "Attributes: %*d (%*d undocumented)\n" % [
num_width, @num_attributes, undoc_width, @undoc_attributes]
- report << 'Methods: %*d (%*d undocumented)' % [
+ report << "Methods: %*d (%*d undocumented)\n" % [
num_width, @num_methods, undoc_width, @undoc_methods]
- report << 'Parameters: %*d (%*d undocumented)' % [
+ report << "Parameters: %*d (%*d undocumented)\n" % [
num_width, @num_params, undoc_width, @undoc_params] if
@coverage_level > 0
- report << nil
+ report << "\n"
- report << 'Total: %*d (%*d undocumented)' % [
+ report << "Total: %*d (%*d undocumented)\n" % [
num_width, @num_items, undoc_width, @undoc_items]
- report << '%6.2f%% documented' % percent_doc
- report << nil
- report << 'Elapsed: %0.1fs' % (Time.now - @start)
+ report << "%6.2f%% documented\n" % percent_doc
+ report << "\n"
+ report << "Elapsed: %0.1fs\n" % (Time.now - @start)
- report.join "\n"
+ RDoc::Markup::Document.new report
end
##
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index 6cbbfb5b69..00fa1e2329 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -305,8 +305,10 @@ class RDoc::Store
# cache included modules before they are removed from the documentation
all_classes_and_modules.each { |cm| cm.ancestors }
- remove_nodoc @classes_hash
- remove_nodoc @modules_hash
+ unless min_visibility == :nodoc then
+ remove_nodoc @classes_hash
+ remove_nodoc @modules_hash
+ end
@unique_classes = find_unique @classes_hash
@unique_modules = find_unique @modules_hash
diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb
index c69e3c7cc6..99d4bd4ee1 100644
--- a/lib/rdoc/test_case.rb
+++ b/lib/rdoc/test_case.rb
@@ -1,4 +1,11 @@
require 'rubygems'
+
+begin
+ gem 'minitest', '~> 4.0'
+rescue NoMethodError
+ # for ruby tests
+end
+
require 'minitest/autorun'
require 'minitest/benchmark' if ENV['BENCHMARK']
@@ -45,6 +52,7 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
@rdoc = RDoc::RDoc.new
@rdoc.store = @store
+ @rdoc.options = RDoc::Options.new
g = Object.new
def g.class_dir() end
@@ -53,6 +61,27 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
end
##
+ # Asserts +path+ is a file
+
+ def assert_file path
+ assert File.file?(path), "#{path} is not a file"
+ end
+
+ ##
+ # Asserts +path+ is a directory
+
+ def assert_directory path
+ assert File.directory?(path), "#{path} is not a directory"
+ end
+
+ ##
+ # Refutes +path+ exists
+
+ def refute_file path
+ refute File.exist?(path), "#{path} exists"
+ end
+
+ ##
# Shortcut for RDoc::Markup::BlankLine.new
def blank_line
@@ -110,6 +139,16 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
end
##
+ # Enables pretty-print output
+
+ def mu_pp obj # :nodoc:
+ s = ''
+ s = PP.pp obj, s
+ s = s.force_encoding Encoding.default_external if defined? Encoding
+ s.chomp
+ end
+
+ ##
# Shortcut for RDoc::Markup::Paragraph.new with +contents+
def para *a
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index c731dde097..0fda72e3ae 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -140,7 +140,7 @@ module RDoc::Text
def snippet text, limit = 100
document = parse text
- RDoc::Markup::ToHtmlSnippet.new(limit).convert document
+ RDoc::Markup::ToHtmlSnippet.new(options, limit).convert document
end
##
diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb
index 4cee0ce182..2b62243525 100644
--- a/lib/rdoc/tom_doc.rb
+++ b/lib/rdoc/tom_doc.rb
@@ -129,7 +129,8 @@ class RDoc::TomDoc < RDoc::Markup::Parser
def initialize
super
- @section = nil
+ @section = nil
+ @seen_returns = false
end
# Internal: Builds a heading from the token stream
@@ -176,9 +177,17 @@ class RDoc::TomDoc < RDoc::Markup::Parser
until @tokens.empty? do
type, data, = get
- if type == :TEXT then
+ case type
+ when :TEXT then
+ @section = 'Returns' if data =~ /\AReturns/
+
paragraph << data
- skip :NEWLINE
+ when :NEWLINE then
+ if :TEXT == peek_token[0] then
+ paragraph << ' '
+ else
+ break
+ end
else
unget
break
@@ -190,6 +199,21 @@ class RDoc::TomDoc < RDoc::Markup::Parser
paragraph
end
+ ##
+ # Detects a section change to "Returns" and adds a heading
+
+ def parse_text parent, indent # :nodoc:
+ paragraph = build_paragraph indent
+
+ if false == @seen_returns and 'Returns' == @section then
+ @seen_returns = true
+ parent << RDoc::Markup::Heading.new(3, 'Returns')
+ parent << RDoc::Markup::BlankLine.new
+ end
+
+ parent << paragraph
+ end
+
# Internal: Turns text into an Array of tokens
#
# text - A String containing TomDoc-format text.
diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb
index b9d2021f99..64d81d20c1 100644
--- a/lib/rdoc/top_level.rb
+++ b/lib/rdoc/top_level.rb
@@ -30,7 +30,7 @@ class RDoc::TopLevel < RDoc::Context
attr_accessor :diagram # :nodoc:
##
- # The parser that processed this file
+ # The parser class that processed this file
attr_accessor :parser