Unified · Split
| @@ -0,0 +1,60 @@ | |||
| 1 | module Docs | ||
| 2 | class Varnish | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | TYPE_BY_SLUG = {} | ||
| 5 | |||
| 6 | def call | ||
| 7 | if root_page? | ||
| 8 | css('.section').each do |node| | ||
| 9 | type = node.at_css('h2').content[0..-2] | ||
| 10 | node.css('li > a').each do |n| | ||
| 11 | s = n['href'].split('/')[-2] | ||
| 12 | TYPE_BY_SLUG[s] = type | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| 16 | super | ||
| 17 | end | ||
| 18 | |||
| 19 | def get_name | ||
| 20 | at_css('h1').content[0..-2] | ||
| 21 | end | ||
| 22 | |||
| 23 | def get_type | ||
| 24 | case slug | ||
| 25 | when /installation/ | ||
| 26 | 'Installation' | ||
| 27 | when /users-guide/ | ||
| 28 | 'Users Guide' | ||
| 29 | when /tutorial/ | ||
| 30 | 'Tutorial' | ||
| 31 | when /reference/ | ||
| 32 | 'Reference Manual' | ||
| 33 | when /dev-guide/ | ||
| 34 | 'Dev Guide' | ||
| 35 | else | ||
| 36 | TYPE_BY_SLUG[slug.split('/').first] || 'Other' | ||
| 37 | end | ||
| 38 | end | ||
| 39 | |||
| 40 | def include_default_entry? | ||
| 41 | slug != 'reference/' | ||
| 42 | end | ||
| 43 | |||
| 44 | def additional_entries | ||
| 45 | entries = [] | ||
| 46 | |||
| 47 | css('dl.class > dt[id]').each do |node| | ||
| 48 | name = node['id'].split('.').last | ||
| 49 | id = node['id'] | ||
| 50 | type = node['id'].split('.')[0..-2].join('.') | ||
| 51 | entries << [name, id, type] | ||
| 52 | end | ||
| 53 | |||
| 54 | |||
| 55 | entries | ||
| 56 | end | ||
| 57 | |||
| 58 | end | ||
| 59 | end | ||
| 60 | end | ||
| @@ -0,0 +1,40 @@ | |||
| 1 | module Docs | ||
| 2 | class Varnish < UrlScraper | ||
| 3 | self.name = 'Varnish' | ||
| 4 | self.type = 'sphinx' | ||
| 5 | |||
| 6 | self.root_path = 'index.html' | ||
| 7 | self.links = { | ||
| 8 | home: 'https://varnish-cache.org/', | ||
| 9 | code: 'https://github.com/varnishcache/varnish-cache' | ||
| 10 | } | ||
| 11 | |||
| 12 | |||
| 13 | html_filters.push 'varnish/entries', 'sphinx/clean_html' | ||
| 14 | |||
| 15 | options[:container] = '.body > section' | ||
| 16 | |||
| 17 | |||
| 18 | options[:skip] = %w(genindex.html search.html) | ||
| 19 | |||
| 20 | options[:skip_patterns] = [/phk/, /glossary/, /whats-new/] | ||
| 21 | |||
| 22 | |||
| 23 | options[:attribution] = <<-HTML | ||
| 24 | Copyright © 2006 Verdens Gang AS<br> | ||
| 25 | Copyright © 2006–2020 Varnish Software AS<br> | ||
| 26 | Licensed under the BSD-2-Clause License. | ||
| 27 | HTML | ||
| 28 | |||
| 29 | version do | ||
| 30 | self.release = '7.3.0' | ||
| 31 | self.base_url = 'https://varnish-cache.org/docs/7.3/' | ||
| 32 | end | ||
| 33 | |||
| 34 | def get_latest_version(opts) | ||
| 35 | contents = get_github_file_contents('varnishcache', 'varnish-cache', 'doc/changes.rst', opts) | ||
| 36 | contents.scan(/Varnish\s+Cache\s+([0-9.]+)/)[0][0] | ||
| 37 | end | ||
| 38 | |||
| 39 | end | ||
| 40 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://www.varnish-software.com/branding/ | ||