From af1f4c0dd2be6ef797879d99a3beca2672f1b490 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Wed, 12 Feb 2025 13:22:00 +0100 Subject: [PATCH] Drop mandoc, pandoc can read mdoc now; styling; guestbook --- .gitignore | 16 ++++++++-------- Makefile | 40 ++++++++++++++++++++-------------------- README.md | 3 +-- dat/guestbook.md | 15 +++++++++++++++ dat/ncdu.md | 2 +- mdocproc.pl | 17 +++++++++++++++++ pub/style.css | 8 ++++++-- 7 files changed, 68 insertions(+), 33 deletions(-) create mode 100755 mdocproc.pl diff --git a/.gitignore b/.gitignore index 6ea891e..4bf061c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,8 @@ dat/ncdu/changes2.log dat/ncdu/changes2.md dat/ncdu/man.md dat/ncdu/man.mdoc +dat/ncdu/man/1_1.man dat/ncdu/man/1_1.md -dat/ncdu/man/1_1.mdoc dat/ncdu/man/1_10.md dat/ncdu/man/1_10.pod dat/ncdu/man/1_11.md @@ -43,24 +43,24 @@ dat/ncdu/man/1_18.md dat/ncdu/man/1_18.pod dat/ncdu/man/1_19.md dat/ncdu/man/1_19.pod +dat/ncdu/man/1_2.man dat/ncdu/man/1_2.md -dat/ncdu/man/1_2.mdoc dat/ncdu/man/1_20.md dat/ncdu/man/1_20.mdoc dat/ncdu/man/1_21.md dat/ncdu/man/1_21.mdoc +dat/ncdu/man/1_3.man dat/ncdu/man/1_3.md -dat/ncdu/man/1_3.mdoc +dat/ncdu/man/1_4.man dat/ncdu/man/1_4.md -dat/ncdu/man/1_4.mdoc +dat/ncdu/man/1_5.man dat/ncdu/man/1_5.md -dat/ncdu/man/1_5.mdoc +dat/ncdu/man/1_6.man dat/ncdu/man/1_6.md -dat/ncdu/man/1_6.mdoc +dat/ncdu/man/1_7.man dat/ncdu/man/1_7.md -dat/ncdu/man/1_7.mdoc +dat/ncdu/man/1_8.man dat/ncdu/man/1_8.md -dat/ncdu/man/1_8.mdoc dat/ncdu/man/1_9.md dat/ncdu/man/1_9.pod dat/ncdu/man/2_0.md diff --git a/Makefile b/Makefile index e18bf7b..273cf64 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # If no $URL is given or the $URL is '-', then the input file is assumed to be # in dat/, otherwise it will be fetched from $URL. # -# A $title should be given for .pod, .log and .mdoc files, it is ignored for +# A $title should be given for .pod, .log, .mdoc and .man files, it is ignored for # .md files because those already have a title embedded in the file. # # Supported file types: @@ -13,7 +13,7 @@ # .pod: Perl's Plain Old Documentation, converted through HTML into a .md # file which is then converted into .html again with the proper template. # .log: A ChangeLog-formatted file, converted through .md into .html. -# .mdoc: mandoc manual page, converted through .md into .html. +# .mdoc / .man: manual page, converted through .md into .html. PAGES=\ "contributing.md"\ "doc.md"\ @@ -75,14 +75,14 @@ PAGES=\ "ncdu/man/1_11.pod https://g.blicky.net/ncdu.git/plain/doc/ncdu.pod?h=v1.11 Ncdu 1.11 Manual"\ "ncdu/man/1_10.pod https://g.blicky.net/ncdu.git/plain/doc/ncdu.pod?h=v1.10 Ncdu 1.10 Manual"\ "ncdu/man/1_9.pod https://g.blicky.net/ncdu.git/plain/doc/ncdu.pod?h=v1.9 Ncdu 1.9 Manual"\ - "ncdu/man/1_8.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.8 Ncdu 1.8 Manual"\ - "ncdu/man/1_7.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.7 Ncdu 1.7 Manual"\ - "ncdu/man/1_6.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.6 Ncdu 1.6 Manual"\ - "ncdu/man/1_5.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.5 Ncdu 1.5 Manual"\ - "ncdu/man/1_4.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.4 Ncdu 1.4 Manual"\ - "ncdu/man/1_3.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.3 Ncdu 1.3 Manual"\ - "ncdu/man/1_2.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.2 Ncdu 1.2 Manual"\ - "ncdu/man/1_1.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.1 Ncdu 1.1 Manual"\ + "ncdu/man/1_8.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.8 Ncdu 1.8 Manual"\ + "ncdu/man/1_7.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.7 Ncdu 1.7 Manual"\ + "ncdu/man/1_6.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.6 Ncdu 1.6 Manual"\ + "ncdu/man/1_5.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.5 Ncdu 1.5 Manual"\ + "ncdu/man/1_4.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.4 Ncdu 1.4 Manual"\ + "ncdu/man/1_3.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.3 Ncdu 1.3 Manual"\ + "ncdu/man/1_2.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.2 Ncdu 1.2 Manual"\ + "ncdu/man/1_1.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.1 Ncdu 1.1 Manual"\ "ncdu/scr.md"\ "nginx-confgen.md"\ "nginx-confgen/changes.log https://g.blicky.net/nginx-confgen.git/plain/ChangeLog nginx-confgen Release History"\ @@ -141,8 +141,11 @@ CHANGES_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.log' # List of .md files generated from .mdoc files MDOC_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.mdoc' | sed -E 's/(.+)\.mdoc$$/dat\/\1.md/'; done) +# List of .md files generated from .man files +MAN_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.man' | sed -E 's/(.+)\.man$$/dat\/\1.md/'; done) + # All fetched & generated files -CLEAN := dat/download.md ${FETCH} ${POD_MD} ${CHANGES_MD} ${MDOC_MD} ${HTML_OUT} ${FEEDS} +CLEAN := dat/download.md ${FETCH} ${POD_MD} ${CHANGES_MD} ${MDOC_MD} ${MAN_MD} ${HTML_OUT} ${FEEDS} .PHONY: all clean @@ -180,18 +183,15 @@ ${CHANGES_MD}: dat/%.md: dat/%.log mkchangelog.pl @./mkchangelog.pl "$*" "${shell for i in ${PAGES}; do case "$$i" in "$*.log "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}" <"$<" >"$@" -# pandoc doesn't support mdoc directly. Going through a `mandoc -T man` tends -# to generate nicer formatting than `mandoc -T markdown`, though any links -# appear to get lost. Going through `mandoc -T html` is also an option, but -# pandoc makes quite a mess of that. ${MDOC_MD}: dat/%.md: dat/%.mdoc @echo "MDOC $*" @(echo "% ${shell for i in ${PAGES}; do case "$$i" in "$*.mdoc "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}";\ - mandoc -T man "$<" |\ - pandoc -f man -t markdown |\ - sed -E -e 's/(^|[ ,.])([a-zA-Z0-9-]+)\(([1-8])\)/\1[\2(\3)](https:\/\/manned.org\/man\/\2.\3)/g' \ - -e 's/\*\*(https:[^[:space:]]+)\*\*/[\1](\1)/g' \ - ) >"$@" + pandoc -f mdoc -t markdown $< | ./mdocproc.pl ) >"$@" + +${MAN_MD}: dat/%.md: dat/%.man + @echo "MAN $*" + @(echo "% ${shell for i in ${PAGES}; do case "$$i" in "$*.man "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}";\ + pandoc -f man -t markdown $< | ./mdocproc.pl ) >"$@" dat/download.md: mkdlpage.pl pub/download/*.sha256 diff --git a/README.md b/README.md index 1cbee7c..329a7e2 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,4 @@ Build-time: - curl - Perl (+ Pod::Simple) - TUWF -- pandoc (>= 3.1.10 for better man page formatting) -- mandoc +- pandoc (>= 3.6) diff --git a/dat/guestbook.md b/dat/guestbook.md index e95bdbd..9feca0d 100644 --- a/dat/guestbook.md +++ b/dat/guestbook.md @@ -17,6 +17,21 @@ respective issue tracker or send a mail to # Entries +`2025-01-12` - alkatraz445 +: Absolutely lovely tool. Did the thing fast and quit even quicker. Instant recommendation + +`2025-01-01` - ~ +: Happy New Year! Thanks for NCDU! + +`2025-01-01` - CirqueForge +: Happy New Year and I hope you have a great 2025 and beyond. On Christmas + Day 2024, I released source code for software tools publicly that has + quietly used yxml for quite a number of years privately. Thank you for the + development and effort you put into the project. + +`2024-12-29` - tetz +: ncdu is great! Thank you! + `2024-11-31` - NocFA : Thanks for your incredible software, NCDU has been in my sysadmin toolkit for years. Appreciate incredible FOSS developers like you making the world a better place, one piece of quality software at a time. diff --git a/dat/ncdu.md b/dat/ncdu.md index c07f9c6..345013e 100644 --- a/dat/ncdu.md +++ b/dat/ncdu.md @@ -88,7 +88,7 @@ Ncdu has been packaged for quite a few systems, here's a list of the ones I am a [GNU Guix](https://guix.gnu.org/packages/N/) - [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/ncdu/default.nix) - [OpenBSD](https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/ncdu/) - -[openSUSE](https://software.opensuse.org//download.html?project=utilities&package=ncdu). +[openSUSE](https://software.opensuse.org//download.html?project=utilities&package=ncdu) - [OpenWRT](https://openwrt.org/packages/pkgdata/ncdu) - MacOS ([Fink](https://pdb.finkproject.org/pdb/package.php/ncdu) - [Homebrew](https://formulae.brew.sh/formula/ncdu) - [MacPorts](https://ports.macports.org/search/?q=ncdu&name=on)) - [Solaris](https://www.opencsw.org/packages/ncdu) - diff --git a/mdocproc.pl b/mdocproc.pl new file mode 100755 index 0000000..47720a1 --- /dev/null +++ b/mdocproc.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +use v5.36; + +my $insyn = 0; +while (<>) { + $insyn = /^# SYNOPSIS$/ if /^#/; + if ($insyn) { + # Improve styling of synopsis + s/\\\[`/[`/g; + s/\\]/]<\/span>/g; + } else { + # Turn man page references into links + s{\[([a-zA-Z0-9-]+)\(([1-8])\)\]\{\.Xr\}}{[$1($2)](https://manned.org/man/$1.$2)}g; + } + print; +} diff --git a/pub/style.css b/pub/style.css index fc40e68..ab78597 100644 --- a/pub/style.css +++ b/pub/style.css @@ -46,7 +46,7 @@ small { font-size: 9px; } } b, strong { font-weight: bold } -em, i, i a, em a { font-style: italic; font-size: inherit } +em, i, i a, em a, span.pa { font-style: italic; font-size: inherit } sup { font-size: 80%; font-weight: bold } a.footnoteRef { text-decoration: none } @@ -55,10 +55,12 @@ main h1 { font-size: 150%; color: #000; margin: 2em 0 .3em 0; text-decoration: n main h2 { font-size: 125%; color: #000; margin: 1em 0 .3em 0; text-decoration: none } main h3 { font-size: 120%; color: #000; margin: 1em 0 .3em 0; text-decoration: none } main code { font-family: monospace } +main code.Nm, main code.Fl { font-family: inherit; font-weight: bold } +main var { text-decoration: underline; white-space: nowrap } main pre { font-family: monospace; font-size: 80%; margin: 0 0 10px 18px; display: block; padding: 0 0 0 15px; border-left: 1px dotted #999; overflow-x: auto } main blockquote { font-size: 80%; margin: 0 0 10px 5px; display: block; padding: 0 0 0 10px; border-left: 1px dotted #999 } main pre * { font-size: inherit; font-family: inherit } -main p, main figure, main ul, main ol, main dl, main pre, main figure, main table, main form { margin-bottom: 0.7em; margin-left: 1em } +main p, main figure, main ul, main ol, main dl, main pre, main figure, main table, main form, main div.line-block { margin-bottom: 0.7em; margin-left: 1em } main ul ul { margin-bottom: 0.5em } main ul, main ol { margin-left: 2.5em } main li { margin-bottom: .1em } @@ -72,6 +74,8 @@ main td em { font-style: normal; text-decoration: underline } main table th { font-weight: bold } main textarea { width: 95% } main input[type="submit"] { padding: 1px 5px } +main .synopt { white-space: nowrap; margin: 1px 0 1px 30px } +main .Nm + .synopt { margin-left: 5px } main section.footnotes hr { display: none } main section.footnotes { margin: 40px 10px 10px 10px }