Add bazel doc

pull/2101/head
Yikai Zhao 1 year ago
parent ab9aeb2622
commit 169651c1b7

@ -0,0 +1,17 @@
module Docs
class Bazel
class CleanHtmlFilter < Filter
def call
css('.devsite-article-meta').remove
css('devsite-feature-tooltip').remove
css('devsite-thumb-rating').remove
css('devsite-toc').remove
css('a.button-with-icon').remove
css('button.devsite-heading-link').remove
doc
end
end
end
end

@ -0,0 +1,37 @@
module Docs
class Bazel
class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').content.strip
end
def get_type
"Build encyclopedia"
end
def additional_entries
entries = []
special_page_types = {
'functions' => 'Function',
'make-variables' => 'Make Variable',
'common-definitions' => 'Common Definition',
}
page_type = special_page_types[subpath]
unless page_type.nil?
# only first ul
at_css('.devsite-article-body > ul').css('li > a').each do |node|
entries << [node.content.strip, node['href'].sub('#', ''), page_type]
end
end
css('h2#rules + ul > li > a').each do |node|
entries << [node.content.strip, node['href'].sub('#', ''), "Rule"]
end
entries
end
end
end
end

@ -0,0 +1,50 @@
module Docs
class Bazel < UrlScraper
self.name = 'Bazel'
self.type = 'bazel'
html_filters.push 'bazel/entries', 'bazel/clean_html'
options[:skip] = %w(platform)
options[:container] = "devsite-content"
options[:attribution] = <<-HTML
Licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.
HTML
version '7.0' do
self.release = '7.0.0'
self.base_url = 'https://bazel.build/versions/7.0.0/reference/be/'
end
version '6.4' do
self.release = '6.4.0'
self.base_url = 'https://bazel.build/versions/6.4.0/reference/be/'
end
version '6.3' do
self.release = '6.3.0'
self.base_url = 'https://bazel.build/versions/6.3.0/reference/be/'
end
version '6.2' do
self.release = '6.2.0'
self.base_url = 'https://bazel.build/versions/6.2.0/reference/be/'
end
version '6.1' do
self.release = '6.1.0'
self.base_url = 'https://bazel.build/versions/6.1.0/reference/be/'
end
version '6.0' do
self.release = '6.0.0'
self.base_url = 'https://bazel.build/versions/6.0.0/reference/be/'
end
def get_latest_version(opts)
get_latest_github_release('bazelbuild', 'bazel', opts)
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1 @@
https://upload.wikimedia.org/wikipedia/en/7/7d/Bazel_logo.svg
Loading…
Cancel
Save