[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proper usage of .rd? Tutorial or Example?
From: |
onf |
Subject: |
Re: Proper usage of .rd? Tutorial or Example? |
Date: |
Tue, 03 Dec 2024 23:26:26 +0100 |
Hi Oliver,
On Tue Dec 3, 2024 at 9:57 PM CET, Oliver Corff wrote:
> I thought of precomposed files as well, but what I really want is to
> make groff collect the necessary data during the compile run by
> prompting the user at the CLI, very much like the original mail user agent.
>
> [...]
>
> I could, of course, also write something in any script language that
> converts my input into roff data, but I thought it would be nice to have
> groff do the job directly.
I realized that it IS actually possible to use .rd to create a string:
.de loadvar \" $1 = string name, $2 = prompt
. di \\$1
. rd \\$2
. br
. di
. unformat \\$1
. chop \\$1
..
.loadvar name Name
.loadvar email Email
Your name is \*[name]
and your email is \*[email].
However, I think what you are trying to do will end up being
unnecessarily complex in troff. Creating a script which prompts
the user and then generates troff syntax and runs troff on the
user's behalf will be much easier because troff sucks as a general
purpose programming language.[1] I speak from experience.
~ onf
[1] Not that TeX is any better in this regard.
Re: Proper usage of .rd? Tutorial or Example?, Deri, 2024/12/03