mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Merge pull request #2308 from freeCodeCamp/man
Some checks failed
Deploy / Deploy to Heroku (push) Has been cancelled
Some checks failed
Deploy / Deploy to Heroku (push) Has been cancelled
Add Linux man pages documentation
This commit is contained in:
commit
5c82069d89
8 changed files with 81 additions and 0 deletions
|
@ -1,4 +1,8 @@
|
||||||
[
|
[
|
||||||
|
[
|
||||||
|
"2024-08-20",
|
||||||
|
"New documentation: <a href=\"/man/\">Linux man pages</a>"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"2024-07-28",
|
"2024-07-28",
|
||||||
"New documentation: <a href=\"/opengl/\">OpenGL</a>"
|
"New documentation: <a href=\"/opengl/\">OpenGL</a>"
|
||||||
|
|
|
@ -142,6 +142,13 @@ $GS = '/usr/local/opt/ghostscript/bin/gs'; # GhostScript
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## Man
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wget --recursive --no-parent https://man7.org/linux/man-pages/
|
||||||
|
mv man7.org/linux/man-pages/ docs/man/
|
||||||
|
```
|
||||||
|
|
||||||
## NumPy
|
## NumPy
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
20
lib/docs/filters/man/clean_html.rb
Normal file
20
lib/docs/filters/man/clean_html.rb
Normal file
|
@ -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
|
32
lib/docs/filters/man/entries.rb
Normal file
32
lib/docs/filters/man/entries.rb
Normal file
|
@ -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
|
16
lib/docs/scrapers/man.rb
Normal file
16
lib/docs/scrapers/man.rb
Normal file
|
@ -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
|
BIN
public/icons/docs/man/16.png
Normal file
BIN
public/icons/docs/man/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 431 B |
BIN
public/icons/docs/man/16@2x.png
Normal file
BIN
public/icons/docs/man/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
2
public/icons/docs/man/SOURCE
Normal file
2
public/icons/docs/man/SOURCE
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
https://mirrors.edge.kernel.org/images/favicon.ico
|
||||||
|
https://commons.wikimedia.org/wiki/File:Tux.svg CC0
|
Loading…
Reference in a new issue