From 503708058b529218e0166cfdb579490ab4265503 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 26 Feb 2008 09:55:32 +0000 Subject: [PATCH] Initial checkin of some changes related to making PS/PDF output from "man -l -Tps" look better. The current changes: - render synopsis and verbatim sections in a monospace/code font - put a light-grey background behind all programlisting, screen, and literallayout instances - prevent SH heads in PS output from being rendered in uppercase (as they are in console output) - also display xrefs to SH heads in PS output in normal case (instead of uppercase) - draw a line under SH heads in PS output The changes made to the code to support the above features were: - added some embedded/custom macros: one for conditionally upper-casing SH x-refs, one for redefining the SH macro itself, with some conditional handling for PS output, and finally a macro for putting a background/screen (filled box) around a block of text (e.g., a program listing) in PS output - added utility templates for wrapping blocks of text in code font; also templates for inline code font --- xsl/manpages/other.xsl | 94 ++++++++++++++++++++++++++++++++++++++++ xsl/manpages/utility.xsl | 79 ++++++++++++++++++++++++++++++++- 2 files changed, 172 insertions(+), 1 deletion(-) diff --git a/xsl/manpages/other.xsl b/xsl/manpages/other.xsl index df41b804b..034a6df0b 100644 --- a/xsl/manpages/other.xsl +++ b/xsl/manpages/other.xsl @@ -669,4 +669,98 @@ db:manvolnum + + + + .\" define a macro for condtionally upper-casing SH x-refs + .de SH-xref +.ie n \{\ +.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ +\\$* +.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz +.\} +.el \{\ +\\$* +.\} +.. + .\" define a level-one heading that works better for non-TTY output + .de1 SH +.sp 1 +.sp \\n[PD]u +.nr an-level 1 +.set-an-margin +.nr an-prevailing-indent \\n[IN] +.fi +.in \\n[an-margin]u +.ti 0 +.HTML-TAG ".NH \\n[an-level]" +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.ps +3 +.ft B +.ne (2v + 1u) +.\" if we have only one arg, just use that +.ie (\\n[.$] == 1) \{\ +.ie n \{\ +\&\\$1 +.\} +.el \{\ +.nr an-break-flag 0 +.\" if this is troff/non-TTY output, show the second arg only +\&\\$1 +.in \\n[an-margin]u +.ti 0 +.\" draw a border/line under subheading +.sp -.7 +\l'\n(.lu' +.\} +.\} +.\" we have more that one arg, so we decide which to use +.el \{\ +.ie n \{\ +.if \\n[.$] \&\\$1 +.\" if this is nroff/TTY output, show the first arg only +.\} +.el \{\ +.nr an-break-flag 0 +.\" if this is troff/non-TTY output, show the second arg only +.if \\n[.$] \&\\$2 +.in \\n[an-margin]u +.ti 0 +.\" draw a border/line under subheading +.sp -.7 +\l'\n(.lu' +.\} +.\} +.. + \" define BB/BE macros for putting a background/screen + \" (filled box) around a block of text in non-TTY output + .de BB +.br +.in +2n +.ll -2n +.gcolor red +.di BX +.. +.de EB +.br +.di +.in +.ll +.gcolor +.nr BW \\n(.lu-\\n(.i +.nr BH \\n(dn+.5v +.ne \\n(BHu+.5v +\M[lightgray]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] +.in 0 +.sp -.5v +.nf +.BX +.in +.sp .5v +.fi +.. + + diff --git a/xsl/manpages/utility.xsl b/xsl/manpages/utility.xsl index 93a75d3ab..d3ba029ad 100644 --- a/xsl/manpages/utility.xsl +++ b/xsl/manpages/utility.xsl @@ -64,6 +64,29 @@ + + + .fam C + + + + .fam \*(ZX + + + + \FC + + + + \F[\*(ZX] + + + + .ds ZX \n[.fam] + + + + @@ -436,9 +459,38 @@ - + + + + + .SH + + + + + + + + + + " + + + + + + " + + + + " + + " + + + @@ -449,4 +501,29 @@ + + + + n + .ie + + \{\ + + + + n + .if + + \{\ + + + + .\} + .el \{\ + + + + .\} + + -- 2.40.0