groff
[Top][All Lists]
Advanced

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

Re: [Groff] grohtml peculiarities


From: Gaius Mulley
Subject: Re: [Groff] grohtml peculiarities
Date: Thu, 18 Jul 2002 11:21:10 +0100

Hi Werner,

> in your last (original) patch there was the following snippet for
> an-old.tmac:
> 
>   .  ie \\n[an-html] \{\
>   .    in 0
>   .    ll -\\n[an-margin]u
>   .    if !\\n[an-div?] .di an-div
>   .  \}
>   .  el \{\
>   .    if !\\n[an-div?] .di an-div
>   .    in 0
>   .    ll -\\n[an-margin]u
>   .  \}
> 
> which I've simplified to
> 
>   .  in 0
>   .  ll -\\n[an-margin]u
>   .  if !\\n[an-div?] .di an-div
> 
> Theoretically, the `ie' and `el' parts should behave identically -- a
> diversion only stores the output, and it shouldn't matter whether the
> line length and indentation is changed immediately before or after the
> start of the diversion.  Apparently, the situation is different for
> grohtml.  You know that both .ll and .in emit special HTML tags, I
> know that also, but probably nobody else knows it.  So please document
> (in groff.texinfo) which requests do something special in html mode
> together with examples to demonstrate its correct usage.

yes thanks for highlighting this. I believe this to be a shortcoming
of grohtml - and it needs to be fixed as I'd like grohtml to use fewer
device specific conditionals in the tmac files.

Basically the .in .ll requests also emit html meta tags (via
specials), the problem is that if these commands occur during a
diversion then the specials are also bound with the division.  This is
normally ok, but I do not understand the operation of .in in some
circumstances.. perhaps someone can enlighten me.

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) ? 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)


.    in (\\n[an-margin]u + \\n[an-prevailing-indent]u + \\n[an-tag-sep]u)

occurs and then the `.in' from (b)

.    in 0

which causes grohtml to generate the incorrect indent. Whereas if
the `.in 0' is left at position (a) then troff emits:


.    in 0

.    in (\\n[an-margin]u + \\n[an-prevailing-indent]u + \\n[an-tag-sep]u)

and grohtml generates the correct indent.

Any suggestions as to when the specials for `.in' should be emitted?
When does the `.in' actually take place (should the `.in' special be
emitted at all?).

Thanks for raising the question, hopefully we can find a solution!

Gaius

reply via email to

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