| @@ -2,22 +2,30 @@ module Docs · 1 unmodified line |
| 2 | 2 | class React |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | | − at_css('article h1').content |
| 5 | + at_css('article h1').content.sub(' (Experimental)', '') |
| 6 | 6 | end |
| 7 | 7 | |
| 8 | 8 | def get_type |
| 9 | + return 'API Reference' if slug == 'legacy-context' |
| 10 | + return 'Glossary' if slug == 'glossary' |
| 9 | 11 | link = css("nav a[href='#{result[:path].split('/').last}']").last |
| 10 | 12 | return 'Miscellaneous' unless link |
| 11 | 13 | type = link.ancestors('ul').last.previous_element.content |
| 12 | 14 | type.remove! %r{\s*\(.*\)} |
| 13 | | − type |
| 15 | + if type == 'Concurrent Mode' |
| 16 | + type + ' (Experimental)' # TODO: Remove when CM is stable |
| 17 | + else |
| 18 | + type |
| 19 | + end |
| 14 | 20 | end |
| 15 | 21 | |
| 16 | 22 | def additional_entries |
| 17 | 23 | entries = [] |
| 18 | 24 | |
| 19 | | − css('article h3 code, article h4 code').each do |node| |
| 20 | | − next if node.previous.try(:content).present? |
| 25 | + is_glossary = slug == 'glossary' |
| 26 | + css(is_glossary ? 'article h2, article h3' : 'article h3 code, article h4 code').each do |node| |
| 27 | + next if !is_glossary && node.previous.try(:content).present? |
| 28 | + next if slug == 'testing-recipes' |
| 21 | 29 | name = node.content.strip |
| 22 | 30 | # name.remove! %r{[#\(\)]} |
| 23 | 31 | # name.remove! %r{\w+\:} |
| @@ -29,10 +37,14 @@ module Docs · 5 unmodified lines |
| 29 | 37 | 'Reference: React' |
| 30 | 38 | elsif slug == 'hooks-reference' |
| 31 | 39 | 'Hooks' |
| 40 | + elsif slug == 'test-utils' |
| 41 | + 'Reference: Test Utilities' |
| 42 | + elsif slug == 'glossary' |
| 43 | + 'Glossary' |
| 32 | 44 | else |
| 33 | 45 | 'Reference' |
| 34 | 46 | end |
| 35 | | − entries << [name, node.parent['id'], type] |
| 47 | + entries << [name, node['id'] || node.ancestors('[id]').first['id'], type] |
| 36 | 48 | end |
| 37 | 49 | |
| 38 | 50 | entries |