History

Add documentation for Spring Boot

Aymen Hosni committed 6 years ago

Commit f4b66061 parent 4eb4bfe7 files · +68 −-2Browse files

Unified · Split

7 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  2. lib/docs/filters/spring_boot/clean_html.rb +15 −0
  3. lib/docs/filters/spring_boot/entries.rb +21 −0
  4. lib/docs/scrapers/spring_boot.rb +28 −0
  5. public/icons/docs/spring_boot/16.png +0 −0
  6. public/icons/docs/spring_boot/16@2x.png +0 −0
  7. public/icons/docs/spring_boot/SOURCE +1 −0
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -821,5 +821,10 @@ credits = [ · 820 unmodified lines
821 '2008-2017 by Yii Software LLC',821 '2008-2017 by Yii Software LLC',
822 'BSD',822 'BSD',
823 'https://raw.githubusercontent.com/yiisoft/yii/master/LICENSE'823 'https://raw.githubusercontent.com/yiisoft/yii/master/LICENSE'
824 ], [
825 'Spring Boot',
826 '2002 - 2020 Pivotal, Inc. All Rights Reserved.',
827 'Apache License 2.0',
828 'https://raw.githubusercontent.com/spring-projects/spring-boot/master/LICENSE.txt'
824 ]829 ]
825]830]
lib/docs/filters/spring_boot/clean_html.rb+15−0
@@ -0,0 +1,15 @@
1module Docs
2 class SpringBoot
3 class CleanHtmlFilter < Filter
4 def call
5
6 css('pre').each do |node|
7 language = node.children.first['data-lang'] if node.children.first.name == 'code'
8 node['data-language'] = language
9 end
10
11 doc
12 end
13 end
14 end
15end
lib/docs/filters/spring_boot/entries.rb+21−0
@@ -0,0 +1,21 @@
1module Docs
2 class SpringBoot
3 class EntriesFilter < Docs::EntriesFilter
4
5 def get_type
6 slug.gsub('-', ' ').capitalize
7 end
8
9 def additional_entries
10 css('td a[href], li a[href]').each_with_object [] do |node, entries|
11 next if root_page?
12 next if node['href'].start_with?('http')
13 name = node.content.strip
14 id = node['href'].remove('#')
15 next if id.blank?
16 entries << [name, id, get_type]
17 end
18 end
19 end
20 end
21end
lib/docs/scrapers/spring_boot.rb+28−0
@@ -0,0 +1,28 @@
1module Docs
2 class SpringBoot < UrlScraper
3 self.name = 'Spring Boot'
4 self.slug = 'spring_boot'
5 self.type = 'simple'
6 self.release = '2.3.0.RELEASE'
7 self.base_url = 'https://docs.spring.io/spring-boot/docs/current/reference/html/'
8 self.root_path = "index.html"
9 self.links = {
10 home: 'https://spring.io/',
11 code: 'https://github.com/spring-projects/spring-boot'
12 }
13
14 html_filters.push 'spring_boot/entries', 'spring_boot/clean_html'
15
16 options[:skip_patterns] = [/legal/]
17
18 options[:attribution] = <<-HTML
19 Copyright &copy; 2002 - 2020 Pivotal, Inc. All Rights Reserved.
20 HTML
21
22 def get_latest_version(opts)
23 doc = fetch_doc('https://docs.spring.io/spring-boot/docs/current/reference/html/legal.html', opts)
24 table = doc.at_css('#content p').inner_text
25 end
26
27 end
28end
public/icons/docs/spring_boot/16.png+0−0

Binary file not shown.

public/icons/docs/spring_boot/16@2x.png+0−0

Binary file not shown.

public/icons/docs/spring_boot/SOURCE+1−0
@@ -0,0 +1 @@
1https://spring.io/trademarks