Whakerexa > Extras > Book > Bibliography

Description

Overview

This page demonstrates a bibliography inside a book: references are cited in the running text, numbered in the order they appear, and gathered in a table at the end of the document.

A reference is numbered the first time it is cited. Every later citation of the same reference carries that same number. There is a single sequence of numbers for the whole document, and reloading the page gives the same numbers, because the order of the text does not change.

The bibliography itself does not depend on the citations: it lists what the BibTeX data contains. A page without any citation still gets its table — see publications.html.

How the bibliography is designed, what it does not do and why: bibliography-design.html.

How to use

Four steps: write the data, cite in the text, add the placeholder, call the JS API.

One stylesheet, and one only. A bibliography is a table that sorts and whose columns are shown or hidden; bibbook.css brings what it is built with, so a page has nothing else to know.

<link rel="stylesheet" href="wexa_statics/css/extras/bibbook.css">

Put the BibTeX entries in a pre element. Keep it hidden, and reveal it when JavaScript is disabled, so that the data stays readable.

<noscript>
    <style> #bibtex { display: block; } </style>
</noscript>

<pre id="bibtex" hidden>
@inproceedings{bigi2022lrec,
    author = {Brigitte Bigi and Maryvonne Zimmermann and Carine André},
    ...
}
</pre>

Cite with a span carrying a data-bibtex attribute. A span is allowed between two words of a sentence. Write a readable citation inside: it is replaced by the number, and it is what the reader gets when JavaScript is unavailable or has not loaded.

<p>The corpus is described in
    <span data-bibtex="bigi2022lrec">Bigi et al., 2022</span>.</p>

<!-- with JavaScript:    The corpus is described in [1]. -->
<!-- without JavaScript: The corpus is described in Bigi et al., 2022. -->

Add an empty element where the table is to be placed.

<div id="bibliography"></div>

Instantiate BookBibliography with the id of the data, the id of the placeholder, and the id of the content to scan for citations. Then call run(), which returns a promise.

const biblio = new BookBibliography('bibtex', 'bibliography', 'main-content');
biblio.run();

What a citation gives

Reading a citation, on screen and with a screen reader
Case On screen Screen reader
The key names a reference The number, in square brackets. "Reference", then the number. Never the brackets.
The key names nothing [?], and no number is given. "Missing reference".
JavaScript does not run What is written inside the span. The same, as part of the sentence.

A citation opens on demand: the full reference, its abstract, its BibTeX source and its links, without leaving the sentence and without scrolling the page. Several may stay open at once, and none closes on its own. Keys that name nothing are reported through Wexa.logger.

A link goes from a citation to its entry in the bibliography, and from that entry back to every place where it is cited.

CSS classes

Everything the bibliography writes carries a class, and bibbook.css only styles what a bibliography needs to be read: the rest is left to whoever writes the document. An unlayered rule of your own wins over the ones of the framework, so overriding any of these takes no !important and no complex selector.

A reference

A reference is written in three lines: who wrote it, what it is called, and where it came out. The three names never change, whatever the type of the entry, so a stylesheet can lay them out side by side, wrap them, or reorder them.

The three lines, side by side rather than one under the other.

.bib-reference {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
What a reference is made of
Class On Role
.bib-line span One of the three lines of a reference. Displayed as a block.
.bib-line-authors, .bib-line-title, .bib-line-source span.bib-line Which line it is: the signatories and the year, the title, where it came out.
.bib-author, .bib-title, .bib-journal, … span One field, named bib- followed by the name of the BibTeX field.
.bib-missing span A field the type cannot do without, and that the entry does not have.
.bib-actions div Under the reference: what leads to the publication, and what opens on demand.
.bib-link a.external-link One address of the publication. What it says is read in the address itself.
.bib-backlink a Back to one place of the text where the reference is cited.

The table

The table of the bibliography
Class On Role
.bib-table table The whole bibliography. Its id comes from the element it is put in.
.bib-row tr One reference. Its id is bib- and the BibTeX key.
.bib-striped tr One row out of two, counting the references alone. Applied by the code.
.bib-opened-row tr A content that opens, across the whole table, right after its reference.
.bib-number, .bib-year, .bib-reference td The three cells. The number column only exists when something is cited.
.bib-controls, .bib-search-field, .bib-columns div, input, div The line written before the table: the field a word is searched from, and the columns to show.
.bib-announcement p[role=status] What changed after a search or a sort, said as well as shown.

What opens

Contents that open on demand, and citations
Class On Role
.bib-disclosure-control button[aria-expanded] What opens and closes a content. It says itself whether it is open.
.bib-disclosure-content td What it opens, with .bib-disclosure-abstract or .bib-disclosure-source.
.bib-citation-control button The number of a citation, inside the sentence.
.bib-citation-content span The whole reference, read without leaving the sentence.
.bib-citation-link, .bib-citation-part, .bib-citation-text a, span Inside it: the link to the bibliography, a named part, what it says.

Demonstration

Citations in a running text

The paragraphs below cite five keys. The first three are cited once each, in the order they appear, and take the numbers 1, 2 and 3. The fourth citation repeats the first key, and carries the number 1 again. The last one names a key that no entry defines.

A corpus of French Cued Speech is described in Bigi et al., 2022, and the kinds of data collected when studying spoken language are discussed in Ghio & Bigi, 2023. Tools and principles for corpus annotation are gathered in Amoyal et al., 2022.

The same corpus Bigi et al., 2022 is cited a second time here, and keeps its first number. Resources for a less-resourced language are presented in Pakrashi et al., 2026.

This last citation Nobody, 2026 names a key that no entry defines: it stays visible, says that it is missing, and receives no number.

Bibliography