mirror of https://github.com/freeCodeCamp/devdocs
Added documentation for the Kotlin programming language. The documentation comes from the [Kotlin Standard Library documentation](https://kotlinlang.org/api/latest/jvm/stdlib/index.html) at the [official Kotlin website](https://kotlinlang.org). It is all licensed under the [Apache License, Version 2.0](https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE).pull/417/head
parent
0f2d774984
commit
999a927bd0
@ -0,0 +1,9 @@
|
|||||||
|
module Docs
|
||||||
|
class Kotlin
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,51 @@
|
|||||||
|
module Docs
|
||||||
|
class Kotlin
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
def get_name
|
||||||
|
if at_css('h1')
|
||||||
|
name = at_css('h1').text
|
||||||
|
module_name = breadcrumbs[1]
|
||||||
|
|
||||||
|
"#{module_name}.#{name}"
|
||||||
|
elsif at_css('h2')
|
||||||
|
at_css('h2').text.gsub 'Package ', ''
|
||||||
|
elsif at_css('h3')
|
||||||
|
at_css('h3').text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_type
|
||||||
|
if package? || top_level? && !extensions?
|
||||||
|
breadcrumbs[1]
|
||||||
|
else
|
||||||
|
"miscellaneous"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def breadcrumbs
|
||||||
|
container = at_css('.api-docs-breadcrumbs')
|
||||||
|
|
||||||
|
if container
|
||||||
|
links = container.children.select.with_index { |_, i| i.even? }
|
||||||
|
links.map &:text
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def top_level?
|
||||||
|
breadcrumbs.size == 3
|
||||||
|
end
|
||||||
|
|
||||||
|
def extensions?
|
||||||
|
get_name.start_with? 'Extensions'
|
||||||
|
end
|
||||||
|
|
||||||
|
def package?
|
||||||
|
breadcrumbs.size == 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
module Docs
|
||||||
|
class Kotlin < UrlScraper
|
||||||
|
self.type = 'kotlin'
|
||||||
|
self.release = '1.0.2'
|
||||||
|
self.base_url = 'https://kotlinlang.org/api/latest/jvm/stdlib/'
|
||||||
|
self.root_path = 'index.html'
|
||||||
|
self.links = {
|
||||||
|
home: 'https://kotlinlang.org/',
|
||||||
|
code: 'https://github.com/JetBrains/kotlin'
|
||||||
|
}
|
||||||
|
|
||||||
|
html_filters.push 'kotlin/entries', 'kotlin/clean_html'
|
||||||
|
|
||||||
|
options[:container] = '.page-content'
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
© 2016 JetBrains<br>
|
||||||
|
Licensed under the Apache License, Version 2.0.
|
||||||
|
HTML
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1 @@
|
|||||||
|
https://upload.wikimedia.org/wikipedia/commons/b/b5/Kotlin-logo.png
|
Loading…
Reference in new issue