🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.text
Article #971

sorting in troff(nroff)

#971
From: Mike Roberson
Date: Mon, 21 Jul 1986 16:18
72 lines
2421 bytes
i caught the: \(br\|line-eater\|\(br\l'|0\(rn'\l'|0\(ul'!

abstract: how can items be sorted in troff(nroff)?

explanation: given the definition of the list-begin, list-item,
	and list-end macros, how can i generate a sorted list of
	the first arguments to the list-item macros?

	e.g., given the following pseudo-troff input:

list-begin
list-item arg1
list-item arg1
list-item arg1
list-end
list-sort	\" i.e. produce a sorted list of all arg1s

	what should list-item and list-sort do?

	my problem is best stated as a troff example. the following
	can be run unchanged with troff(nroff):

.\" ---------- begin troff source  ----------
.de lH	\" list header
\&\\$1
..
.de lB	\" list begin
.in +2i
..
.de lI	\" list item
.br
.\"	the next line causes $1 to be a hanging mark
\h'|-1i'\&\\$1\h'|0'\c
..
.de lE	\" list end
.br
.in -2i
..
.de lS	\" output sorted list
.\" what goes here?
..
.lH "this is the header for the following list"
.lB	\" list start
.lI ".ti"
this is some text that i don't care about.
this is even more text that doesn't matter.
.lI ".in"
this is some text that i don't care about.
this is even more text that doesn't matter.
.lI ".br"
this is some text that i don't care about.
this is even more text that doesn't matter.
.lI ".bp"
this is some text that i don't care about.
this is even more text that doesn't matter.
.lE	\" list end
this is some text (after the list) that i don't care about.
this is even more (after the list) text that doesn't matter.
.lS
.\" ---------- end of troff source ----------

finally: I can't (read: i don't want to) call a sub-shell.
	I also can't (read: i really can't) call a pre-
	processor, unfortunately.

	any help, pointers to documentation, people etc.
	would be greatly appreciated.

ADVthanksANCE,
-- 
"Stoneware - prehistoric computers"
Mike "Trust Me" Roberson               UUCP: {ihnp4,cbosgd,akgua}!cord!miker
Technical Details
Message-ID: <320@cord.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!brl-adm!caip!topaz!cord!miker

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!brl-adm!caip!topaz!cord!miker
From: miker@cord.UUCP (Mike Roberson)
Newsgroups: net.text
Subject: sorting in troff(nroff)
Message-ID: <320@cord.UUCP>
Date: Mon, 21-Jul-86 12:18:34 EDT
Article-I.D.: cord.320
Posted: Mon Jul 21 12:18:34 1986
Date-Received: Tue, 22-Jul-86 00:21:40 EDT
Organization: AT&T-BL, Liberty Corner, NJ
Lines: 72
Keywords: troff, nroff, sorting, macros