Merge pull request #1170 from danzhu/master

Fix Haskell entry names
pull/1204/head
Jed Fox 5 years ago
commit a7ff546683

@ -53,19 +53,15 @@ module Docs
return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last) return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last)
css('#synopsis > details > ul > li').each_with_object [] do |node, entries| css('#synopsis > details > ul > li').each_with_object [] do |node, entries|
link = node.at_css('a') link = node.at_css('a:not([title])')
name = node.content.strip name = link.content
name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+}
name.sub! %r{\A\((.+?)\)}, '\1'
name.sub!(/ (?:\:\: (\w+))?.*\z/) { |_| $1 ? " (#{$1})" : '' }
if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content)) if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content))
node.css('.subs > li').each do |sub_node| node.css('.subs > li').each do |sub_node|
sub_link = sub_node.at_css('a') sub_link = sub_node.at_css('a')
next unless sub_link['href'].start_with?('#') next unless sub_link['href'].start_with?('#')
sub_name = sub_node.content.strip sub_name = sub_link.content
sub_name.remove! %r{\s.*} sub_name << " (#{name})"
sub_name.prepend "#{name} "
entries << [sub_name, sub_link['href'].remove('#')] entries << [sub_name, sub_link['href'].remove('#')]
end end
end end

Loading…
Cancel
Save