History

Update filters

Jasper van Merle committed 7 years ago

Commit 12f102e1 parent 38d1f043 files · +20 −3Browse files

Unified · Split

3 files
  1. lib/docs/filters/kotlin/clean_html.rb +7 −0
  2. lib/docs/filters/kotlin/entries.rb +3 −1
  3. lib/docs/scrapers/kotlin.rb +10 −2
lib/docs/filters/kotlin/clean_html.rb+7−0
@@ -46,6 +46,13 @@ module Docs · 45 unmodified lines
46 parent.content = parent.content46 parent.content = parent.content
47 parent['data-language'] = 'kotlin'47 parent['data-language'] = 'kotlin'
48 end48 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
49 end56 end
50 end57 end
51 end58 end
lib/docs/filters/kotlin/entries.rb+3−1
@@ -5,7 +5,9 @@ module Docs · 4 unmodified lines
5 if subpath.start_with?('api')5 if subpath.start_with?('api')
6 breadcrumbs[1..-1].join('.')6 breadcrumbs[1..-1].join('.')
7 else7 else
8 (at_css('h1') || at_css('h2')).content8 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')
9 end11 end
10 end12 end
11 13
lib/docs/scrapers/kotlin.rb+10−2
@@ -22,10 +22,18 @@ module Docs · 21 unmodified lines
22 docs/events.html22 docs/events.html
23 docs/resources.html23 docs/resources.html
24 docs/reference/grammar.html)24 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 }
26 34
27 options[:attribution] = <<-HTML35 options[:attribution] = <<-HTML
28 &copy; 2010&ndash;2018 JetBrains s.r.o.<br>36 &copy; 2010&ndash;2019 JetBrains s.r.o.<br>
29 Licensed under the Apache License, Version 2.0.37 Licensed under the Apache License, Version 2.0.
30 HTML38 HTML
31 39