Unified · Split
| @@ -2,16 +2,22 @@ module Docs · 1 unmodified line | |||
| 2 | class Tailwindcss | 2 | class Tailwindcss |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_type | 4 | def get_type |
| 5 | # /customizing-colors rediects to /colors, hence making css | 5 | # We are only interested in children list items |
| 6 | # selector below not to match the href | 6 | selector = "nav li li a[href='#{result[:path]}']" |
| 7 | if result[:path] == 'customizing-colors' | ||
| 8 | selector = "#sidebar a[href='#{result[:path]}']" | ||
| 9 | else | ||
| 10 | selector = "#sidebar a[href='#{result[:path]}']" | ||
| 11 | end | ||
| 12 | 7 | ||
| 13 | check = at_css(selector).parent.parent.parent.css('h5').inner_text | 8 | anchor = at_css(selector) |
| 14 | check | 9 | category_list = anchor.ancestors('li')[1] |
| 10 | title = category_list.css('h5') | ||
| 11 | |||
| 12 | return title.inner_text | ||
| 13 | end | ||
| 14 | |||
| 15 | def get_name | ||
| 16 | # We are only interested in children list items | ||
| 17 | selector = "nav li li a[href='#{result[:path]}']" | ||
| 18 | item = at_css(selector) | ||
| 19 | |||
| 20 | return item.inner_text | ||
| 15 | end | 21 | end |
| 16 | end | 22 | end |
| 17 | end | 23 | end |