Add Salt Stack documentation
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', |
| @@ -0,0 +1,27 @@ | ||
| 1 | +module Docs | |
| 2 | + class SaltStack | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + if root_page? | |
| 6 | + doc.inner_html = '<h1>SaltStack</h1>' | |
| 7 | + return doc | |
| 8 | + end | |
| 9 | + | |
| 10 | + css('.headerlink').remove | |
| 11 | + | |
| 12 | + css('div[class^="highlight-"]').each do |node| | |
| 13 | + node.name = 'pre' | |
| 14 | + node['data-language'] = node['class'].scan(/highlight-([a-z]+)/i)[0][0] | |
| 15 | + node.content = node.content.strip | |
| 16 | + end | |
| 17 | + | |
| 18 | + css('.function > dt').each do |node| | |
| 19 | + node.name = 'h3' | |
| 20 | + node.content = node.content | |
| 21 | + end | |
| 22 | + | |
| 23 | + doc | |
| 24 | + end | |
| 25 | + end | |
| 26 | + end | |
| 27 | +end | |
| @@ -0,0 +1,38 @@ | ||
| 1 | +module Docs | |
| 2 | + class SaltStack | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + SALT_REF_RGX = /salt\.([^\.]+)\.([^\s]+)/ | |
| 5 | + | |
| 6 | + def get_name | |
| 7 | + header = at_css('h1').content | |
| 8 | + | |
| 9 | + ref_match = SALT_REF_RGX.match(header) | |
| 10 | + if ref_match | |
| 11 | + ns, mod = ref_match.captures | |
| 12 | + "#{ns}.#{mod}" | |
| 13 | + else | |
| 14 | + header | |
| 15 | + end | |
| 16 | + end | |
| 17 | + | |
| 18 | + def get_type | |
| 19 | + slug.split('/', 3)[1] | |
| 20 | + end | |
| 21 | + | |
| 22 | + def include_default_entry? | |
| 23 | + slug.split('/').last.start_with? 'salt' | |
| 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 | |
| 36 | + end | |
| 37 | + end | |
| 38 | +end | |
| @@ -0,0 +1,36 @@ | ||
| 1 | +module Docs | |
| 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 = 'saltstack' | |
| 14 | + self.release = '2019.2.0' | |
| 15 | + self.base_url = 'https://docs.saltstack.com/en/latest/' | |
| 16 | + self.root_path = 'ref/index.html' | |
| 17 | + self.links = { | |
| 18 | + home: 'https://www.saltstack.com/', | |
| 19 | + code: 'https://github.com/saltstack/salt' | |
| 20 | + } | |
| 21 | + | |
| 22 | + html_filters.push 'salt_stack/clean_html', 'salt_stack/entries' | |
| 23 | + | |
| 24 | + options[:only_patterns] = [/all\//] | |
| 25 | + options[:container] = '.body-content > .section' | |
| 26 | + | |
| 27 | + options[:attribution] = <<-HTML | |
| 28 | + © 2019 SaltStack.<br> | |
| 29 | + Licensed under the Apache License, Version 2.0. | |
| 30 | + HTML | |
| 31 | + | |
| 32 | + def get_latest_version(opts) | |
| 33 | + get_latest_github_release('saltstack', 'salt', opts) | |
| 34 | + end | |
| 35 | + end | |
| 36 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +https://github.com/saltstack/salt/blob/develop/doc/_static/salt-logo.svg | |