groff
[Top][All Lists]
Advanced

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

Re: [Groff] grohtml peculiarities


From: Werner LEMBERG
Subject: Re: [Groff] grohtml peculiarities
Date: Sat, 20 Jul 2002 06:46:03 +0200 (CEST)

> Consider this from tmac/an-old.tmac:
> 
> .de1 TP
> .  sp \\n[PD]u
> .  if \\n[.$] .nr an-prevailing-indent (n;\\$1)
> .  it 1 an-trap
> .  in 0                                                                   (a)
> .  ll -\\n[an-margin]u
> .  if !\\n[an-div?] .di an-div
> .                                                                         (b)
> .  nr an-div? 1
> ..
> .de an-do-tag-html
> .  nr an-div? 0
> .  br
> .  ll
> .  di
> .  ie ((\\n[dl] + \\n[an-tag-sep]) > \\n[an-prevailing-indent]) \{\
> .    in \\n[an-margin]u
> .    an-div
> .    br
> .    in (\\n[an-margin]u + \\n[an-prevailing-indent]u + \\n[an-tag-sep]u)
> .  \}
> .  el \{\
> .    in (\\n[an-margin]u + \\n[an-prevailing-indent]u + \\n[an-tag-sep]u) (d)
> .    ti \\n[an-margin]u
> .    chop an-div
> .    HTML-TAG-NS ".col 1"
> \\*[an-div]\\h'|\\n[an-prevailing-indent]u'\\h'\\n[an-tag-sep]u'\c        (c)
> .    HTML-TAG-NS ".col 2"
> .  \}
> ..
> 
> 
> basically the diversion is: created in TP, finished in an-do-tag-html
> and emitted from this macro as well. So the question was what happens
> if the `.in' request is moved from position (a) to (b)?

Nothing, really.  It is just convenience to set the indentation and
line length before starting the diversion (most notably since .in
causes a break), but it is completely irrelevant since the diversion
itself doesn't hold information about those parameters.

> In grohtml the `.in' request generates a special indicating that a
> change of indent has occurred (this is also placed into the
> diversion).  The diversion is emitted, say at point (c), which
> causes a problem as the output from troff will tell grohtml that an
> `.in' from (d)

This is problematic.  After ending a diversion, you have a list of
formatted glyphs, together with fixed horizontal and vertical
spacings, nothing more (well, some internal nodes are added but this
is not of importance here).  While executing the diversion, the
formatted text will use the current indentation and line length
values, regardless of the values active during the creation of the
diversion.  As you all know, this sometimes leads to very surprising
results since the space between words is no longer stretchable.

> When does the `.in' actually take place (should the `.in' special be
> emitted at all?).

A diversion is a low-level operation in groff, creating output
immediately.  Since this isn't suited for grohtml, I suggest to ignore
any typesetting commands except high-level markup like font changes
while defining a diversion.

With other words, no special html tags should be added normally while
a diversion is active.  Most groff macro packages use environments to
ensure that the output of diversions use exactly the same layout
parameters which were active during the diversion's definition --
grohtml must simply rely on a sensible macro package which ensures
proper use of diversions.


    Werner

reply via email to

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