summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-07 01:22:37 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-07 01:22:37 +0000
commit4260aa1dc399e1bb4a2147409ed1139112cfefb8 (patch)
tree72b378fdcef83d532147bb6deeafe2ad55134f3e /lib/rdoc/markup
parent7d2d6d0a2f600943ab484238b4722036151376a5 (diff)
* lib/rdoc: Update to RDoc 4.2.0.
* test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/markup')
-rw-r--r--lib/rdoc/markup/to_html.rb9
-rw-r--r--lib/rdoc/markup/to_label.rb2
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 823b023e72..2b1216ef2a 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -286,7 +286,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
@res << to_html(heading.text)
unless @options.pipe then
@res << "<span><a href=\"##{label}\">&para;</a>"
- @res << " <a href=\"#documentation\">&uarr;</a></span>"
+ @res << " <a href=\"#top\">&uarr;</a></span>"
end
@res << "</h#{level}>\n"
end
@@ -379,11 +379,12 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
##
- # Returns true if Ripper is available it can create a sexp from +text+
+ # Returns true if text is valid ruby syntax
def parseable? text
- text =~ /\b(def|class|module|require) |=>|\{\s?\||do \|/ and
- text !~ /<%|%>/
+ eval("BEGIN {return true}\n#{text}")
+ rescue SyntaxError
+ false
end
##
diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb
index ace89c324a..6fbe4a3dbd 100644
--- a/lib/rdoc/markup/to_label.rb
+++ b/lib/rdoc/markup/to_label.rb
@@ -31,7 +31,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
def convert text
label = convert_flow @am.flow text
- CGI.escape label
+ CGI.escape(label).gsub('%', '-').sub(/^-/, '')
end
##