elixir.rb 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. module Docs
  2. class Elixir < UrlScraper
  3. include MultipleBaseUrls
  4. self.name = 'Elixir'
  5. self.type = 'elixir'
  6. self.root_path = 'introduction.html'
  7. self.links = {
  8. home: 'https://elixir-lang.org/',
  9. code: 'https://github.com/elixir-lang/elixir'
  10. }
  11. html_filters.push 'elixir/clean_html', 'elixir/entries', 'title'
  12. options[:container] = '#content'
  13. options[:title] = false
  14. options[:root_title] = 'Elixir'
  15. options[:attribution] = <<-HTML
  16. &copy; 2012 - 2024 The Elixir Team<br>
  17. Licensed under the Apache License, Version 2.0.
  18. HTML
  19. def initial_urls
  20. [ "https://hexdocs.pm/elixir/#{self.class.release}/introduction.html",
  21. "https://hexdocs.pm/eex/#{self.class.release}/EEx.html",
  22. "https://hexdocs.pm/ex_unit/#{self.class.release}/ExUnit.html",
  23. "https://hexdocs.pm/iex/#{self.class.release}/IEx.html",
  24. "https://hexdocs.pm/logger/#{self.class.release}/Logger.html",
  25. "https://hexdocs.pm/mix/#{self.class.release}/Mix.html" ]
  26. end
  27. version '1.17' do
  28. self.release = '1.17.0'
  29. self.base_urls = [
  30. "https://hexdocs.pm/elixir/#{release}/",
  31. "https://hexdocs.pm/eex/#{release}/",
  32. "https://hexdocs.pm/ex_unit/#{release}/",
  33. "https://hexdocs.pm/iex/#{release}/",
  34. "https://hexdocs.pm/logger/#{release}/",
  35. "https://hexdocs.pm/mix/#{release}/"
  36. ]
  37. end
  38. version '1.16' do
  39. self.release = '1.16.3'
  40. self.base_urls = [
  41. "https://hexdocs.pm/elixir/#{release}/",
  42. "https://hexdocs.pm/eex/#{release}/",
  43. "https://hexdocs.pm/ex_unit/#{release}/",
  44. "https://hexdocs.pm/iex/#{release}/",
  45. "https://hexdocs.pm/logger/#{release}/",
  46. "https://hexdocs.pm/mix/#{release}/"
  47. ]
  48. end
  49. def get_latest_version(opts)
  50. doc = fetch_doc('https://hexdocs.pm/elixir/api-reference.html', opts)
  51. doc.at_css('.sidebar-projectVersion').content.strip[1..-1]
  52. end
  53. end
  54. end