1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! The stylesheet of the [`citations`](super) feature on the `html` backend,
//! `flm.citations.style` ([`stylesheet`]), and the markup it selects on.
//!
//! On the HTML page, a citation is written in the shared presentation
//! vocabulary, as on every other output: the general rules of `\cite` and
//! `\R` ([`CiteRule`](super::CiteRule), [`RefCiteRule`](super::RefCiteRule))
//! stage the citation mark, and the backend writes the HTML as its [HTML
//! contract](crate::guide::rendering#the-html-contract) says. The general
//! rules also require (record a requirement for; an identifier a rule
//! records to say that its output needs a definition, see [`StyleDef`]) the
//! feature's style identifier [`STYLE`] (`flm.citations.style`), which on
//! this backend names the stylesheet, so a page holding no citation does not
//! carry it. The list of cited works is lowered by its general rule
//! ([`BibliographyRule`](super::BibliographyRule)).
//!
//! # The markup
//!
//! `Codes of this family are well studied \cite{a,b}.` writes a no-break
//! space (U+00A0, written ` `) in a span of role `flm.citations.space`,
//! then the citation mark: a span of role `flm.citations.mark` carrying the
//! kind token `attached`, holding the delimiters, the join texts and the
//! numbers. Each number is a link of kind `cite` to its work's entry in the
//! list of cited works, with the document role `doc-biblioref`:
//!
//! ```html
//! <p class="flm-pres-par">Codes of this family are well studied<span class="flm-pres-span flm-citations-space"> </span><span class="flm-pres-span flm-citations-mark" data-flm-kind="attached">[<a class="flm-pres-link" href="#citation-1" role="doc-biblioref" data-flm-kind="cite">1</a>,<a class="flm-pres-link" href="#citation-2" role="doc-biblioref" data-flm-kind="cite">2</a>]</span>.</p>
//! ```
//!
//! The space is a character of the text, in a span of its own before the
//! citation mark's span: the text a reader copies from the page holds it, the
//! line does not break between the word and the citation mark, and a
//! stylesheet selects it by its class `flm-citations-space` (to hide it, or to
//! change its width).
//!
//! Under the superscript form ([`MarkForm::Superscript`](super::MarkForm)) of
//! the listed placement, the citation mark of a `\cite` is a `<sup>` element
//! (with `data-flm-style="superscript"`) holding no delimiters, and no space
//! is written before it. The citation mark of an `\R` is never raised and
//! shows its numbers with no delimiters; the word that `\R` writes is placed
//! before it, in a span of role `flm.citations.word` (`refs. 1,2`).
//! Under the in-place placement, the citation mark carries the kind token
//! `in-place` after `attached` or `standalone`, and holds the citation
//! entries themselves, with no link.
//!
//! The list of cited works is placed after the document's content (after the
//! lists of xnotes among the standard features; an xnote is a note set apart from
//! the running text, such as a footnote, see
//! [`xnotes`](crate::stdlib::features::xnotes)): a block with the document
//! role `doc-bibliography`, holding the title as a heading and a labeled list
//! whose entries carry the works' identifiers. The entries carry no document
//! role:
//!
//! ```html
//! <div class="flm-pres-block flm-citations-bibliography" role="doc-bibliography" data-flm-kind="citations">
//! <h2 class="flm-pres-block--heading" data-flm-heading="citations" data-flm-level="2" data-flm-toc="false">References</h2>
//! <ol class="flm-pres-list" data-flm-kind="numbered citations labeled">
//! <li id="citation-1"><span class="flm-pres-list-label"><span class="flm-pres-span flm-citations-entry-number">[1]</span></span>
//! <p class="flm-pres-par">Knuth, The Art of Computer Programming, 1984</p>
//! </li>
//! </ol>
//! </div>
//! ```
//!
//! # The stylesheet
//!
//! The stylesheet [`STYLE`] (`flm.citations.style`, [`stylesheet`]) is one
//! cascade layer that keeps a raised citation mark from pushing its line apart
//! from the lines around it. It sets the line height of a raised citation mark
//! to the custom property `--flm-citations-raised-line-height`, declared in it
//! with the value `0`, which a page's own stylesheet sets to change that line
//! height without repeating the selector. A citation mark wraps where text
//! does. The raising itself, and the size of the raised numbers, come from the
//! backend's own stylesheet, for every span of the superscript style.
use crate;
use crateName;
/// The identifier of the feature's stylesheet, `flm.citations.style`
/// ([`stylesheet`]), which the general rules of `\cite` and `\R` require.
pub const STYLE: &str = "flm.citations.style";
/// Returns the style definition of the feature's stylesheet,
/// `flm.citations.style` ([`StyleDef`]): one cascade layer that keeps a raised
/// citation mark from pushing its line apart, with its one value held in a
/// custom property it declares. See the [module
/// documentation](self#the-stylesheet).
/// Registers the feature's part of the HTML page: the stylesheet
/// ([`stylesheet`]).
///
/// # Errors
///
/// The [`BuildError`] of the registry builder when a declaration is made
/// outside the round that takes it.
pub