Improved manual page for ul(1)

Jonathan de Boyne Pollard J.deBoynePollard-newsgroups at NTLWorld.com
Tue Nov 8 09:18:19 UTC 2016


Jonathan de Boyne Pollard:

> And more interesting is whether less could be fixed to make groff's 
> overstrikes work.  Or groff fixed to not need overstrikes for things 
> that can be done in Unicode ...
>
It turns out that this is the man command limiting things. Again.  It's 
hardwiring -Tascii even if it detects a UTF-8 character locale.

I'm experimenting with this preliminary patch, applied on top of the 
patch at http://jdebp.eu./Softwares/nosh/italics-in-manuals.html#FreeBSD 
. The preliminary results are encouraging, although I haven't yet tried 
an ISO8859-1 locale on a Latin-1 terminal.  A UTF-8 locale produces 
Unicode bullets on a UTF-8 terminal, and an ASCII locale produces the 
old overstrikes on an ASCII terminal.

OpenBSD's man actually supports a -T option outright.  That's also worth 
thinking about.

--- usr.bin/man/man.sh.patch1	2016-05-16 14:26:03.474372847 +0100
+++ usr.bin/man/man.sh	2016-11-08 08:40:50.406495179 +0000
@@ -316,23 +316,23 @@
  	# device flag (-T) we have to pass to eqn(1) and groff(1). Then,
  	# setup the pipeline of commands based on the user's request.
  
+	# I don't pretend to know this; I'm just copying from the
+	# previous version of man(1).
+	case "$man_charset" in
+	KOI8-R)		nroff_dev="koi8-r" ;;
+	ISO8859-1)	nroff_dev="latin1" ;;
+	ISO8859-15)	nroff_dev="latin1" ;;
+	UTF-8)		nroff_dev="utf8" ;;
+	*)		nroff_dev="ascii" ;;
+	esac
+
+	NROFF="$NROFF -T$nroff_dev"
+	EQN="$EQN -T$nroff_dev"
+
  	# If the manpage is from a particular charset, we need to setup nroff
  	# to properly output for the correct device.
  	case "${manpage}" in
  	*.${man_charset}/*)
-		# I don't pretend to know this; I'm just copying from the
-		# previous version of man(1).
-		case "$man_charset" in
-		KOI8-R)		nroff_dev="koi8-r" ;;
-		ISO8859-1)	nroff_dev="latin1" ;;
-		ISO8859-15)	nroff_dev="latin1" ;;
-		UTF-8)		nroff_dev="utf8" ;;
-		*)		nroff_dev="ascii" ;;
-		esac
-
-		NROFF="$NROFF -T$nroff_dev"
-		EQN="$EQN -T$nroff_dev"
-
  		# Iff the manpage is from the locale and not just the charset,
  		# then we need to define the locale string.
  		case "${manpage}" in
@@ -351,9 +351,7 @@
  			eval "$tool=\${${tool}_$l:-\$$tool}"
  		done
  		;;
-	*)	NROFF="$NROFF -Tascii"
-		EQN="$EQN -Tascii"
-		;;
+	*)	;;
  	esac
  
  	if [ -z "$MANCOLOR" ] && [ -z "$MANITALIC" ]; then



More information about the freebsd-hackers mailing list