mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-05-31 23:06:33 +02:00
08207e93d8
We currently prefer the 'tty: link' style for representing URIs in man pages, as this falls back to _not_ displaying the URI where not supported, whereas the .UR macro generally does fall back to showing the URI, which has these disadvantages: - They're long, redundant, and interfere when reading text - With wrapping enabled with \: in the URI, it can become unclickable - Without wrapping enabled it interferes in adjacent text justification Note with groff >= 1.24 (March 2026), the .UR macro results in OSC 8 hyperlinks being used, and thus the awkward URI is not displayed. * man/viewman: Configure groff 1.23 to display .UR macros with OSC 8 hyperlinks. See: https://lists.gnu.org/r/coreutils/2026-05/msg00080.html
33 lines
777 B
Bash
Executable File
33 lines
777 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Generate and view man page with less, for passed command name
|
|
|
|
# Note to get man to behave like this you can also:
|
|
# export MANROFFOPT='-P-i -rU1'
|
|
# export LESS=-R
|
|
# export MANPAGER=less
|
|
|
|
unset GROFF_NO_SGR
|
|
|
|
hdir=$(dirname "$0")
|
|
|
|
CONFIG_HEADER="$hdir"/../lib/config.h
|
|
|
|
grep '^#define BOLD_MAN_REFS 1' $CONFIG_HEADER > /dev/null &&
|
|
BOLD_REFS=--bold-refs
|
|
|
|
man="$1"; cmd="$1"
|
|
test "$1" = 'test' && cmd='['
|
|
test "$1" = '[' && man='test'
|
|
test "$1" = 'install' && cmd='ginstall'
|
|
test "$1" = 'ginstall' && man='install'
|
|
|
|
"$hdir"/help2man \
|
|
--include="$hdir"/../man/$man.x \
|
|
$BOLD_REFS \
|
|
--loose-indent \
|
|
"$hdir"/../src/$cmd |
|
|
preconv | # convert utf-8 chars like in Author names to groff compat
|
|
groff -Tutf8 -man -P-i -rU1 -rLL=${MANWIDTH:-$COLUMNS}n |
|
|
less -R
|