Skip to content

Commit

Permalink
Merge pull request #2101 from blahgeek/add-doc-bazel
Browse files Browse the repository at this point in the history
Add bazel doc
  • Loading branch information
simon04 authored Jan 5, 2024
2 parents d5f82e9 + 0e10f24 commit 55fe9b2
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/javascripts/news.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
[
"2024-01-05",
"New documentation: <a href=\"/bazel/\">Bazel</a>"
],
[
"2023-10-09",
"New documentations: <a href=\"/hapi/\">hapi</a>, <a href=\"/joi/\">joi</a>, <a href=\"/nushell/\">Nushell</a>, <a href=\"/varnish/\">Varnish</a>"
Expand Down
2 changes: 2 additions & 0 deletions assets/stylesheets/components/_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
&._page-error { position: static; }

> h1,
> article > h1,
> header > h1,
> section > h1 {
@extend ._lined-heading;
}
> h1:first-child,
> article:first-of-type > h1,
> header:first-of-type > h1,
> section:first-of-type > h1 {
margin-top: 0;
Expand Down
17 changes: 17 additions & 0 deletions lib/docs/filters/bazel/clean_html.rb
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions lib/docs/filters/bazel/entries.rb
Original file line number Diff line number Diff line change
@@ -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
50 changes: 50 additions & 0 deletions lib/docs/scrapers/bazel.rb
Original file line number Diff line number Diff line change
@@ -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 added public/icons/docs/bazel/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/docs/bazel/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/docs/bazel/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://upload.wikimedia.org/wikipedia/en/7/7d/Bazel_logo.svg

0 comments on commit 55fe9b2

Please sign in to comment.