bug-texinfo
[Top][All Lists]
Advanced

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

styling flexibility for definitions


From: Per Bothner
Subject: styling flexibility for definitions
Date: Thu, 29 Oct 2020 15:46:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

The html output for definitions only allows for very limited css styling.

As an example of the kind of styling it would be nice to enable, in my Kawa and
DomTerm manuals I move the "category" to the right margin,
as you can see examples of here:
https://www.gnu.org/software/kawa/Composable-pictures.html

I wrote an experimental patch (see attachment) which adds some class
and other attributes, and wraps the "CATEGORY: " in an element.

For example, this:

    @deffn Function dtutils.set_notebook_mode (@var{enable=True})
    @deffnx Macro dt_set_notebook_mode (@var{enable=True})
    Controls how auto-display works.
    @end deffn

becomes:

    <dl class="definition">
    <dt id="index-dtutils_002eset_005fnotebook_005fmode" class="synopsis" category="Function"><span class="category">Function: 
</span>     <strong>dtutils.set_notebook_mode</strong> <em>(<var>enable=True</var>)</em></dt>
    <dt id="index-dt_005fset_005fnotebook_005fmode" class="synopsis" category="Macro"><span class="category">Macro: 
</span>  <strong>dt_set_notebook_mode</strong>    <em>(<var>enable=True</var>)</em></dt>
    <dd><p>Controls how auto-display works.
    </p></dd></dl>

With those changes, I can add these css rules to achieve the
effect of the link above:

    dt.synopsis[category]:after { float: right; padding-left: 2em; content: "["  
attr(category) "]" }
    dt.synopsis span.category { display: none }

This is incomplete - it only handles @deffn and a few other definitions.
Specifically, @deftypeop and similar that generate "{category} of {class}"
would need an extra "of-class" attribute and a css rule like:

dt.synopsis[category][of-class]:after { float: right; padding-left: 2em; content:  "["  
attr(category) " of " attr(of-class) "]" }

Before I work on the missing pieces it would be nice to get some feedback on
the basic approach.  My understanding of the code and of Perl is limited,
and I'm sure this can be done more cleanly.
--
        --Per Bothner
per@bothner.com   http://per.bothner.com/

Attachment: html-defs.patch
Description: Text Data


reply via email to

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