From b23a1093b73e16f1b69e5d8d05c9e3dcf8ee5d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 27 Jun 2021 18:37:36 +0200 Subject: Add 'list' utility --- list/list | 17 +++++++++++++++++ list/list.1 | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 list/list create mode 100644 list/list.1 (limited to 'list') diff --git a/list/list b/list/list new file mode 100755 index 0000000..64ec8ac --- /dev/null +++ b/list/list @@ -0,0 +1,17 @@ +#!/usr/bin/perl -ps + +# list -- escape code listing for troff + +if (/^\.\s*l\(\s*$/ .. /^\.\s*l\)\s*$/) { + not $E and s/^\\!// and next; + if (/^\.\s*l\(\s*$/) { + print "$p\n" if $p; + } elsif (/^\.\s*l\)\s*$/) { + print "$s\n" if $s; + } else { + s/\\/\\$&/g; + s/^/\\&/g; + s/'/\\(aq/g; + s/\`/\\(ga/g; + } +} diff --git a/list/list.1 b/list/list.1 new file mode 100644 index 0000000..085bb20 --- /dev/null +++ b/list/list.1 @@ -0,0 +1,43 @@ +.Dd $Mdocdate$ +.Dt list 1 +.Os +.Sh NAME +.Nm list +.Nd escape code listings for troff +. +.Sh SYNOPSIS +.Nm +.Op Fl p=prefix +.Op Fl s=suffix +.Op Fl E +.Op Ar file +.Sh DESCRIPTION +.Pp +.Nm +escapes text between +.Ql .l( +and +.Ql .l) +lines for +.Xr troff 1 . +.Pp +Lines beginning with +.Ql \\\\! +are copied verbatim, unless the +.Fl E +flag is given. +.Pp +Text given to +.Fl p +and +.Fl s +is inserted on a new line before and after each code block. +This text is not escaped and can contain arbitrary +.Xr troff 1 +requests. +. +.Sh AUTHORS +.Pp +.Nm +is written by John Ankarström +.Aq Mt "john (at) ankarstrom.se" . -- cgit v1.2.3