bug-texinfo
[Top][All Lists]
Advanced

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

Re: styling flexibility for definitions


From: Gavin Smith
Subject: Re: styling flexibility for definitions
Date: Fri, 30 Oct 2020 16:15:39 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

On Fri, Oct 30, 2020 at 05:05:28AM -0700, Per Bothner wrote:
> On 10/30/20 12:13 AM, Gavin Smith wrote:
> > I think it's worth supporting this with CSS if all it needs is adding
> > some element classes to the output.
> 
> Note that adding descriptive class names isn't just for styling - they
> could be useful for searching or (say) extracting only all the definitions.
> 
> > I don't think non-standard HTML attributes should be used so the
> > category="Function" part should be removed.
> 
> Well, it can't be just removed, since it is used for css:
>     dt.synopsis[category]:after { content: "["  attr(category) "]" }
> Specifically, attr(category) is the value of the "category" attribute.

I see.

> I don't think there is a strong reason to not use non-standard attributes:
> It's fully supported by javascript and css.  There are a couple of minor 
> reasons
> (validation becomes more complicated without a custom DTD, and there is a 
> small chance
> they might clash with a future standard or browser extension), and some people
> disapprove of them.
> 
> A HTML5-standards compliant approach (which will not break in older browsers)
> is to use a data- attribute:
> https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
> 
> Another approach (which I think I would prefer):
> <dt class="synopsis" category="Function"><span 
> class="category">Function</span><span class="category-suffix">: 
> </span>...</span>
> 
> Then the CSS could be:
> 
> dt.synopsis span.category { float: right; padding-left: 2em; }
> dt.synopsis span.category:before { content: "[" }
> dt.synopsis span.category:after { content: "]" }
> dt.synopsis span.category-suffix { display: none }

I like this better; then the attr(category) isn't needed.

> Or so you mean replacing the classname "synopsis" by "def-synopsis"?
> I don't see any particular value in that, since the value is already
> nested as a "definition" class, so the "definition"/"synopsis" follows by 
> context.

That's what I meant.

> 
> > > +      $category_text = $category ? $$category{text} : '';
> > 
> > The $$ looks wrong.
> 
> It's needed.  $category is a reference to a hash.  Dereferencing it would be
> @$category, and retrieving the specific 'text' element is $$category{text}.

OK, Perl.  All of the rest of the code in texi2any uses the syntax

$category->{'text'}

instead.



reply via email to

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