| @@ -1,7 +1,6 @@ |
| 1 | module Docs | 1 | module Docs |
| 2 | class Kotlin < UrlScraper | 2 | class Kotlin < UrlScraper |
| 3 | self.type = 'kotlin' | 3 | self.type = 'kotlin' |
| 4 | self.release = '1.4.10' | | |
| 5 | self.base_url = 'https://kotlinlang.org/' | 4 | self.base_url = 'https://kotlinlang.org/' |
| 6 | self.root_path = 'api/latest/jvm/stdlib/index.html' | 5 | self.root_path = 'api/latest/jvm/stdlib/index.html' |
| 7 | self.links = { | 6 | self.links = { |
| @@ -11,9 +10,8 @@ module Docs · 3 unmodified lines |
| 11 | | 10 | |
| 12 | html_filters.push 'kotlin/entries', 'kotlin/clean_html' | 11 | html_filters.push 'kotlin/entries', 'kotlin/clean_html' |
| 13 | | 12 | |
| 14 | options[:container] = '.global-content' | 13 | options[:container] = 'article' |
| 15 | | 14 | options[:only_patterns] = [/\Adocs\//, /\Aapi\/latest\/jvm\/stdlib\//] |
| 16 | options[:only_patterns] = [/\Adocs\/tutorials\//, /\Adocs\/reference\//, /\Aapi\/latest\/jvm\/stdlib\//] | | |
| 17 | options[:skip_patterns] = [/stdlib\/org\./] | 15 | options[:skip_patterns] = [/stdlib\/org\./] |
| 18 | options[:skip] = %w( | 16 | options[:skip] = %w( |
| 19 | api/latest/jvm/stdlib/alltypes/index.html | 17 | api/latest/jvm/stdlib/alltypes/index.html |
| @@ -22,23 +20,34 @@ module Docs · 2 unmodified lines |
| 22 | docs/events.html | 20 | docs/events.html |
| 23 | docs/resources.html | 21 | docs/resources.html |
| 24 | docs/reference/grammar.html) | 22 | docs/reference/grammar.html) |
| 25 | options[:replace_paths] = { | 23 | |
| 26 | 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html', | 24 | options[:fix_urls] = ->(url) do |
| 27 | 'docs/reference/coroutines.html' => 'docs/reference/coroutines-overview.html', | 25 | url.sub! %r{/docs/reference/}, '/docs/' |
| 28 | 'api/latest/jvm/stdlib/kotlin/fold.html' => 'api/latest/jvm/stdlib/kotlin.collections/fold.html', | 26 | url |
| 29 | 'api/latest/jvm/stdlib/kotlin/get-or-else.html' => 'api/latest/jvm/stdlib/kotlin.collections/get-or-else.html', | 27 | end |
| 30 | 'api/latest/jvm/stdlib/kotlin/map.html' => 'api/latest/jvm/stdlib/kotlin.collections/map.html', | | |
| 31 | 'docs/tutorials/native/targeting-multiple-platforms.html' => 'docs/tutorials/native/basic-kotlin-native-app.html', | | |
| 32 | 'api/latest/jvm/stdlib/kotlin/-throwable/print-stack-trace.html' => 'api/latest/jvm/stdlib/kotlin/print-stack-trace.html', | | |
| 33 | } | | |
| 34 | | 28 | |
| 35 | options[:attribution] = <<-HTML | 29 | options[:attribution] = <<-HTML |
| 36 | © 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors<br> | 30 | © 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors<br> |
| 37 | Licensed under the Apache License, Version 2.0. | 31 | Licensed under the Apache License, Version 2.0. |
| 38 | HTML | 32 | HTML |
| 39 | | 33 | |
| | 34 | version '1.6' do |
| | 35 | self.release = '1.6.0' |
| | 36 | end |
| | 37 | |
| | 38 | version '1.4' do |
| | 39 | self.release = '1.4.10' |
| | 40 | end |
| | 41 | |
| 40 | def get_latest_version(opts) | 42 | def get_latest_version(opts) |
| 41 | get_latest_github_release('JetBrains', 'kotlin', opts) | 43 | get_latest_github_release('JetBrains', 'kotlin', opts) |
| 42 | end | 44 | end |
| | 45 | |
| | 46 | private |
| | 47 | |
| | 48 | def process_response?(response) |
| | 49 | return false unless super |
| | 50 | response.body !~ /http-equiv="refresh"/i |
| | 51 | end |
| 43 | end | 52 | end |
| 44 | end | 53 | end |