1
0

haskell.rb 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. module Docs
  2. class Haskell < UrlScraper
  3. self.name = 'Haskell'
  4. self.type = 'haskell'
  5. self.root_path = 'users_guide/index.html'
  6. self.initial_paths = %w(libraries/index.html)
  7. html_filters.push 'haskell/entries', 'haskell/clean_html'
  8. options[:container] = ->(filter) { filter.subpath.start_with?('users_guide') ? '.body' : '#content' }
  9. options[:only_patterns] = [/\Alibraries\//, /\Ausers_guide\//]
  10. options[:skip_patterns] = [
  11. /-notes/,
  12. /editing-guide/,
  13. /src\//,
  14. /doc-index/,
  15. /haskell2010/,
  16. /ghc-/,
  17. /Cabal-/,
  18. /Compiler-Hoopl-Internals\.html\z/i,
  19. /Control-Exception-Base\.html\z/i,
  20. /Data-Binary-Get-Internal\.html\z/i,
  21. /Language-Haskell-TH-Lib\.html\z/i,
  22. /Text-PrettyPrint\.html\z/i,
  23. /Data-OldTypeable-Internal\.html\z/i,
  24. /Data-Typeable-Internal\.html\z/i,
  25. /GHC-IO-Encoding-Types\.html\z/i,
  26. /System-Posix-Process-Internals\.html\z/i
  27. ]
  28. options[:skip] = %w(
  29. users_guide/license.html
  30. users_guide/genindex.html
  31. users_guide/search.html
  32. )
  33. options[:attribution] = ->(filter) do
  34. if filter.subpath.start_with?('users_guide')
  35. <<-HTML
  36. &copy; 2002&ndash;2007 The University Court of the University of Glasgow. All rights reserved.<br>
  37. Licensed under the Glasgow Haskell Compiler License.
  38. HTML
  39. else
  40. <<-HTML
  41. &copy; The University of Glasgow and others<br>
  42. Licensed under a BSD-style license (see top of the page).
  43. HTML
  44. end
  45. end
  46. version '8' do
  47. self.release = '8.0.1'
  48. self.base_url = "https://downloads.haskell.org/~ghc/#{release}/docs/html/"
  49. end
  50. version '7' do
  51. self.release = '7.10.3'
  52. self.base_url = "https://downloads.haskell.org/~ghc/#{release}/docs/html/"
  53. self.root_path = 'libraries/index.html'
  54. options[:only_patterns] = [/\Alibraries\//]
  55. end
  56. end
  57. end