1
0
Эх сурвалжийг харах

Update Sass documentation (1.82.9)

Simon Legner 1 жил өмнө
parent
commit
7f33327fc5

+ 16 - 1
assets/stylesheets/pages/_yard.scss

@@ -1,5 +1,20 @@
 ._yard {
   @extend %simple;
 
-  .tag_title { font-weight: var(--boldFontWeight); }
+  .tag_title {
+    font-weight: var(--boldFontWeight);
+  }
+
+  .sl-c-description-list--horizontal * {
+    display: inline-block;
+    padding: 0;
+    margin: 0;
+    dt {
+      margin-left: 1rem;
+    }
+  }
+
+  .sl-c-callout--warning {
+    @extend %note, %note-orange;
+  }
 }

+ 11 - 7
lib/docs/filters/sass/clean_html.rb

@@ -5,14 +5,13 @@ module Docs
         @doc = at_css('#main-content .typedoc', '#main-content')
 
         css('.sl-c-alert').remove
-
         css('.sl-l-medium-holy-grail__navigation').remove
-
         css('.sl-r-banner').remove
-
         css('.site-footer').remove
-
         css('.tsd-breadcrumb').remove
+        css('.sl-c-callout--warning > h3').remove
+        css('.ui-tabs-nav').remove
+        css('.sl-c-to-playground').remove
 
         # Add id to code blocks
         css('pre.signature').each do |node|
@@ -42,14 +41,19 @@ module Docs
         css('.visuallyhidden').remove
 
         ### Syntax Highlight ###
-        css('.highlight.scss', '.highlight.sass').each do |node|
+        css('.language-scss').each do |node|
           node['data-language'] = 'scss'
           node.content = node.content.strip
         end
 
-        css('.highlight.css').each do |node|
+        css('.language-sass').each do |node|
+          node['data-language'] = 'sass'
+          node.content = "// SASS\n#{node.content.strip}"
+        end
+
+        css('.language-css').each do |node|
           node['data-language'] = 'css'
-          node.content = node.content.strip
+          node.content = "/* CSS */\n#{node.content.strip}"
         end
 
         doc

+ 8 - 4
lib/docs/scrapers/sass.rb

@@ -1,7 +1,7 @@
 module Docs
   class Sass < UrlScraper
     self.type = 'yard'
-    self.release = '1.56.1'
+    self.release = '1.82.9'
     self.base_url = 'https://sass-lang.com/documentation'
     self.root_path = 'index.html'
     self.links = {
@@ -14,17 +14,21 @@ module Docs
     options[:root_title] = false
 
     options[:skip_patterns] = [/breaking-changes/]
-
-    # options[:container] = '#main-content'
+    options[:trailing_slash] = false
 
     options[:attribution] = <<-HTML
-      &copy; 2006&ndash;2022 the Sass team, and numerous contributors<br>
+      &copy; 2006&ndash;2024 the Sass team, and numerous contributors<br>
       Licensed under the MIT License.
     HTML
+  
+    private
 
     def get_latest_version(opts)
       get_npm_version('sass', opts)
     end
 
+    def parse(response)
+      response.body.gsub! '<span class="widont">&nbsp;</span>', '&nbsp;'
+    end
   end
 end