Unified · Split
| @@ -638,6 +638,12 @@ credits = [ · 637 unmodified lines | ||
| 638 | 638 | 'MIT', |
| 639 | 639 | 'https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT' |
| 640 | 640 | ], [ |
| 641 | + 'Salt Stack', | |
| 642 | + '2019 SaltStack', | |
| 643 | + 'Apache', | |
| 644 | + 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE' | |
| 645 | + ], | |
| 646 | + [ | |
| 641 | 647 | 'Sass', |
| 642 | 648 | '2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein', |
| 643 | 649 | 'MIT', |
| @@ -4,6 +4,17 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def call |
| 5 | 5 | css('.headerlink').remove |
| 6 | 6 | |
| 7 | + css('div[class^="highlight-"]').each do |node| | |
| 8 | + node.name = 'pre' | |
| 9 | + node['data-language'] = node['class'].scan(/highlight-([a-z]+)/i)[0][0] | |
| 10 | + node.content = node.content.strip | |
| 11 | + end | |
| 12 | + | |
| 13 | + css('.function > dt').each do |node| | |
| 14 | + node.name = 'h3' | |
| 15 | + node.content = node.content | |
| 16 | + end | |
| 17 | + | |
| 7 | 18 | doc |
| 8 | 19 | end |
| 9 | 20 | end |
| @@ -16,12 +16,23 @@ module Docs · 15 unmodified lines | ||
| 16 | 16 | end |
| 17 | 17 | |
| 18 | 18 | def get_type |
| 19 | − slug.split('/', 2).first | |
| 19 | + slug.split('/', 3)[1] | |
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | def include_default_entry? |
| 23 | 23 | slug.split('/').last.start_with? 'salt' |
| 24 | 24 | end |
| 25 | + | |
| 26 | + def additional_entries | |
| 27 | + entries = [] | |
| 28 | + | |
| 29 | + css('.function > h3').each do |node| | |
| 30 | + name = node.content.remove('salt.').split('(')[0] + '()' | |
| 31 | + entries << [name, node['id']] | |
| 32 | + end | |
| 33 | + | |
| 34 | + entries | |
| 35 | + end | |
| 25 | 36 | end |
| 26 | 37 | end |
| 27 | 38 | end |
| @@ -1,8 +1,19 @@ | ||
| 1 | 1 | module Docs |
| 2 | − class SaltStack < UrlScraper | |
| 3 | − self.type = 'salt_stack' | |
| 4 | − self.release = '2018.3.2' | |
| 5 | − self.base_url = 'https://docs.saltstack.com/en/latest/ref/' | |
| 2 | + # The official documentation website is heavily rate-limited | |
| 3 | + # | |
| 4 | + # The documentation can be generated like this (replace 2019.2 with the correct tag): | |
| 5 | + # $ git clone https://github.com/saltstack/salt.git --branch 2019.2 --depth 1 | |
| 6 | + # $ cd salt/doc | |
| 7 | + # $ pip install sphinx | |
| 8 | + # $ make html | |
| 9 | + # | |
| 10 | + # The generated html can be found in salt/doc/_build/html | |
| 11 | + class SaltStack < FileScraper | |
| 12 | + self.type = 'simple' | |
| 13 | + self.slug = 'salt_stack' | |
| 14 | + self.release = '2019.2.0' | |
| 15 | + self.base_url = 'https://docs.saltstack.com/en/latest/' | |
| 16 | + self.root_path = 'ref/index.html' | |
| 6 | 17 | self.links = { |
| 7 | 18 | home: 'https://www.saltstack.com/', |
| 8 | 19 | code: 'https://github.com/saltstack/salt' |
| @@ -10,15 +21,16 @@ module Docs · 1 unmodified line | ||
| 10 | 21 | |
| 11 | 22 | html_filters.push 'salt_stack/clean_html', 'salt_stack/entries' |
| 12 | 23 | |
| 13 | − options[:only_patterns] = [ | |
| 14 | − %r{^[^/]+/all/} | |
| 15 | − ] | |
| 16 | − | |
| 17 | − options[:container] = '.body-content' | |
| 24 | + options[:only_patterns] = [/all\//] | |
| 25 | + options[:container] = '.body-content > .section' | |
| 18 | 26 | |
| 19 | 27 | options[:attribution] = <<-HTML |
| 20 | − © 2018 SaltStack.<br> | |
| 28 | + © 2019 SaltStack.<br> | |
| 21 | 29 | Licensed under the Apache License, Version 2.0. |
| 22 | 30 | HTML |
| 31 | + | |
| 32 | + def get_latest_version(opts) | |
| 33 | + get_latest_github_release('saltstack', 'salt', opts) | |
| 34 | + end | |
| 23 | 35 | end |
| 24 | 36 | end |