Add Linux man pages documentation
Unified · Split
| @@ -1,4 +1,8 @@ | ||
| 1 | 1 | [ |
| 2 | + [ | |
| 3 | + "2024-08-20", | |
| 4 | + "New documentation: <a href=\"/man/\">Linux man pages</a>" | |
| 5 | + ], | |
| 2 | 6 | [ |
| 3 | 7 | "2024-07-28", |
| 4 | 8 | "New documentation: <a href=\"/opengl/\">OpenGL</a>" |
| @@ -142,6 +142,13 @@ $GS = '/usr/local/opt/ghostscript/bin/gs'; # GhostScript · 141 unmodified lines | ||
| 142 | 142 | ``` |
| 143 | 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 | 152 | ## NumPy |
| 146 | 153 | |
| 147 | 154 | ```sh |
| @@ -0,0 +1,20 @@ | ||
| 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('.statcounter').remove | |
| 15 | + css('form[action="https://www.google.com/search"]').remove | |
| 16 | + doc | |
| 17 | + end | |
| 18 | + end | |
| 19 | + end | |
| 20 | +end | |
| @@ -0,0 +1,32 @@ | ||
| 1 | +module Docs | |
| 2 | + class Man | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + | |
| 5 | + @@TYPES = {} | |
| 6 | + | |
| 7 | + def get_name | |
| 8 | + return slug.split('/').last.sub(/\.(\d[^.]*)\z/, ' (\1)') if slug.start_with?('man') | |
| 9 | + at_css('h1').content.sub(' — Linux manual page', '') | |
| 10 | + end | |
| 11 | + | |
| 12 | + def get_type | |
| 13 | + build_types if slug == 'dir_by_project' | |
| 14 | + @@TYPES[slug] or 'Linux manual page' | |
| 15 | + end | |
| 16 | + | |
| 17 | + def build_types | |
| 18 | + type0 = nil | |
| 19 | + css('*').each do |node| | |
| 20 | + if node.name == 'h2' | |
| 21 | + type0 = node.content | |
| 22 | + elsif node.name == 'a' and node['href'] and node['href'].start_with?('man') and type0 | |
| 23 | + # name = node.content + node.next_sibling.content | |
| 24 | + slug0 = node['href'].remove(/\.html\z/) | |
| 25 | + @@TYPES[slug0] = type0 | |
| 26 | + end | |
| 27 | + end | |
| 28 | + end | |
| 29 | + | |
| 30 | + end | |
| 31 | + end | |
| 32 | +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 | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1,2 @@ | ||
| 1 | +https://mirrors.edge.kernel.org/images/favicon.ico | |
| 2 | +https://commons.wikimedia.org/wiki/File:Tux.svg CC0 | |