groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [groff] troff Address book


From: Robert Thorsby
Subject: Re: [groff] troff Address book
Date: Thu, 28 Mar 2019 10:00:29 +1100

On 27/03/19 21:12:27, Pierre-Jean Fichet wrote:
I'm looking for an address book compatible with troff. What I'd like is to automatically fill fields in a troff source. A bit more complex task would be to create several source files from a list of contacts (to build a bench of letters, for instance).

Does anyone know if such a tool exist yet ?

Good morning Pierre-Jean,

I suspect you might be approaching this problem from the wrong perspective. :-) You seem to be looking for [tg]roff to do all the heavy lifting by extracting data from other sources (databases, etc) and then using it to produce a document.

Why not simply use groff as *one* of the tools to do the job? In your favourite programming/scripting language extract the data from the various sources and dump those extracts into a template that contains all the groff information.

If you put the extracted data in the font of your groff input file -- as internal macros [.de], defined strings [.ds], and number registers [.nr] -- you can separate the variables from the body of the letter.

You can also use conditionals [.if, .ie] to manipulate the body text depending on the nature of the extracted data.

Using a programming/scripting language to create a groff file is straightforward, especially if you convert all the data extracted from other sources into groff definitions.

Back in January in a thread "[groff] Fonts, PDF images, groff vs. heirloom troff" I posted an invoice that had been generated by a shell script that gathered information from two databases and three external files, converted that information into "definitions" in a groff input file and then added the body text. The shell script then ran the input file through groff and ps2pdf to produce the PDF file I posted.

Isn't that what you wanted to do?

Cheers,
Robert


reply via email to

[Prev in Thread] Current Thread [Next in Thread]