haskell.rb 2.2 KB

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