Skip to content

Commit 12f102e

Browse files
committed
Update filters
1 parent 38d1f04 commit 12f102e

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

lib/docs/filters/kotlin/clean_html.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ def api_page
4646
parent.content = parent.content
4747
parent['data-language'] = 'kotlin'
4848
end
49+
50+
css('.tags').each do |wrapper|
51+
platforms = wrapper.css('.platform:not(.tag-value-Common)').to_a
52+
platforms = platforms.map { |node| "#{node.content} (#{node['data-tag-version']})" }
53+
platforms = "<b>Platform and version requirements:</b> #{platforms.join ", "}"
54+
wrapper.replace(platforms)
55+
end
4956
end
5057
end
5158
end

lib/docs/filters/kotlin/entries.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ def get_name
55
if subpath.start_with?('api')
66
breadcrumbs[1..-1].join('.')
77
else
8-
(at_css('h1') || at_css('h2')).content
8+
node = (at_css('h1') || at_css('h2'))
9+
return node.content unless node.nil?
10+
subpath[/\/([a-z0-9_-]+)\./][1..-2].titleize.sub('Faq', 'FAQ')
911
end
1012
end
1113

lib/docs/scrapers/kotlin.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ class Kotlin < UrlScraper
2222
docs/events.html
2323
docs/resources.html
2424
docs/reference/grammar.html)
25-
options[:replace_paths] = { 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.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+
}
2634

2735
options[:attribution] = <<-HTML
28-
&copy; 2010&ndash;2018 JetBrains s.r.o.<br>
36+
&copy; 2010&ndash;2019 JetBrains s.r.o.<br>
2937
Licensed under the Apache License, Version 2.0.
3038
HTML
3139

0 commit comments

Comments
 (0)