Add Groovy documentation
Unified · Split
| @@ -1,4 +1,8 @@ | |||
| 1 | [ | 1 | [ |
| 2 | [ | ||
| 3 | "2020-12-07", | ||
| 4 | "New documentation: <a href=\"/groovy/\">Groovy</a>" | ||
| 5 | ], | ||
| 2 | [ | 6 | [ |
| 3 | "2020-12-04", | 7 | "2020-12-04", |
| 4 | "New documentation: <a href=\"/haproxy/\">HAProxy</a>" | 8 | "New documentation: <a href=\"/haproxy/\">HAProxy</a>" |
| @@ -341,6 +341,11 @@ credits = [ · 340 unmodified lines | |||
| 341 | '2008-2012 Chris Davis<br>© 2011-2016 The Graphite Project', | 341 | '2008-2012 Chris Davis<br>© 2011-2016 The Graphite Project', |
| 342 | 'Apache', | 342 | 'Apache', |
| 343 | 'https://raw.githubusercontent.com/graphite-project/graphite-web/master/LICENSE' | 343 | 'https://raw.githubusercontent.com/graphite-project/graphite-web/master/LICENSE' |
| 344 | ], [ | ||
| 345 | 'Groovy', | ||
| 346 | '2003-2020 The Apache Software Foundation', | ||
| 347 | 'Apache', | ||
| 348 | 'https://github.com/apache/groovy-website/blob/asf-site/LICENSE' | ||
| 344 | ], [ | 349 | ], [ |
| 345 | 'Grunt', | 350 | 'Grunt', |
| 346 | 'GruntJS Team', | 351 | 'GruntJS Team', |
| @@ -61,6 +61,7 @@ · 60 unmodified lines | |||
| 61 | 'pages/github', | 61 | 'pages/github', |
| 62 | 'pages/go', | 62 | 'pages/go', |
| 63 | 'pages/graphite', | 63 | 'pages/graphite', |
| 64 | 'pages/groovy', | ||
| 64 | 'pages/gnuplot', | 65 | 'pages/gnuplot', |
| 65 | 'pages/haproxy', | 66 | 'pages/haproxy', |
| 66 | 'pages/haskell', | 67 | 'pages/haskell', |
| @@ -0,0 +1,13 @@ | |||
| 1 | ._groovy { | ||
| 2 | padding-left: 1rem; | ||
| 3 | |||
| 4 | h1, h2 { margin-left: -1rem; } | ||
| 5 | h2 { @extend %block-heading; } | ||
| 6 | h3 { @extend %block-label; } | ||
| 7 | |||
| 8 | .constructor { @extend %label-blue; } | ||
| 9 | .method { @extend %label-blue; } | ||
| 10 | .element { @extend %label-green; } | ||
| 11 | .field { @extend %label-green; } | ||
| 12 | .enum_constant { @extend %label-orange; } | ||
| 13 | } | ||
| @@ -0,0 +1,97 @@ | |||
| 1 | module Docs | ||
| 2 | class Groovy | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def new_node(content) | ||
| 5 | node = Nokogiri::XML::Node.new 'h1', doc | ||
| 6 | node.content = content | ||
| 7 | node | ||
| 8 | end | ||
| 9 | |||
| 10 | def call | ||
| 11 | title = at_css('.title').content | ||
| 12 | @doc = at_css('.contentContainer') | ||
| 13 | doc.child.before new_node(title) | ||
| 14 | |||
| 15 | if root_page? | ||
| 16 | css('tr > td > a').each do |node| | ||
| 17 | node.parent.content = node.content | ||
| 18 | end | ||
| 19 | end | ||
| 20 | |||
| 21 | css('.subNav', '.bottomNav').remove | ||
| 22 | |||
| 23 | css('hr + br', 'p + br', 'div + br', 'hr').remove | ||
| 24 | |||
| 25 | css('table').each do |node| | ||
| 26 | node.remove_attribute 'summary' | ||
| 27 | node.remove_attribute 'cellspacing' | ||
| 28 | node.remove_attribute 'cellpadding' | ||
| 29 | node.remove_attribute 'border' | ||
| 30 | end | ||
| 31 | |||
| 32 | # Move anchor name/id to heading tag | ||
| 33 | css('a[name] + h3').each do |node| | ||
| 34 | node['id'] = node.previous_element['name'] | ||
| 35 | end | ||
| 36 | |||
| 37 | css('a[name] + ul.blockListLast').each do |node| | ||
| 38 | node.at_css('li > h4')['id'] = node.previous_element['name'] | ||
| 39 | end | ||
| 40 | |||
| 41 | # Tag constructors, methods, and elements before removing context tags | ||
| 42 | css('#constructor_detail').each do |node| | ||
| 43 | node.parent.css('h4').each do |n| | ||
| 44 | n['class'] = 'constructor' | ||
| 45 | end | ||
| 46 | end | ||
| 47 | |||
| 48 | css('#method_detail').each do |node| | ||
| 49 | node.parent.css('h4').each do |n| | ||
| 50 | n['class'] = 'method' | ||
| 51 | end | ||
| 52 | end | ||
| 53 | |||
| 54 | css('#element_detail').each do |node| | ||
| 55 | node.parent.css('h4').each do |n| | ||
| 56 | n['class'] = 'element' | ||
| 57 | end | ||
| 58 | end | ||
| 59 | |||
| 60 | css('#field_detail').each do |node| | ||
| 61 | node.parent.css('h4').each do |n| | ||
| 62 | n['class'] = 'field' | ||
| 63 | end | ||
| 64 | end | ||
| 65 | |||
| 66 | css('#enum_constant_detail').each do |node| | ||
| 67 | node.parent.css('h4').each do |n| | ||
| 68 | n['class'] = 'enum_constant' | ||
| 69 | end | ||
| 70 | end | ||
| 71 | |||
| 72 | # Flatten and remove unnecessary intermediate tags | ||
| 73 | css('ul.blockList > li.blockList', 'ul.blockListLast > li.blockList').each do |node| | ||
| 74 | node.before(node.children).remove | ||
| 75 | end | ||
| 76 | |||
| 77 | css('ul.blockList', 'ul.blockListLast').each do |node| | ||
| 78 | node.before(node.children).remove | ||
| 79 | end | ||
| 80 | |||
| 81 | css('ul.blockList > table').each do |node| | ||
| 82 | node.parent.before(node).remove | ||
| 83 | end | ||
| 84 | |||
| 85 | css('h3', 'h4').each do |node| | ||
| 86 | node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } | ||
| 87 | end | ||
| 88 | |||
| 89 | css('pre').each do |node| | ||
| 90 | node['data-language'] = 'groovy' | ||
| 91 | end | ||
| 92 | |||
| 93 | doc | ||
| 94 | end | ||
| 95 | end | ||
| 96 | end | ||
| 97 | end | ||
| @@ -0,0 +1,28 @@ | |||
| 1 | module Docs | ||
| 2 | class Groovy | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | slug.split('/').last | ||
| 6 | end | ||
| 7 | |||
| 8 | def get_type | ||
| 9 | slug.split('/')[0..-2].join('.') | ||
| 10 | end | ||
| 11 | |||
| 12 | def include_default_entry? | ||
| 13 | slug.split('/').last != 'package-summary' | ||
| 14 | end | ||
| 15 | |||
| 16 | def additional_entries | ||
| 17 | entries = [] | ||
| 18 | css('.method, .element, .field, .enum_constant').each do |node| | ||
| 19 | entries << [@name + '.' + node['id'], node['id']] | ||
| 20 | end | ||
| 21 | css('.constructor').each do |node| | ||
| 22 | entries << [node['id'], node['id']] | ||
| 23 | end | ||
| 24 | entries | ||
| 25 | end | ||
| 26 | end | ||
| 27 | end | ||
| 28 | end | ||
| @@ -0,0 +1,46 @@ | |||
| 1 | module Docs | ||
| 2 | class Groovy < UrlScraper | ||
| 3 | self.type = 'groovy' | ||
| 4 | self.root_path = 'overview-summary.html' | ||
| 5 | self.links = { | ||
| 6 | home: 'https://groovy-lang.org/', | ||
| 7 | code: 'https://github.com/apache/groovy' | ||
| 8 | } | ||
| 9 | |||
| 10 | html_filters.push 'groovy/clean_html', 'groovy/entries' | ||
| 11 | |||
| 12 | options[:skip] = %w( | ||
| 13 | index-all.html | ||
| 14 | deprecated-list.html | ||
| 15 | help-doc.html | ||
| 16 | ) | ||
| 17 | options[:skip_patterns] = [ | ||
| 18 | /\Aindex.html/ | ||
| 19 | ] | ||
| 20 | |||
| 21 | options[:attribution] = <<-HTML | ||
| 22 | © 2003-2020 The Apache Software Foundation<br> | ||
| 23 | Licensed under the Apache license. | ||
| 24 | HTML | ||
| 25 | |||
| 26 | version '3.0' do | ||
| 27 | self.release = '3.0.7' | ||
| 28 | self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/" | ||
| 29 | end | ||
| 30 | |||
| 31 | version '2.5' do | ||
| 32 | self.release = '2.5.14' | ||
| 33 | self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/" | ||
| 34 | end | ||
| 35 | |||
| 36 | version '2.4' do | ||
| 37 | self.release = '2.4.21' | ||
| 38 | self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/" | ||
| 39 | end | ||
| 40 | |||
| 41 | def get_latest_version(opts) | ||
| 42 | doc = fetch_doc('https://groovy.apache.org/download.html', opts) | ||
| 43 | doc.at_css('#big-download-button').content.split(' ').last | ||
| 44 | end | ||
| 45 | end | ||
| 46 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://docs.groovy-lang.org/latest/html/gapi/groovy.ico | ||