[devdocsgjs/main: 180/239] Bypass old tailwind redirects




commit 643e24fe22483f8f0b5b8bd09b9209c5f39e45d4
Author: IgnusG <6438760+IgnusG users noreply github com>
Date:   Mon Feb 21 21:38:00 2022 +0100

    Bypass old tailwind redirects

 lib/docs/scrapers/tailwindcss.rb | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/lib/docs/scrapers/tailwindcss.rb b/lib/docs/scrapers/tailwindcss.rb
index c9d9a887..975b776f 100644
--- a/lib/docs/scrapers/tailwindcss.rb
+++ b/lib/docs/scrapers/tailwindcss.rb
@@ -11,15 +11,26 @@ module Docs
 
     # options[:container] = 'body';
 
-    options[:skip_patterns] = [
-
-        # removed because it focuses on how to use Tailwind with some other niche
-        # technologies and to also align with DevDoc's Vision, which is" to:"
-        # "indexing only the minimum useful to most developers" that use Tailwind
-        %r{\/guides\/.*},
-
-        # removed so it is easy to "get_type" (see tailwindcss/entries.rb line #15)
-        %r{\/colors\z}
+    # Fix redirects from older tailwind 2 docs
+    options[:fix_urls] = lambda do |url|
+      if url.include? "installation/"
+        break "/docs/installation"
+      end
+
+      if url.end_with? "/breakpoints"
+        break "/docs/screens#{/#.*$/.match(url)}"
+      end
+      if url.end_with? "/adding-base-styles"
+        break "/docs/adding-custom-styles#adding-base-styles"
+      end
+      if url.end_with? "/ring-opacity"
+        break "/docs/ring-color#changing-the-opacity"
+      end
+
+      if url.match(/\/colors#?/)
+        break "/docs/customizing-colors#{/#.*$/.match(url)}"
+      end
+    end
 
     options[:skip_patterns] = [
       # Skip setup instructions


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]