groff
[Top][All Lists]
Advanced

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

Re: [groff] Creating a numbered list without macros


From: Ingo Schwarze
Subject: Re: [groff] Creating a numbered list without macros
Date: Mon, 13 Aug 2018 05:24:49 +0200
User-agent: Mutt/1.8.0 (2017-02-23)

Hi,

Yves Cloutier wrote on Sat, Aug 11, 2018 at 04:10:32PM -0400:

> So there is no parsing here.  This is program source code.

That makes little difference - so instead of writing a parser,
you have to implement the functions, which is probably a similar
amount of code to write.

> Why do my own thing thing instead of using existing macros?
> I guess the question could also have been asked to those who
> created all the other macros ;)

"Someone else fell prey to NIH syndrome" is not an answer to
"why do you write your own".

Besides, i know what the point of groff_mom(7) is: Provide longer,
more human-readable keywords, and aim for a complete, self-contained
feature set, while the other, older, less maintained macro sets may
have slight feature gaps here or there.  I don't know what the
point of having me, mm, and ms originally was - but that was
decades ago.  Interesting history question, though, probably
not that hard to answer with a search engine on the web.

> The short answer is that those macros are too level even for me.

I don't understand what "too level" means.

> As a writer, I just want to write - I don't want to put on my
> programmer hat.

Fallacy here - your syntax has exactly the same learning difficulty
as any of the macro sets, let's arbitraily pick mm as an example:

  your new language   mm
  -----------------   --
  h1 {text}           .H 1 text
  P {text}            .P<newline>text
  h2 {text}           .H 2 text
  list "1" ")" [      .AL 1
  li {text}           .LI<newline>text

It is not simpler, it is merely (very slightly) different.

> The other part to this answer is that I like to know how things work.
> So this is partially me learning how to typeset with groff,

Fair enough.

> without relying on macros.

However, that elicits a piece of advice:  Roff is both a typesetting
system and a programming language.  So the way to do what you want
to do with roff is by writing the program you are trying to write -
in roff.  In other words, write a macro set.

Mixing a different programming language into the play - here: red -
feels artificial.  In general, generating code in one programming
language by a program in a different language is often a second-best
approach, to put my opinion mildly.  A system consistently written
in one language is almost always more maintainable, easier to audit,
less susceptible to bugs, and easier to debug than a system written
in a mix of two.

Besides, whith a macro set, advanced users can use roff(7) requests
between the macros when the need arises.  With your approach, even
mildly adanced users will soon hit walls where your stuff is not
good enough - and they can't complement it by directly resorting
to low-level roff(7) where needed either.

So writing a macro set is *much* more flexible and powerful than
what you are doing, and at the same time simpler and more robust.

> The whole idea is to abstract that away for them.

By something that is exactly the same difficulty for them?

Newbies can write in any of the macro sets with minimal learning -
exactly like they can in your new language.  No difference there.

Yours,
  Ingo



reply via email to

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