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