diff --git a/lib/docs/filters/ansible/clean_html.rb b/lib/docs/filters/ansible/clean_html.rb new file mode 100644 index 00000000..089d4d10 --- /dev/null +++ b/lib/docs/filters/ansible/clean_html.rb @@ -0,0 +1,19 @@ +module Docs + class Ansible + class CleanHtmlFilter < Filter + def call + # Remove 'Permalink to this headline' + css('.headerlink').remove + # Make proper table headers + css('th.head').each do |node| + node.name = 'th' + end + css('table').each do |node| + node.remove_attribute('border') + node.remove_attribute('cellpadding') + end + doc + end + end + end +end diff --git a/lib/docs/filters/ansible/entries.rb b/lib/docs/filters/ansible/entries.rb new file mode 100644 index 00000000..66582f58 --- /dev/null +++ b/lib/docs/filters/ansible/entries.rb @@ -0,0 +1,63 @@ +module Docs + class Ansible + class EntriesFilter < Docs::EntriesFilter + TYPES = { + 'intro' => 'Basic Topics', + 'modules' => 'Basic Topics', + 'common' => 'Basic Topics', + 'playbooks' => 'Playbooks', + 'become' => 'Playbooks', + 'test' => 'Playbooks', + 'YAMLSyntax' => 'Playbooks', + 'list' => 'Module Categories', + 'guide' => 'Advanced Topics', + 'developing' => 'Advanced Topics', + 'galaxy' => 'Advanced Topics' + } + + HIDE_SLUGS = [ + 'playbooks', + 'playbooks_special_topics', + 'list_of_all_modules.html', + 'modules_by_category', + 'modules' + ] + + def get_name + node = at_css('h1') + name = node.content.strip + case + when name.empty? + super + when slug.eql?('modules_intro') + name = 'Modules' + when name.eql?('Introduction') + name = '#Introduction' + when name.eql?('Getting Started') + name = '#Getting Started' + when name.eql?('Introduction To Ad-Hoc Commands') + name = 'Ad-Hoc Commands' + end + name + end + + def get_type + if HIDE_SLUGS.include?(slug) + type = nil + else + akey = slug.split('_').first + type = TYPES.key?(akey) ? TYPES[akey] : 'Modules Reference' + end + type + end + + def additional_entries + [] + end + + def include_default_entry? + true + end + end + end +end diff --git a/lib/docs/scrapers/ansible.rb b/lib/docs/scrapers/ansible.rb new file mode 100644 index 00000000..72c184c4 --- /dev/null +++ b/lib/docs/scrapers/ansible.rb @@ -0,0 +1,30 @@ +module Docs + class Ansible < UrlScraper + self.name = 'Ansible' + self.type = 'ansible' + self.release = '2.1.0' + self.base_url = 'http://docs.ansible.com/ansible/' + self.root_path = 'intro.html' + self.links = { + home: 'http://docs.ansible.com', + code: 'https://github.com/ansible/ansible' + } + + html_filters.push 'ansible/clean_html', 'ansible/entries' + + options[:title] = 'Ansible' + options[:container] = '#page-content' + options[:skip] = [ + 'glossary.html', + 'faq.html', + 'community.html', + 'tower.html', + 'quickstart.html' + ] + + options[:attribution] = <<-HTML + © Michael DeHaan
+ Licensed under the GNU General Public License v.3. + HTML + end +end diff --git a/public/icons/docs/ansible/16.png b/public/icons/docs/ansible/16.png new file mode 100644 index 00000000..fc4fd3fb Binary files /dev/null and b/public/icons/docs/ansible/16.png differ diff --git a/public/icons/docs/ansible/16@2x.png b/public/icons/docs/ansible/16@2x.png new file mode 100644 index 00000000..baa87a9d Binary files /dev/null and b/public/icons/docs/ansible/16@2x.png differ