Skip to content

Commit a7ff546

Browse files
committed
Merge pull request freeCodeCamp#1170 from danzhu/master
Fix Haskell entry names
2 parents d116759 + 7894269 commit a7ff546

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/docs/filters/haskell/entries.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,15 @@ def additional_entries
5353
return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last)
5454

5555
css('#synopsis > details > ul > li').each_with_object [] do |node, entries|
56-
link = node.at_css('a')
57-
name = node.content.strip
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})" : '' }
56+
link = node.at_css('a:not([title])')
57+
name = link.content
6158

6259
if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content))
6360
node.css('.subs > li').each do |sub_node|
6461
sub_link = sub_node.at_css('a')
6562
next unless sub_link['href'].start_with?('#')
66-
sub_name = sub_node.content.strip
67-
sub_name.remove! %r{\s.*}
68-
sub_name.prepend "#{name} "
63+
sub_name = sub_link.content
64+
sub_name << " (#{name})"
6965
entries << [sub_name, sub_link['href'].remove('#')]
7066
end
7167
end

0 commit comments

Comments
 (0)