mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 01:54:00 +02:00
Sync RDoc 6.14.0
This commit is contained in:
parent
ca1ea95784
commit
03eb777c69
185 changed files with 2008 additions and 1655 deletions
|
@ -7,7 +7,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|||
##
|
||||
# Creates a message extractor for +store+.
|
||||
|
||||
def initialize store
|
||||
def initialize(store)
|
||||
@store = store
|
||||
@po = RDoc::Generator::POT::PO.new
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|||
|
||||
private
|
||||
|
||||
def extract_from_klass klass
|
||||
def extract_from_klass(klass)
|
||||
extract_text(klass.comment_location, klass.full_name)
|
||||
|
||||
klass.each_section do |section, constants, attributes|
|
||||
|
@ -35,11 +35,11 @@ class RDoc::Generator::POT::MessageExtractor
|
|||
end
|
||||
end
|
||||
|
||||
klass.each_constant do |constant|
|
||||
klass.constants.each do |constant|
|
||||
extract_text(constant.comment, constant.full_name)
|
||||
end
|
||||
|
||||
klass.each_attribute do |attribute|
|
||||
klass.attributes.each do |attribute|
|
||||
extract_text(attribute.comment, attribute.full_name)
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|||
end
|
||||
end
|
||||
|
||||
def extract_text text, comment, location = nil
|
||||
def extract_text(text, comment, location = nil)
|
||||
return if text.nil?
|
||||
|
||||
options = {
|
||||
|
@ -61,7 +61,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|||
end
|
||||
end
|
||||
|
||||
def entry msgid, options
|
||||
def entry(msgid, options)
|
||||
RDoc::Generator::POT::POEntry.new(msgid, options)
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class RDoc::Generator::POT::PO
|
|||
##
|
||||
# Adds a PO entry to the PO.
|
||||
|
||||
def add entry
|
||||
def add(entry)
|
||||
existing_entry = @entries[entry.msgid]
|
||||
if existing_entry
|
||||
entry = existing_entry.merge(entry)
|
||||
|
|
|
@ -26,7 +26,7 @@ class RDoc::Generator::POT::POEntry
|
|||
# Creates a PO entry for +msgid+. Other values can be specified by
|
||||
# +options+.
|
||||
|
||||
def initialize msgid, options = {}
|
||||
def initialize(msgid, options = {})
|
||||
@msgid = msgid
|
||||
@msgstr = options[:msgstr] || ""
|
||||
@translator_comment = options[:translator_comment]
|
||||
|
@ -53,7 +53,7 @@ msgstr #{format_message(@msgstr)}
|
|||
##
|
||||
# Merges the PO entry with +other_entry+.
|
||||
|
||||
def merge other_entry
|
||||
def merge(other_entry)
|
||||
options = {
|
||||
:extracted_comment => merge_string(@extracted_comment,
|
||||
other_entry.extracted_comment),
|
||||
|
@ -69,7 +69,7 @@ msgstr #{format_message(@msgstr)}
|
|||
|
||||
private
|
||||
|
||||
def format_comment mark, comment
|
||||
def format_comment(mark, comment)
|
||||
return '' unless comment
|
||||
return '' if comment.empty?
|
||||
|
||||
|
@ -106,7 +106,7 @@ msgstr #{format_message(@msgstr)}
|
|||
"\#, #{formatted_flags}\n"
|
||||
end
|
||||
|
||||
def format_message message
|
||||
def format_message(message)
|
||||
return "\"#{escape(message)}\"" unless message.include?("\n")
|
||||
|
||||
formatted_message = '""'
|
||||
|
@ -117,7 +117,7 @@ msgstr #{format_message(@msgstr)}
|
|||
formatted_message
|
||||
end
|
||||
|
||||
def escape string
|
||||
def escape(string)
|
||||
string.gsub(/["\\\t\n]/) do |special_character|
|
||||
case special_character
|
||||
when "\t"
|
||||
|
@ -130,11 +130,11 @@ msgstr #{format_message(@msgstr)}
|
|||
end
|
||||
end
|
||||
|
||||
def merge_string string1, string2
|
||||
def merge_string(string1, string2)
|
||||
[string1, string2].compact.join("\n")
|
||||
end
|
||||
|
||||
def merge_array array1, array2
|
||||
def merge_array(array1, array2)
|
||||
(array1 + array2).uniq
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue