mdn.rb 933 B

1234567891011121314151617181920212223242526272829
  1. module Docs
  2. class Mdn < UrlScraper
  3. self.abstract = true
  4. self.type = 'mdn'
  5. self.links = {
  6. home: 'https://developer.mozilla.org',
  7. code: 'https://github.com/mdn/content'
  8. }
  9. html_filters.insert_before 'container', 'mdn/compat_tables' # needs access to <script type="application/json" id="hydration">
  10. html_filters.push 'mdn/clean_html'
  11. options[:container] = '#content > .main-page-content'
  12. options[:trailing_slash] = false
  13. options[:skip_link] = ->(link) {
  14. link['title'].try(:include?, 'not yet been written'.freeze) && !link['href'].try(:include?, 'transform-function'.freeze)
  15. }
  16. options[:attribution] = <<-HTML
  17. &copy; 2005&ndash;2023 MDN contributors.<br>
  18. Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
  19. HTML
  20. def get_latest_version(opts)
  21. get_latest_github_commit_date('mdn', 'content', opts)
  22. end
  23. end
  24. end