Hi onf,
thank you for your example! I'll try it during the next days.
Yes, I am aware of looming complexity issues but I regard this as an
exercise only. I do not want to bulldoze my way forward if it is really
not practical, etc. Let's reword my approach: I only want to see if the
idea is *possible*, practicailty is only a secondary concern.
With regard to the usefulness of the language, my invoices in LaTeX are
actually finite state automata that are completely realized in TeX; the
user provides a title and a number of \Fee{}{}{} lines, once these end
the program constructs everything from table header to table body around
it. It was not even complicated. I think that the same thing is possible
and feasible in groff.
Best, Oliver.
On 03/12/2024 23:26, onf wrote:
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.
--
Dr. Oliver Corff
Mail:oliver.co...@email.de