History

Bypass old tailwind redirects

IgnusG committed 4 years ago

Commit 643e24f1 parent 30eb2061 file · +20 −9Browse files

Unified · Split

lib/docs/scrapers/tailwindcss.rb+20−9
@@ -11,15 +11,26 @@ module Docs · 10 unmodified lines
1111
1212 # options[:container] = 'body';
1313
14− options[:skip_patterns] = [
15−
16− # removed because it focuses on how to use Tailwind with some other niche
17− # technologies and to also align with DevDoc's Vision, which is" to:"
18− # "indexing only the minimum useful to most developers" that use Tailwind
19− %r{\/guides\/.*},
20−
21− # removed so it is easy to "get_type" (see tailwindcss/entries.rb line #15)
22− %r{\/colors\z}
14+ # Fix redirects from older tailwind 2 docs
15+ options[:fix_urls] = lambda do |url|
16+ if url.include? "installation/"
17+ break "/docs/installation"
18+ end
19+
20+ if url.end_with? "/breakpoints"
21+ break "/docs/screens#{/#.*$/.match(url)}"
22+ end
23+ if url.end_with? "/adding-base-styles"
24+ break "/docs/adding-custom-styles#adding-base-styles"
25+ end
26+ if url.end_with? "/ring-opacity"
27+ break "/docs/ring-color#changing-the-opacity"
28+ end
29+
30+ if url.match(/\/colors#?/)
31+ break "/docs/customizing-colors#{/#.*$/.match(url)}"
32+ end
33+ end
2334
2435 options[:skip_patterns] = [
2536 # Skip setup instructions

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t