Prechádzať zdrojové kódy

Update Haskell documentation (7.10.2)

Thibaut 10 rokov pred
rodič
commit
b9a038d665

+ 21 - 15
lib/docs/filters/haskell/entries.rb

@@ -2,19 +2,25 @@ module Docs
   class Haskell
     class EntriesFilter < Docs::EntriesFilter
       IGNORE_ENTRIES_PATHS = %w(
-        bytestring-0.10.4.0/Data-ByteString-Lazy.html
-        bytestring-0.10.4.0/Data-ByteString-Char8.html
-        bytestring-0.10.4.0/Data-ByteString-Lazy-Char8.html
-        array-0.5.0.0/Data-Array-IArray.html
-        containers-0.5.5.1/Data-IntMap-Lazy.html
-        containers-0.5.5.1/Data-Map-Lazy.html
-        unix-2.7.0.1/System-Posix-Files-ByteString.html
-        filepath-1.3.0.2/System-FilePath-Windows.html
-        transformers-0.3.0.0/Control-Monad-Trans-RWS-Lazy.html
-        transformers-0.3.0.0/Control-Monad-Trans-Writer-Lazy.html
-        base-4.7.0.0/GHC-Conc-Sync.html
-        base-4.7.0.0/GHC-IO-Encoding-UTF32.html
-        unix-2.7.0.1/System-Posix-Terminal-ByteString.html)
+        Data-ByteString-Lazy.html
+        Data-ByteString-Char8.html
+        Data-ByteString-Lazy-Char8.html
+        Data-Array-IArray.html
+        Data-IntMap-Lazy.html
+        Data-Map-Lazy.html
+        System-Posix-Files-ByteString.html
+        System-FilePath-Windows.html
+        Control-Monad-Trans-RWS-Lazy.html
+        Control-Monad-Trans-State-Lazy.html
+        Control-Monad-Trans-Writer-Lazy.html
+        GHC-Conc-Sync.html
+        GHC-OldList.html
+        GHC-IO-Encoding-UTF32.html
+        System-Posix-Terminal-ByteString.html
+        Text-XHtml-Frameset.html
+        Text-XHtml-Strict.html
+        System-Posix-Process-ByteString.html
+        Data-ByteString-Builder-Prim.html)
 
       def get_name
         at_css('#module-header .caption').content.strip
@@ -33,7 +39,7 @@ module Docs
       end
 
       def additional_entries
-        return [] if IGNORE_ENTRIES_PATHS.include?(subpath)
+        return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last)
 
         css('#synopsis > ul > li').each_with_object [] do |node, entries|
           link = node.at_css('a')
@@ -41,7 +47,7 @@ module Docs
           name = node.content.strip
           name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+}
           name.sub! %r{\A\((.+?)\)}, '\1'
-          name.sub!(/ (?:\:\: (\w+))?.+\z/) { |_| $1 ? " (#{$1})" : '' }
+          name.sub!(/ (?:\:\: (\w+))?.*\z/) { |_| $1 ? " (#{$1})" : '' }
           next if name == self.name
           entries << [name, link['href'].remove('#')]
         end

+ 19 - 15
lib/docs/scrapers/haskell.rb

@@ -2,27 +2,31 @@ module Docs
   class Haskell < UrlScraper
     self.name = 'Haskell'
     self.type = 'haskell'
-    self.version = '7.8.4'
-    self.base_url = 'https://downloads.haskell.org/~ghc/7.8.4/docs/html/libraries/'
+    self.version = '7.10.2'
+    self.base_url = "https://downloads.haskell.org/~ghc/#{version}/docs/html/libraries/"
     self.root_path = 'index.html'
 
     html_filters.push 'haskell/entries', 'haskell/clean_html'
 
     options[:container] = '#content'
 
-    options[:skip] = %w(
-      hoopl-3.10.0.1/Compiler-Hoopl-Internals.html
-      base-4.7.0.0/Control-Exception-Base.html
-      binary-0.7.1.0/Data-Binary-Get-Internal.html
-      template-haskell-2.9.0.0/Language-Haskell-TH-Lib.html
-      haskell98-2.0.0.3/Prelude.html
-      pretty-1.1.1.1/Text-PrettyPrint.html
-      base-4.7.0.0/Data-OldTypeable-Internal.html
-      base-4.7.0.0/Data-Typeable-Internal.html
-      base-4.7.0.0/GHC-IO-Encoding-Types.html
-      unix-2.7.0.1/System-Posix-Process-Internals.html)
-
-    options[:skip_patterns] = [/src\//, /doc-index/, /haskell2010/, /ghc-/, /Cabal-/]
+    options[:skip_patterns] = [
+      /src\//,
+      /doc-index/,
+      /haskell2010/,
+      /ghc-/,
+      /Cabal-/,
+      /Compiler-Hoopl-Internals\.html\z/i,
+      /Control-Exception-Base\.html\z/i,
+      /Data-Binary-Get-Internal\.html\z/i,
+      /Language-Haskell-TH-Lib\.html\z/i,
+      /Prelude\.html\z/i,
+      /Text-PrettyPrint\.html\z/i,
+      /Data-OldTypeable-Internal\.html\z/i,
+      /Data-Typeable-Internal\.html\z/i,
+      /GHC-IO-Encoding-Types\.html\z/i,
+      /System-Posix-Process-Internals\.html\z/i
+    ]
 
     options[:attribution] = <<-HTML
       &copy; The University of Glasgow and others<br>