mirror of https://github.com/freeCodeCamp/devdocs
parent
b3e5849297
commit
216a9d8f8e
@ -0,0 +1,4 @@
|
||||
._kubernetes {
|
||||
@extend %simple;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
module Docs
|
||||
class Kubernetes
|
||||
class CleanHtmlFilter < Filter
|
||||
|
||||
def call
|
||||
|
||||
# remove the API Operations section from the docs
|
||||
# by removing the h2 of id=Opetations
|
||||
# and all the preceding elements
|
||||
css('#Operations ~ *').remove
|
||||
css('#Operations').remove
|
||||
|
||||
doc
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
module Docs
|
||||
class Kubernetes
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
name
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entries = css('h2').to_a()
|
||||
# remove the Operations section
|
||||
entries.filter! {|node| node['id'] != 'Operations' }
|
||||
# remove the ObjectList section
|
||||
entries.filter! {|node| node['id'] != name + 'List' }
|
||||
# remove the Object section, most of the documents start with (h1.Pod => h2.Pod h2.PodSpec ...)
|
||||
entries.filter! {|node| node['id'] != name }
|
||||
|
||||
entries.map do |node|
|
||||
# split all names into YAML object notation (ConfigMapSpec) ==> (ConfigMap.Spec)
|
||||
child_name = node.content
|
||||
if child_name.starts_with?(name) && child_name.length > name.length
|
||||
child_name = name + child_name.sub(name, '.')
|
||||
end
|
||||
|
||||
[child_name, node['id']]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,46 @@
|
||||
module Docs
|
||||
class Kubernetes < UrlScraper
|
||||
self.name = 'Kubernetes'
|
||||
self.type = 'kubernetes'
|
||||
self.root_path = '/'
|
||||
self.links = {
|
||||
home: 'https://kubernetes.io/',
|
||||
code: 'https://github.com/kubernetes/kubernetes'
|
||||
}
|
||||
self.release = "1.23"
|
||||
|
||||
# https://kubernetes.io/docs/reference/kubernetes-api/
|
||||
html_filters.push 'kubernetes/entries', 'kubernetes/clean_html'
|
||||
|
||||
# options[:max_image_size] = 300_000
|
||||
options[:container] = '.td-content'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2022 The Kubernetes Authors | Documentation Distributed under CC BY 4.0 <br>
|
||||
Copyright © 2022 The Linux Foundation ®. All rights reserved.
|
||||
HTML
|
||||
|
||||
# latest version has a special URL that does not include the version identifier
|
||||
version '1.23' do
|
||||
self.release = "#{version}"
|
||||
self.base_url = "https://kubernetes.io/docs/reference/kubernetes-api/"
|
||||
end
|
||||
|
||||
version '1.20' do
|
||||
self.release = "#{version}"
|
||||
verStr = version.sub('.', '-')
|
||||
self.base_url = "https://v#{verStr}.docs.kubernetes.io/docs/reference/kubernetes-api/"
|
||||
end
|
||||
|
||||
version '1.19' do
|
||||
self.release = "#{version}"
|
||||
verStr = version.sub('.', '-')
|
||||
self.base_url = "https://v#{verStr}.docs.kubernetes.io/docs/reference/kubernetes-api/"
|
||||
end
|
||||
|
||||
def get_latest_version(opts)
|
||||
get_latest_github_release('kubernetes', 'kubernetes', opts)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 790 B |
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1 @@
|
||||
https://cncf-branding.netlify.app/projects/kubernetes/
|
Loading…
Reference in new issue