History

Adjust the tailwind entries generator to support tailwind 3

IgnusG committed 4 years ago

Commit 268441f1 parent 4d1c0b41 file · +15 −9Browse files

Unified · Split

lib/docs/filters/tailwindcss/entries.rb+15−9
@@ -2,16 +2,22 @@ module Docs · 1 unmodified line
22 class Tailwindcss
33 class EntriesFilter < Docs::EntriesFilter
44 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]}']"
127
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
1521 end
1622 end
1723 end