lit.rb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. module Docs
  2. class Lit < UrlScraper
  3. self.name = 'Lit'
  4. self.slug = 'lit'
  5. self.type = 'lit'
  6. self.links = {
  7. home: 'https://lit.dev/',
  8. code: 'https://github.com/lit/lit/'
  9. }
  10. options[:container] = 'main'
  11. options[:max_image_size] = 250_000
  12. # Note: the copyright will change soon due to https://lit.dev/blog/2025-10-14-openjs/
  13. options[:attribution] = <<-HTML
  14. &copy; Google LLC<br>
  15. Licensed under the Creative Commons Attribution 3.0 Unported License.
  16. HTML
  17. options[:fix_urls] = ->(url) do
  18. # A name without any extension is assumed to be a directory.
  19. # example.com/foobar -> example.com/foobar/
  20. url.sub! /(\/[-a-z0-9]+)([#?]|$)/i, '\1/\2'
  21. url
  22. end
  23. # The order of the filters is important.
  24. # The entries filter is applied to the raw (mostly) unmodified HTML.
  25. # The clean_html filter reformats the HTML to the a more appropriate markup for devdocs.
  26. html_filters.push 'lit/entries', 'lit/clean_html'
  27. version '3' do
  28. self.release = '3.3.1'
  29. self.base_url = 'https://lit.dev/docs/'
  30. options[:skip_patterns] = [/v\d+\//]
  31. end
  32. version '2' do
  33. self.release = '2.8.0'
  34. self.base_url = 'https://lit.dev/docs/v2/'
  35. end
  36. version '1' do
  37. self.release = '1.0.1'
  38. self.base_url = 'https://lit.dev/docs/v1/'
  39. end
  40. def get_latest_version(opts)
  41. get_npm_version('lit', opts)
  42. end
  43. end
  44. end