mirror of https://github.com/freeCodeCamp/devdocs
commit
5c82069d89
@ -0,0 +1,20 @@
|
||||
module Docs
|
||||
class Man
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.page-top').remove
|
||||
css('.nav-bar').remove
|
||||
css('.nav-end').remove
|
||||
css('.sec-table').remove
|
||||
css('a[href="#top_of_page"]').remove
|
||||
css('.end-man-text').remove
|
||||
css('.start-footer').remove
|
||||
css('.footer').remove
|
||||
css('.end-footer').remove
|
||||
css('.statcounter').remove
|
||||
css('form[action="https://www.google.com/search"]').remove
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,32 @@
|
||||
module Docs
|
||||
class Man
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
|
||||
@@TYPES = {}
|
||||
|
||||
def get_name
|
||||
return slug.split('/').last.sub(/\.(\d[^.]*)\z/, ' (\1)') if slug.start_with?('man')
|
||||
at_css('h1').content.sub(' — Linux manual page', '')
|
||||
end
|
||||
|
||||
def get_type
|
||||
build_types if slug == 'dir_by_project'
|
||||
@@TYPES[slug] or 'Linux manual page'
|
||||
end
|
||||
|
||||
def build_types
|
||||
type0 = nil
|
||||
css('*').each do |node|
|
||||
if node.name == 'h2'
|
||||
type0 = node.content
|
||||
elsif node.name == 'a' and node['href'] and node['href'].start_with?('man') and type0
|
||||
# name = node.content + node.next_sibling.content
|
||||
slug0 = node['href'].remove(/\.html\z/)
|
||||
@@TYPES[slug0] = type0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,16 @@
|
||||
module Docs
|
||||
class Man < FileScraper
|
||||
self.name = 'Linux man pages'
|
||||
self.type = 'simple'
|
||||
self.slug = 'man'
|
||||
self.base_url = "https://man7.org/linux/man-pages/"
|
||||
self.initial_paths = %w(dir_by_project.html)
|
||||
self.links = {
|
||||
home: 'https://man7.org/linux/man-pages/',
|
||||
}
|
||||
html_filters.push 'man/entries', 'man/clean_html'
|
||||
options[:attribution] = <<-HTML
|
||||
...
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 431 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,2 @@
|
||||
https://mirrors.edge.kernel.org/images/favicon.ico
|
||||
https://commons.wikimedia.org/wiki/File:Tux.svg CC0
|
Loading…
Reference in new issue