1
0

kotlin.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. module Docs
  2. class Kotlin < UrlScraper
  3. self.type = 'kotlin'
  4. self.base_url = 'https://kotlinlang.org/'
  5. self.root_path = 'api/latest/jvm/stdlib/index.html'
  6. self.links = {
  7. home: 'https://kotlinlang.org/',
  8. code: 'https://github.com/JetBrains/kotlin'
  9. }
  10. html_filters.push 'kotlin/entries', 'kotlin/clean_html'
  11. options[:container] = 'article'
  12. options[:only_patterns] = [/\Adocs\//, /\Aapi\/latest\/jvm\/stdlib\//]
  13. options[:skip_patterns] = [/stdlib\/org\./]
  14. options[:skip] = %w(
  15. api/latest/jvm/stdlib/alltypes/index.html
  16. docs/
  17. docs/videos.html
  18. docs/events.html
  19. docs/resources.html
  20. docs/reference/grammar.html)
  21. options[:fix_urls] = ->(url) do
  22. url.sub! %r{/docs/reference/}, '/docs/'
  23. url
  24. end
  25. options[:attribution] = <<-HTML
  26. &copy; 2010&ndash;2021 JetBrains s.r.o. and Kotlin Programming Language contributors<br>
  27. Licensed under the Apache License, Version 2.0.
  28. HTML
  29. version '1.6' do
  30. self.release = '1.6.0'
  31. end
  32. version '1.4' do
  33. self.release = '1.4.10'
  34. end
  35. def get_latest_version(opts)
  36. get_latest_github_release('JetBrains', 'kotlin', opts)
  37. end
  38. private
  39. def process_response?(response)
  40. return false unless super
  41. response.body !~ /http-equiv="refresh"/i
  42. end
  43. end
  44. end