[Top][All Lists]

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

Re: [Groff] Regarding HTML rendering

From: Ingo Schwarze
Subject: Re: [Groff] Regarding HTML rendering
Date: Tue, 22 Aug 2017 17:58:36 +0200
User-agent: Mutt/1.8.0 (2017-02-23)

Hi Mikkel,

mikkel meinike wrote on Tue, Aug 22, 2017 at 03:17:17PM +0200:
> Ingo wrote:

>> So technically, the best way to transform groff_mom (7) documents
>> Into HTML would be to parse a high-level MOM node tree and convert
>> That directly to HTML, without going through troff (1) at all, like
>> Mandoc (1) does it for the mdoc (7) language.

As i said, such a converter does not currently exists.
Writing it would probably require some weeks of full-time work.

> Should I understand that if I convert my document with
> groff -t -man -Thtml> mydocument.html

No, that makes no sense at all, for three reasons.

First of all, man(7) is not a general-purpose document format,
but highly specialized for manual pages, and i don't think you
are trying to write a manual page.

If you *are* able to turn the document you are trying to write
into a manual page, then you should not use the outdated man(7)
language, but the newer mdoc(7) language, *in particular* if one
of your target formats is HTML, and you should use

  mandoc -T html > mydocument.html

for the conversion rather than groff, which gives way better
results for mdoc(7) input.

Finally, if you are somehow stuck with man(7) - even though i can't
imagine why, in this context - then you should still use the above
mandoc command rather than groff for conversion to HTML.

On the other hand, if you use the general-purpose groff_mom(7)
language, then

  groff -t -mom -Thtml > mydocument.html

is indeed your best bet.

> Then it will result in a direct transfer of "man markup" to html markup ??

The above mandoc(1) commands result in direct transfer,
while the above groff(1) commands go through troff(1).

> As I have looked a bit on tbl in the past day I'v been wondering if
> no one has written some features to make simple spreadsheet arithmetic
> in a tbl table.  So that you for instans could have, "sum" in a field
> and the program wuld be able to interpratat it and do and calculated
> of the sum of the above fields during compilation.

The roff language, in particular in its groff variant, is not only a
layout description language, but almost a general-purpose programming
language.  In particular, it contains numeric expressions, conditionals,
and loops.  You can use that anywhere, in or out of tables.

  address@hidden $ mandoc 
  .nr myvar 2+2
  The result is: \n[myvar]
  ()                                                      ()
  The result is: 4
                      August 22, 2017                     ()

  address@hidden $ nroff
  .nr myvar 2+2
  The result is: \n[myvar]
  The result is: 4

Of course, don't use that in manual pages, but there is nothing
wrong with using it in your private general-purpose documents.


reply via email to

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