diff --git a/templates/html/helpers.rb b/templates/html/helpers.rb index f6db37f..f8af6b6 100644 --- a/templates/html/helpers.rb +++ b/templates/html/helpers.rb @@ -82,6 +82,10 @@ module PDoc if obj.is_a?(String) && obj =~ /\ssection$/ obj = section_from_name(obj.gsub(/\ssection$/, '')) end + obj.sub!('...', '…') if obj.is_a?(String) + if obj.is_a?(String) && obj.strip =~ /^\[.+\]$|\|/ + return obj.gsub(/[^\],.…\s\|\[]+/) { |item| auto_link(item, short, attributes) } + end obj = root.find_by_name(obj) || obj if obj.is_a?(String) return nil if obj.nil? return obj if obj.is_a?(String) @@ -120,22 +124,24 @@ module PDoc module CodeHelper def method_synopsis(object) - if (object.is_a?(Documentation::Property)) - return <<-EOS -
#{ object.signature }
- EOS
+ result = []
+ result << ''
+ if object.is_a?(Documentation::Property)
+ result << "#{object.signature}"
+ else
+ ebnfs = object.ebnf_expressions.dup
+ if object.is_a?(Documentation::KlassMethod) && object.methodized?
+ result << "#{object.static_signature} ⇒ #{auto_link(object.returns, false)}
"
+ result << "#{object.signature} ⇒ #{auto_link(object.returns, false)}"
+ ebnfs.shift
+ result.last << '
' unless ebnfs.empty?
+ end
+ ebnfs.each do |ebnf|
+ result << "#{ebnf.signature} ⇒ #{auto_link(ebnf.returns, false)}"
+ end
end
-
- if (object.is_a?(Documentation::InstanceMethod) && object.methodized?)
- return <<-EOS
- #{ object.signature } -> #{ auto_link(object.returns, false) }
-#{ object.generic_signature } -> #{ auto_link(object.returns, false) }
- EOS
- end
-
- <<-EOS
- #{ object.signature } -> #{ auto_link(object.returns, false) }
- EOS
+ result << '
'
+ result.join('')
end
end