kotlin.rb 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. module Docs
  2. class Kotlin < UrlScraper
  3. self.type = 'kotlin'
  4. self.release = '1.4.10'
  5. self.base_url = 'https://kotlinlang.org/'
  6. self.root_path = 'api/latest/jvm/stdlib/index.html'
  7. self.links = {
  8. home: 'https://kotlinlang.org/',
  9. code: 'https://github.com/JetBrains/kotlin'
  10. }
  11. html_filters.push 'kotlin/entries', 'kotlin/clean_html'
  12. options[:container] = '.global-content'
  13. options[:only_patterns] = [/\Adocs\/tutorials\//, /\Adocs\/reference\//, /\Aapi\/latest\/jvm\/stdlib\//]
  14. options[:skip_patterns] = [/stdlib\/org\./]
  15. options[:skip] = %w(
  16. api/latest/jvm/stdlib/alltypes/index.html
  17. docs/
  18. docs/videos.html
  19. docs/events.html
  20. docs/resources.html
  21. docs/reference/grammar.html)
  22. options[:replace_paths] = {
  23. 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html',
  24. 'docs/reference/coroutines.html' => 'docs/reference/coroutines-overview.html',
  25. 'api/latest/jvm/stdlib/kotlin/fold.html' => 'api/latest/jvm/stdlib/kotlin.collections/fold.html',
  26. 'api/latest/jvm/stdlib/kotlin/get-or-else.html' => 'api/latest/jvm/stdlib/kotlin.collections/get-or-else.html',
  27. 'api/latest/jvm/stdlib/kotlin/map.html' => 'api/latest/jvm/stdlib/kotlin.collections/map.html',
  28. 'docs/tutorials/native/targeting-multiple-platforms.html' => 'docs/tutorials/native/basic-kotlin-native-app.html',
  29. 'api/latest/jvm/stdlib/kotlin/-throwable/print-stack-trace.html' => 'api/latest/jvm/stdlib/kotlin/print-stack-trace.html',
  30. }
  31. options[:attribution] = <<-HTML
  32. &copy; 2010&ndash;2020 JetBrains s.r.o. and Kotlin Programming Language contributors<br>
  33. Licensed under the Apache License, Version 2.0.
  34. HTML
  35. def get_latest_version(opts)
  36. get_latest_github_release('JetBrains', 'kotlin', opts)
  37. end
  38. end
  39. end