From 47a48973a2dbc1fe3a6adc24881e03d81cde5495 Mon Sep 17 00:00:00 2001 From: Rocco Bruyn Date: Sun, 14 Jul 2019 13:13:28 +0200 Subject: [PATCH 1/2] update kotlin version to 1.3.41 --- lib/docs/scrapers/kotlin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/kotlin.rb b/lib/docs/scrapers/kotlin.rb index 415393d1..7a22d98d 100644 --- a/lib/docs/scrapers/kotlin.rb +++ b/lib/docs/scrapers/kotlin.rb @@ -1,7 +1,7 @@ module Docs class Kotlin < UrlScraper self.type = 'kotlin' - self.release = '1.2.41' + self.release = '1.3.41' self.base_url = 'https://kotlinlang.org/' self.root_path = 'api/latest/jvm/stdlib/index.html' self.links = { From 12f102e0da2cf4e76c85875a97ac46468e0f59c6 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Tue, 6 Aug 2019 00:59:09 +0200 Subject: [PATCH 2/2] Update filters --- lib/docs/filters/kotlin/clean_html.rb | 7 +++++++ lib/docs/filters/kotlin/entries.rb | 4 +++- lib/docs/scrapers/kotlin.rb | 12 ++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/docs/filters/kotlin/clean_html.rb b/lib/docs/filters/kotlin/clean_html.rb index 3ea049a3..6343e8ab 100644 --- a/lib/docs/filters/kotlin/clean_html.rb +++ b/lib/docs/filters/kotlin/clean_html.rb @@ -46,6 +46,13 @@ module Docs parent.content = parent.content parent['data-language'] = 'kotlin' end + + css('.tags').each do |wrapper| + platforms = wrapper.css('.platform:not(.tag-value-Common)').to_a + platforms = platforms.map { |node| "#{node.content} (#{node['data-tag-version']})" } + platforms = "Platform and version requirements: #{platforms.join ", "}" + wrapper.replace(platforms) + end end end end diff --git a/lib/docs/filters/kotlin/entries.rb b/lib/docs/filters/kotlin/entries.rb index 71f83327..2afb1e86 100644 --- a/lib/docs/filters/kotlin/entries.rb +++ b/lib/docs/filters/kotlin/entries.rb @@ -5,7 +5,9 @@ module Docs if subpath.start_with?('api') breadcrumbs[1..-1].join('.') else - (at_css('h1') || at_css('h2')).content + node = (at_css('h1') || at_css('h2')) + return node.content unless node.nil? + subpath[/\/([a-z0-9_-]+)\./][1..-2].titleize.sub('Faq', 'FAQ') end end diff --git a/lib/docs/scrapers/kotlin.rb b/lib/docs/scrapers/kotlin.rb index c68e9041..8707aee5 100644 --- a/lib/docs/scrapers/kotlin.rb +++ b/lib/docs/scrapers/kotlin.rb @@ -22,10 +22,18 @@ module Docs docs/events.html docs/resources.html docs/reference/grammar.html) - options[:replace_paths] = { 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html' } + options[:replace_paths] = { + 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html', + 'docs/reference/coroutines.html' => 'docs/reference/coroutines-overview.html', + 'api/latest/jvm/stdlib/kotlin/fold.html' => 'api/latest/jvm/stdlib/kotlin.collections/fold.html', + 'api/latest/jvm/stdlib/kotlin/get-or-else.html' => 'api/latest/jvm/stdlib/kotlin.collections/get-or-else.html', + 'api/latest/jvm/stdlib/kotlin/map.html' => 'api/latest/jvm/stdlib/kotlin.collections/map.html', + 'docs/tutorials/native/targeting-multiple-platforms.html' => 'docs/tutorials/native/basic-kotlin-native-app.html', + 'api/latest/jvm/stdlib/kotlin/-throwable/print-stack-trace.html' => 'api/latest/jvm/stdlib/kotlin/print-stack-trace.html', + } options[:attribution] = <<-HTML - © 2010–2018 JetBrains s.r.o.
+ © 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0. HTML