bibtex2html icon indicating copy to clipboard operation
bibtex2html copied to clipboard

Set CSS class for bibtex fields

Open MLopez-Ibanez opened this issue 1 year ago • 0 comments

In the HTML output, every field should be enclosed in an appropriate CSS class. This would ease a lot defining a custom layout. For example, given the bibtex entry:

@Book{texbook,
    author = "Donald E. Knuth",
    title= "The {{\TeX}book}",
    publisher = "Addison-Wesley",
    year = 1984
}

The desired output HTML would be something like:

<dl>
<dt>
[<a name="texbook">1</a>]
</dt>
<dd class="Book">
<span class="author">Donald E. Knuth</span>.
<span class="title">The TeXbook.</span>
  <span class="publisher">Addison-Wesley</span>, <span 
class="year">2005</span>.<br>

<pre class="bibtex" id="texbook">
@BookK{texbook,
    author = "Donald E. Knuth",
    title= "The {{\TeX}book}",
    publisher = "Addison-Wesley",
    year = 1984
}
</pre>
</dd>
</dl>

The <span>, class and id tags don't do anything by themselves. However, they allow to modify the layout easily using CSS. For example, I would be able to use something like this:

.author {
	font-weight: bold;
}
.title {
	font-variant: italic;
}
pre.bibtex {
	overflow: auto; /* if larger than maximum width, will produce scrollbars */
}

Moreover, implementing layout properties of different bibliographic styles will be rather straightforward since the CSS can be embedded in the header of the html file.

MLopez-Ibanez avatar Jan 16 '23 11:01 MLopez-Ibanez