summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/generator.rb6
-rw-r--r--lib/rdoc/markup/to_html.rb6
-rw-r--r--lib/rdoc/markup/to_latex.rb6
-rw-r--r--lib/rdoc/parsers/parse_c.rb2
-rw-r--r--lib/rdoc/ri/formatter.rb30
5 files changed, 25 insertions, 25 deletions
diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb
index b62cd00506..0e5b4a8cc0 100644
--- a/lib/rdoc/generator.rb
+++ b/lib/rdoc/generator.rb
@@ -523,7 +523,7 @@ module RDoc::Generator
def http_url(full_name, prefix)
path = full_name.dup
- path.gsub!(/<<\s*(\w*)/) { "from-#$1" } if path['<<']
+ path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']
::File.join(prefix, path.split("::")) + ".html"
end
@@ -704,8 +704,8 @@ module RDoc::Generator
end
def filename_to_label
- @context.file_relative_name.gsub(/%|\/|\?|\#/) do |s|
- '%%%x' % s[0].unpack('C')
+ @context.file_relative_name.gsub(/%|\/|\?|\#/) do
+ '%%%x' % $&[0].unpack('C')
end
end
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index da42312ff5..4fe16f8e91 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -200,14 +200,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
gsub(/\.\.\.\./, '.&#8230;').gsub(/\.\.\./, '&#8230;').
# convert single closing quote
- gsub(%r{([^ \t\r\n\[\{\(])\'}) { "#$1&#8217;" }.
- gsub(%r{\'(?=\W|s\b)}) { "&#8217;" }.
+ gsub(%r{([^ \t\r\n\[\{\(])\'}, '\1&#8217;').
+ gsub(%r{\'(?=\W|s\b)}, '&#8217;').
# convert single opening quote
gsub(/'/, '&#8216;').
# convert double closing quote
- gsub(%r{([^ \t\r\n\[\{\(])\'(?=\W)}) { "#$1&#8221;" }.
+ gsub(%r{([^ \t\r\n\[\{\(])\'(?=\W)}, '\1&#8221;').
# convert double opening quote
gsub(/'/, '&#8220;').
diff --git a/lib/rdoc/markup/to_latex.rb b/lib/rdoc/markup/to_latex.rb
index a679b3b06e..bbf958f2ed 100644
--- a/lib/rdoc/markup/to_latex.rb
+++ b/lib/rdoc/markup/to_latex.rb
@@ -227,14 +227,14 @@ class RDoc::Markup::ToLaTeX < RDoc::Markup::Formatter
gsub(/\.\.\.\./, '.\ldots{}').gsub(/\.\.\./, '\ldots{}').
# convert single closing quote
- gsub(%r{([^ \t\r\n\[\{\(])\'}) { "#$1'" }.
- gsub(%r{\'(?=\W|s\b)}) { "'" }.
+ gsub(%r{([^ \t\r\n\[\{\(])\'}, '\1\'').
+ gsub(%r{\'(?=\W|s\b)}, "'" ).
# convert single opening quote
gsub(/'/, '`').
# convert double closing quote
- gsub(%r{([^ \t\r\n\[\{\(])\"(?=\W)}) { "#$1''" }.
+ gsub(%r{([^ \t\r\n\[\{\(])\"(?=\W)}, "\\1''").
# convert double opening quote
gsub(/"/, "``").
diff --git a/lib/rdoc/parsers/parse_c.rb b/lib/rdoc/parsers/parse_c.rb
index 07d65bc9d8..5771250cb9 100644
--- a/lib/rdoc/parsers/parse_c.rb
+++ b/lib/rdoc/parsers/parse_c.rb
@@ -766,7 +766,7 @@ module RDoc
# Removes #ifdefs that would otherwise confuse us
def handle_ifdefs_in(body)
- body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\n(.*?)#endif.*?\n/m) { $1 }
+ body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\n(.*?)#endif.*?\n/m, '\1')
end
end
diff --git a/lib/rdoc/ri/formatter.rb b/lib/rdoc/ri/formatter.rb
index d88cef1e3c..df73bf5eb3 100644
--- a/lib/rdoc/ri/formatter.rb
+++ b/lib/rdoc/ri/formatter.rb
@@ -87,22 +87,22 @@ class RDoc::RI::Formatter
# Convert HTML entities back to ASCII
def conv_html(txt)
- txt.
- gsub(/&gt;/, '>').
- gsub(/&lt;/, '<').
- gsub(/&quot;/, '"').
- gsub(/&amp;/, '&')
+ txt = txt.gsub(/&gt;/, '>')
+ txt.gsub!(/&lt;/, '<')
+ txt.gsub!(/&quot;/, '"')
+ txt.gsub!(/&amp;/, '&')
+ txt
end
##
# Convert markup into display form
def conv_markup(txt)
- txt.
- gsub(%r{<tt>(.*?)</tt>}) { "+#$1+" } .
- gsub(%r{<code>(.*?)</code>}) { "+#$1+" } .
- gsub(%r{<b>(.*?)</b>}) { "*#$1*" } .
- gsub(%r{<em>(.*?)</em>}) { "_#$1_" }
+ txt = txt.gsub(%r{<tt>(.*?)</tt>}, '+\1+')
+ txt.gsub!(%r{<code>(.*?)</code>}, '+\1+')
+ txt.gsub!(%r{<b>(.*?)</b>}, '*\1*')
+ txt.gsub!(%r{<em>(.*?)</em>}, '_\1_')
+ txt
end
def display_list(list)
@@ -548,11 +548,11 @@ class RDoc::RI::HtmlFormatter < RDoc::RI::AttributeFormatter
end
def escape(str)
- str.
- gsub(/&/n, '&amp;').
- gsub(/\"/n, '&quot;').
- gsub(/>/n, '&gt;').
- gsub(/</n, '&lt;')
+ str = str.gsub(/&/n, '&amp;')
+ str.gsub!(/\"/n, '&quot;')
+ str.gsub!(/>/n, '&gt;')
+ str.gsub!(/</n, '&lt;')
+ str
end
end