Unified · Split
| @@ -142,6 +142,13 @@ $GS = '/usr/local/opt/ghostscript/bin/gs'; # GhostScript · 141 unmodified lines | |||
| 142 | ``` | 142 | ``` |
| 143 | </details> | 143 | </details> |
| 144 | 144 | ||
| 145 | ## Man | ||
| 146 | |||
| 147 | ```sh | ||
| 148 | wget --recursive --no-parent https://man7.org/linux/man-pages/ | ||
| 149 | mv man7.org/linux/man-pages/ docs/man/ | ||
| 150 | ``` | ||
| 151 | |||
| 145 | ## NumPy | 152 | ## NumPy |
| 146 | 153 | ||
| 147 | ```sh | 154 | ```sh |
| @@ -0,0 +1,19 @@ | |||
| 1 | module Docs | ||
| 2 | class Man | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | css('.page-top').remove | ||
| 6 | css('.nav-bar').remove | ||
| 7 | css('.nav-end').remove | ||
| 8 | css('.sec-table').remove | ||
| 9 | css('a[href="#top_of_page"]').remove | ||
| 10 | css('.end-man-text').remove | ||
| 11 | css('.start-footer').remove | ||
| 12 | css('.footer').remove | ||
| 13 | css('.end-footer').remove | ||
| 14 | css('form[action="https://www.google.com/search"]').remove | ||
| 15 | doc | ||
| 16 | end | ||
| 17 | end | ||
| 18 | end | ||
| 19 | end | ||
| @@ -0,0 +1,29 @@ | |||
| 1 | module Docs | ||
| 2 | class Man | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | |||
| 5 | def get_name | ||
| 6 | at_css('h1').content.sub(' — Linux manual page', '') | ||
| 7 | end | ||
| 8 | |||
| 9 | def get_type | ||
| 10 | 'Linux manual page' | ||
| 11 | end | ||
| 12 | |||
| 13 | def entries | ||
| 14 | return super unless slug == 'dir_by_project' | ||
| 15 | type0 = nil | ||
| 16 | return css('*').each_with_object [] do |node, entries| | ||
| 17 | if node.name == 'h2' | ||
| 18 | type0 = node.content | ||
| 19 | elsif node.name == 'a' and node['href'] and node['href'].start_with?('man') and type0 | ||
| 20 | name = node.content + node.next_sibling.content | ||
| 21 | path = node['href'] | ||
| 22 | entries << Entry.new(name, path, type0) | ||
| 23 | end | ||
| 24 | end | ||
| 25 | end | ||
| 26 | |||
| 27 | end | ||
| 28 | end | ||
| 29 | end | ||
| @@ -0,0 +1,16 @@ | |||
| 1 | module Docs | ||
| 2 | class Man < FileScraper | ||
| 3 | self.name = 'Linux man pages' | ||
| 4 | self.type = 'simple' | ||
| 5 | self.slug = 'man' | ||
| 6 | self.base_url = "https://man7.org/linux/man-pages/" | ||
| 7 | self.initial_paths = %w(dir_by_project.html) | ||
| 8 | self.links = { | ||
| 9 | home: 'https://man7.org/linux/man-pages/', | ||
| 10 | } | ||
| 11 | html_filters.push 'man/entries', 'man/clean_html' | ||
| 12 | options[:attribution] = <<-HTML | ||
| 13 | ... | ||
| 14 | HTML | ||
| 15 | end | ||
| 16 | end | ||