Unified · Split
| @@ -2,6 +2,8 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class SaltStack |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | + css('.headerlink').remove | |
| 6 | + | |
| 5 | 7 | doc |
| 6 | 8 | end |
| 7 | 9 | end |
| @@ -1,12 +1,27 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class SaltStack |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | + SALT_REF_RGX = /salt\.([^\.]+)\.([^\s]+)/ | |
| 5 | + | |
| 4 | 6 | def get_name |
| 5 | − at_css('h1').content | |
| 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 | |
| 6 | 16 | end |
| 7 | 17 | |
| 8 | 18 | def get_type |
| 9 | − 'TODO' | |
| 19 | + type, _ = slug.split('/', 2) | |
| 20 | + type | |
| 21 | + end | |
| 22 | + | |
| 23 | + def include_default_entry? | |
| 24 | + !subpath.end_with?('index.html') | |
| 10 | 25 | end |
| 11 | 26 | end |
| 12 | 27 | end |
| @@ -1,9 +1,14 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class SaltStack < UrlScraper |
| 3 | + self.type = 'salt_stack' | |
| 3 | 4 | self.release = '2018.3.2' |
| 4 | 5 | self.base_url = 'https://docs.saltstack.com/en/latest/ref/' |
| 5 | 6 | |
| 6 | − html_filters.push 'salt_stack/entries', 'salt_stack/clean_html' | |
| 7 | + html_filters.push 'salt_stack/clean_html', 'salt_stack/entries' | |
| 8 | + | |
| 9 | + options[:only_patterns] = [ | |
| 10 | + %r{[^/]+/all/} | |
| 11 | + ] | |
| 7 | 12 | |
| 8 | 13 | options[:container] = '.body-content' |
| 9 | 14 | |