bug-texinfo
[Top][All Lists]
Advanced

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

Re: trying to wrap section number in span


From: Patrice Dumas
Subject: Re: trying to wrap section number in span
Date: Mon, 21 Oct 2019 11:22:26 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Hello,

On Sun, Oct 20, 2019 at 12:48:45PM -0700, Per Bothner wrote:
> I find chapter/section numbers in HTML to be useless clutter.
> One solution is to wrap each such number in a span, so one can easily use
> a CSS stylesheet to disable/enable/style it.
> 
> I tried this:
> 
> diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
> index 3467bb972..3fd9e741a 100644
> --- a/tp/Texinfo/Convert/HTML.pm
> +++ b/tp/Texinfo/Convert/HTML.pm
> @@ -563,7 +563,7 @@ sub command_text($$;$)
>                                  => {'contents'
>                                      => 
> $command->{'args'}->[0]->{'contents'}}});
>            } else {
> -            $tree = $self->gdt('{number} {section_title}',
> +            $tree = $self->gdt('<span class="secnumber">{number} 
> </span>{section_title}',
>                               {'number' => {'text' => $command->{'number'}},
>                                'section_title'
>                                  => {'contents'

I had a look and indeed, it is not easy at all to customize that part of
the output.  One possibility would be to use a different 'translation'
of the string '{number} {section_title}' with @inlineraw, but I think
that it is not possible right now to override the 'translations', and
also it would be quite cumbersome.

Then there is the possibility to replace the heading formatting function
entirely, by replacing the _default_heading_text formatting function
with:
texinfo_register_formatting_function('heading_text',
                                     \&my_heading_text);
and doing something different if the command is a sectionning command.
Not sure how this would be easy or hard.

-- 
Pat



reply via email to

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