Hi Gavin,

> Le 27 avr. 2019 à 19:38, Gavin Smith <gavinsmith0...@gmail.com> a écrit :
> 
> On Sat, Apr 27, 2019 at 10:12:56AM +0200, Akim Demaille wrote:
>> In HTML, I would have expected @group...@end group to be ignored, but 
>> actually the result is:
>> 
>>> <div class="example">
>>> <pre class="example">$ <kbd>bison -Wmidrule-value mid.y</kbd>
>>> </pre><pre class="example">mid.y:2.6-13: <b 
>>> style="color:purple">warning</b>: unset value: $$
>>>    2 | exp: <b style="color:purple">{ a(); }</b> "b" { $$ = c(); } { d(); } 
>>> "e" { f = $1; };
>>>      |      <b style="color:purple">^~~~~~~~</b>
>>> </pre><pre class="example">mid.y:2.19-31: <b 
>>> style="color:purple">warning</b>: unused value: $3
>>>    2 | exp: { a(); } "b" <b style="color:purple">{ $$ = c(); }</b> { d(); } 
>>> "e" { f = $1; };
>>>      |                   <b style="color:purple">^~~~~~~~~~~~~</b>
>>> </pre></div>
>> 
>> 
>> I don't understand why these <pre> are here.
> 
> It is as a result of the way the input is parsed and it would be hard to 
> change.

Ouch.

Maybe a pass should fuse sequences of these nodes?

> (Each <pre> corresponds to a 'preformatted' element in the 
> parse tree of the document.)

I do not know the inner details of the conversion, so I trust you :)

>> The problem is that, since they have the same class as the div, they inherit 
>> from the margins of the div.  So the output looks like it has additional 
>> empty lines:
> 
> I am not sure if it is due to the element class.  When I edited the HTML 
> to remove the element classes the result looked the same, with vertical 
> space between the <pre> elements (this is with the default CSS; it might 
> be different with the CSS for the Bison manual).

You are right, I see the same thing.

> Just using a single @group within an @example and making it contain the 
> entire contents of the @example may give good enough results for printed 
> output.  In fact, I would not use @group at all unless a bad break 
> actually occurs.

Bison's documentation is old, and I don't garbage collect the now-useless
@groups.  Besides, that would be terribly fragile and time consuming to
have to check each @group's influence in the result each time we change
something.  This is really not doable.

> Another idea is to specify "pre.example {margin: 0em}", but I doubt that 
> is a very good idea.

So far I did not manage to find the css that would result in @group behave
as expected, but I'm far from being talented with css.  I'll ask more
knowledgeable people what they would do.

It's probably unrelated, but I have also observed the following problem:

https://www.gnu.org/software/bison/manual/html_node/Prologue-Alternatives.html

does not show the comment /* tree is defined in ptypes.h. */ in roman,
also the source is:

@group
%union @{
  long n;
  tree t;  /* @r{@code{tree} is defined in @file{ptypes.h}.} */
@}
@end group

as a matter of fact, it even shows in a bigger font with the default
css.

Reply via email to