| @@ -1,7 +1,6 @@ |
| 1 | 1 | module Docs |
| 2 | 2 | class Kotlin < UrlScraper |
| 3 | 3 | self.type = 'kotlin' |
| 4 | | − self.release = '1.4.10' |
| 5 | 4 | self.base_url = 'https://kotlinlang.org/' |
| 6 | 5 | self.root_path = 'api/latest/jvm/stdlib/index.html' |
| 7 | 6 | self.links = { |
| @@ -11,9 +10,8 @@ module Docs · 3 unmodified lines |
| 11 | 10 | |
| 12 | 11 | html_filters.push 'kotlin/entries', 'kotlin/clean_html' |
| 13 | 12 | |
| 14 | | − options[:container] = '.global-content' |
| 15 | | − |
| 16 | | − options[:only_patterns] = [/\Adocs\/tutorials\//, /\Adocs\/reference\//, /\Aapi\/latest\/jvm\/stdlib\//] |
| 13 | + options[:container] = 'article' |
| 14 | + options[:only_patterns] = [/\Adocs\//, /\Aapi\/latest\/jvm\/stdlib\//] |
| 17 | 15 | options[:skip_patterns] = [/stdlib\/org\./] |
| 18 | 16 | options[:skip] = %w( |
| 19 | 17 | api/latest/jvm/stdlib/alltypes/index.html |
| @@ -22,23 +20,34 @@ module Docs · 2 unmodified lines |
| 22 | 20 | docs/events.html |
| 23 | 21 | docs/resources.html |
| 24 | 22 | docs/reference/grammar.html) |
| 25 | | − options[:replace_paths] = { |
| 26 | | − 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html', |
| 27 | | − 'docs/reference/coroutines.html' => 'docs/reference/coroutines-overview.html', |
| 28 | | − 'api/latest/jvm/stdlib/kotlin/fold.html' => 'api/latest/jvm/stdlib/kotlin.collections/fold.html', |
| 29 | | − 'api/latest/jvm/stdlib/kotlin/get-or-else.html' => 'api/latest/jvm/stdlib/kotlin.collections/get-or-else.html', |
| 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 | | − } |
| 23 | + |
| 24 | + options[:fix_urls] = ->(url) do |
| 25 | + url.sub! %r{/docs/reference/}, '/docs/' |
| 26 | + url |
| 27 | + end |
| 34 | 28 | |
| 35 | 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 | 31 | Licensed under the Apache License, Version 2.0. |
| 38 | 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 | 42 | def get_latest_version(opts) |
| 41 | 43 | get_latest_github_release('JetBrains', 'kotlin', opts) |
| 42 | 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 | 52 | end |
| 44 | 53 | end |