bug-texinfo
[Top][All Lists]
Advanced

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

trying to wrap section number in span


From: Per Bothner
Subject: trying to wrap section number in span
Date: Sun, 20 Oct 2019 12:48:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0

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.

E.g. makeinfo woudl generate:

   <a href="Invocation.html"><span class="secnumber">2.1 </span>Invocation</a>

Then I could easily hide these using CSS:

   span.secnumber {display: none}

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'

However, that escapes the special characters '<' etc.
Unfortunately, I'm not Perl fluent, and I haven't figured out how the
gdt function works, nor the meaning of the trees it returns.
This is presumably trivial for someone who understands the code.
--
        --Per Bothner
address@hidden   http://per.bothner.com/



reply via email to

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