Unified · Split
| @@ -38,18 +38,30 @@ module Docs · 37 unmodified lines | ||
| 38 | 38 | end |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | + ADD_SUB_ENTRIES_KEYWORDS = %w(class module newtype) | |
| 42 | + | |
| 41 | 43 | def additional_entries |
| 42 | 44 | return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last) |
| 43 | 45 | |
| 44 | 46 | css('#synopsis > ul > li').each_with_object [] do |node, entries| |
| 45 | 47 | link = node.at_css('a') |
| 46 | − next unless link['href'].start_with?('#') | |
| 47 | 48 | name = node.content.strip |
| 48 | 49 | name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+} |
| 49 | 50 | name.sub! %r{\A\((.+?)\)}, '\1' |
| 50 | 51 | name.sub!(/ (?:\:\: (\w+))?.*\z/) { |_| $1 ? " (#{$1})" : '' } |
| 51 | − next if name == self.name | |
| 52 | − entries << [name, link['href'].remove('#')] | |
| 52 | + | |
| 53 | + if ADD_SUB_ENTRIES_KEYWORDS.include?(node.at_css('.keyword').try(:content)) | |
| 54 | + node.css('.subs > li').each do |sub_node| | |
| 55 | + sub_link = sub_node.at_css('a') | |
| 56 | + next unless sub_link['href'].start_with?('#') | |
| 57 | + sub_name = sub_node.content.strip | |
| 58 | + sub_name.remove! %r{\s.*} | |
| 59 | + sub_name.prepend "#{name} " | |
| 60 | + entries << [sub_name, sub_link['href'].remove('#')] | |
| 61 | + end | |
| 62 | + end | |
| 63 | + | |
| 64 | + entries << [name, link['href'].remove('#')] if link['href'].start_with?('#') && name != self.name | |
| 53 | 65 | end |
| 54 | 66 | end |
| 55 | 67 | |