History

Merge pull request #1170 from danzhu/master

Fix Haskell entry names

Jed Fox committed 6 years ago

Commit a7ff5462 parents d116759 78942691 file · +4 −8Browse files

Showing the changes to lib/docs (1 of 1 file). Show all

Unified · Split

lib/docs/filters/haskell/entries.rb+4−8
@@ -53,19 +53,15 @@ module Docs · 52 unmodified lines
53 return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last)53 return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last)
54 54
55 css('#synopsis > details > ul > li').each_with_object [] do |node, entries|55 css('#synopsis > details > ul > li').each_with_object [] do |node, entries|
56 link = node.at_css('a')56 link = node.at_css('a:not([title])')
57 name = node.content.strip57 name = link.content
58 name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+}
59 name.sub! %r{\A\((.+?)\)}, '\1'
60 name.sub!(/ (?:\:\: (\w+))?.*\z/) { |_| $1 ? " (#{$1})" : '' }
61 58
62 if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content))59 if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content))
63 node.css('.subs > li').each do |sub_node|60 node.css('.subs > li').each do |sub_node|
64 sub_link = sub_node.at_css('a')61 sub_link = sub_node.at_css('a')
65 next unless sub_link['href'].start_with?('#')62 next unless sub_link['href'].start_with?('#')
66 sub_name = sub_node.content.strip63 sub_name = sub_link.content
67 sub_name.remove! %r{\s.*}64 sub_name << " (#{name})"
68 sub_name.prepend "#{name} "
69 entries << [sub_name, sub_link['href'].remove('#')]65 entries << [sub_name, sub_link['href'].remove('#')]
70 end66 end
71 end67 end