lib/yard/templates/helpers/html_helper.rb in yard-0.7.1 vs lib/yard/templates/helpers/html_helper.rb in yard-0.7.2
- old
+ new
@@ -178,10 +178,16 @@
next str unless code_tags == 0
next(match[1..-1]) if escape
next(match) if name[0,1] == '|'
+
+ if name == '<a' && title =~ /href=["'](.+?)["'].*>.*<\/a>\s*(.*)\Z/
+ name, title = $1, $2
+ title = nil if title.empty?
+ end
+
if object.is_a?(String)
object
else
link = linkify(name, title)
if (link == name || link == title) && (name+' '+link !~ /\A<a\s.*>/)
@@ -369,10 +375,13 @@
# @param [Boolean] link whether to link the types
# @return [String] the signature types
# @since 0.5.3
def signature_types(meth, link = true)
meth = convert_method_to_overload(meth)
+ if meth.respond_to?(:object) && !meth.has_tag?(:return)
+ meth = meth.object
+ end
type = options[:default_return] || ""
if meth.tag(:return) && meth.tag(:return).types
types = meth.tags(:return).map {|t| t.types ? t.types : [] }.flatten.uniq
first = link ? h(types.first) : format_types([types.first], false)
@@ -427,11 +436,12 @@
if meth.is_a?(YARD::CodeObjects::MethodObject)
link_title = "#{h meth.name(true)} (#{meth.scope} #{meth.type})"
else
link_title = "#{h name} (#{meth.type})"
end
- link_url(url_for(meth), title, :title => link_title) + extras_text
+ obj = meth.respond_to?(:object) ? meth.object : meth
+ link_url(url_for(obj), title, :title => link_title) + extras_text
else
title + extras_text
end
end
@@ -448,16 +458,17 @@
if @file && RUBY19
lang = @file.contents.encoding.to_s
else
return 'utf-8' unless RUBY19 || lang = ENV['LANG']
if RUBY19
- lang = Encoding.default_external.name.downcase
+ lang = ::Encoding.default_external.name.downcase
else
lang = lang.downcase.split('.').last
end
end
case lang
when "ascii-8bit", "us-ascii", "ascii-7bit"; 'iso-8859-1'
+ when "utf8"; 'utf-8'
else; lang
end
end
# @endgroup