diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 0243afeb..fbd30021 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -76,6 +76,7 @@ 'pages/liquid', 'pages/love', 'pages/lua', + 'pages/man', 'pages/mariadb', 'pages/mdn', 'pages/meteor', diff --git a/assets/stylesheets/pages/_man.scss b/assets/stylesheets/pages/_man.scss new file mode 100644 index 00000000..40bc3132 --- /dev/null +++ b/assets/stylesheets/pages/_man.scss @@ -0,0 +1,75 @@ +._man { + .mandoc { + @extend %code; + white-space: unset; + } + + // from https://manpages.debian.org/testing/darktable/darktable.1.en.html + .Bd-indent { + margin-left: 3.8em; + } + + .Bl-bullet { + list-style-type: disc; + padding-left: 1em; + } + .Bl-dash { + list-style-type: none; + padding-left: 0em; + } + .Bl-dash > li:before { + content: "\2014 "; + } + .Bl-item { + list-style-type: none; + padding-left: 0em; + } + .Bl-compact > li { + margin-top: 0em; + } + + .Bl-enum { + padding-left: 2em; + } + .Bl-compact > li { + margin-top: 0em; + } + + .Bl-diag > dt { + font-style: normal; + font-weight: bold; + } + .Bl-diag > dd { + margin-left: 0em; + } + .Bl-hang > dd { + margin-left: 5.5em; + } + .Bl-inset > dd { + margin-left: 0em; + } + .Bl-ohang > dd { + margin-left: 0em; + } + .Bl-tag { + margin-left: 5.5em; + } + .Bl-tag > dt { + float: left; + margin-top: 0em; + margin-left: -5.5em; + padding-right: 1.2em; + vertical-align: top; + } + .Bl-tag > dd { + clear: right; + width: 100%; + margin-top: 0em; + margin-left: 0em; + vertical-align: top; + overflow: auto; + } + .Bl-compact > dt { + margin-top: 0em; + } +} diff --git a/lib/docs/filters/man/clean_html.rb b/lib/docs/filters/man/clean_html.rb new file mode 100644 index 00000000..90ae0c90 --- /dev/null +++ b/lib/docs/filters/man/clean_html.rb @@ -0,0 +1,10 @@ +module Docs + class Man + class CleanHtmlFilter < Filter + def call + css('.anchor', '.panels', '.paneljump', 'table.head').remove + doc + end + end + end +end diff --git a/lib/docs/filters/man/entries.rb b/lib/docs/filters/man/entries.rb new file mode 100644 index 00000000..dc4d3371 --- /dev/null +++ b/lib/docs/filters/man/entries.rb @@ -0,0 +1,17 @@ +module Docs + class Man + class EntriesFilter < Docs::EntriesFilter + def get_name + if slug.match?(/[1-9].en$/) + doc.document.title.split('—').first.strip + else + slug.split('/').first + end + end + + def get_type + slug.split('/').first + end + end + end +end diff --git a/lib/docs/scrapers/man.rb b/lib/docs/scrapers/man.rb new file mode 100644 index 00000000..5df3bc0f --- /dev/null +++ b/lib/docs/scrapers/man.rb @@ -0,0 +1,21 @@ +module Docs + class Man < UrlScraper + self.name = 'Debian man pages' + self.slug = 'man' + self.type = 'man' + self.base_url = 'https://manpages.debian.org/testing/' + self.links = { + home: 'https://manpages.debian.org/', + code: 'https://github.com/Debian/debiman/' + } + + html_filters.push 'man/entries', 'man/clean_html', 'title' + + options[:container] = '#content' + options[:skip_patterns] = [/src:/, /en.gz$/, /[1-9]$/, /^lib/] + + options[:attribution] = <<-HTML + Debian Manpages generated using https://github.com/Debian/debiman/ + HTML + end +end diff --git a/public/icons/docs/man/16.png b/public/icons/docs/man/16.png new file mode 100644 index 00000000..2fc1c045 Binary files /dev/null and b/public/icons/docs/man/16.png differ diff --git a/public/icons/docs/man/16@2x.png b/public/icons/docs/man/16@2x.png new file mode 100644 index 00000000..e89893ee Binary files /dev/null and b/public/icons/docs/man/16@2x.png differ diff --git a/public/icons/docs/man/SOURCE b/public/icons/docs/man/SOURCE new file mode 100644 index 00000000..aec07b6d --- /dev/null +++ b/public/icons/docs/man/SOURCE @@ -0,0 +1 @@ +https://manpages.debian.org/favicon.ico