From 7894269c33965bcbed83047f9c5696aff967fc56 Mon Sep 17 00:00:00 2001 From: Daniel Zhu Date: Wed, 29 Jan 2020 20:16:55 -0500 Subject: [PATCH] Fix Haskell entry names --- lib/docs/filters/haskell/entries.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/docs/filters/haskell/entries.rb b/lib/docs/filters/haskell/entries.rb index ed590d2b..00e19bb4 100644 --- a/lib/docs/filters/haskell/entries.rb +++ b/lib/docs/filters/haskell/entries.rb @@ -53,19 +53,15 @@ module Docs return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last) css('#synopsis > details > ul > li').each_with_object [] do |node, entries| - link = node.at_css('a') - name = node.content.strip - name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+} - name.sub! %r{\A\((.+?)\)}, '\1' - name.sub!(/ (?:\:\: (\w+))?.*\z/) { |_| $1 ? " (#{$1})" : '' } + link = node.at_css('a:not([title])') + name = link.content if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content)) node.css('.subs > li').each do |sub_node| sub_link = sub_node.at_css('a') next unless sub_link['href'].start_with?('#') - sub_name = sub_node.content.strip - sub_name.remove! %r{\s.*} - sub_name.prepend "#{name} " + sub_name = sub_link.content + sub_name << " (#{name})" entries << [sub_name, sub_link['href'].remove('#')] end end