ids theme: reliably render "Authors (Year):" as bold first line in bibliography
The old CSS hack inserted a line break before the FIRST ELEMENT CHILD of
each .csl-entry, plus a ::first-line tint. Which part of an entry
citeproc wraps in spans anchors depends on the entry type, so the break
landed arbitrarily -- e.g. mid-title in the DeLiKo entry or before the
final URL. Replace it with an explicit wrap: the theme template walks
the leading text nodes of each entry to the first "):" and marks them
as .csl-authors-year (display: block; bold; mid blue-gray), which is
both the bold first line and the line break. Entries without a year
marker are left untouched; spacing between entries is restored with a
0.5em margin (pandoc's div.csl-entry pins it to 0em otherwise). The
demo bibliography gains the DeLiKo citation as a regression case.
Change-Id: I196368e631a8870d63fe2022fb5cda3a0ad30072
diff --git a/NEWS.md b/NEWS.md
index 9734d2b..bf91370 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## OTHER CHANGES
+- `ids` theme: bibliography entries now reliably render "Authors (Year):" as a bold first line followed by a line break, regardless of how citeproc structures the entry. Previously a CSS "break before the first child element" hack (`.csl-entry :first-child::before`) placed the break arbitrarily (e.g. in the middle of a title), depending on the entry's spans/links. The leading text up to the year is now wrapped explicitly by the theme template (`.csl-authors-year`, `display: block`), plus a small `margin-bottom` between entries.
+
- `ids` theme: slide transitions now default to `slide` (slides slide in horizontally instead of the reveal.js default `convex` rotation). Set `transition` explicitly to use another effect.
- `ids` theme: second- and higher-level list items are now rendered progressively smaller (each nesting level at 80% of its parent), emphasising list hierarchy as in the IDS reference decks.
diff --git a/examples/ids.Rmd b/examples/ids.Rmd
index 013b7bc..34c1f5f 100644
--- a/examples/ids.Rmd
+++ b/examples/ids.Rmd
@@ -103,7 +103,9 @@
addExamples = T
)
```
-
+See [@kupietz_rkorapclient_2020]
+See [@kupietz-deliko2026]
+
## Source Code
### Print Collocation Analysis as DataTable
diff --git a/examples/references.bib b/examples/references.bib
index 7a73b87..4d09137 100644
--- a/examples/references.bib
+++ b/examples/references.bib
@@ -20,3 +20,15 @@
pages = {7015--7021},
}
+@inproceedings{kupietz-deliko2026,
+ title = {National Library as Corpus – {DeLiKo-2025@DNB}: a Very Large Corpus of {German}-language Contemporary Literature},
+ author = {Kupietz, Marc and Diewald, Nils and Genêt, Philippe and Witt, Andreas},
+ booktitle = {Proceedings of the Fifteenth Language Resources and Evaluation Conference (LREC 2026)},
+ month = {May},
+ year = {2026},
+ pages = {6528--6535},
+ address = {Palma, Mallorca, Spain},
+ publisher = {European Language Resources Association (ELRA)},
+ editor = {Piperidis, Stelios and Bel, Núria and van den Heuvel, Henk and Ide, Nancy and Krek, Simon and Toral, Antonio},
+ doi = {10.63317/59wsms6588ys},
+}
diff --git a/inst/reveal.js-5.1.0/css/theme/source/ids.scss b/inst/reveal.js-5.1.0/css/theme/source/ids.scss
index 20e9416..2f65834 100644
--- a/inst/reveal.js-5.1.0/css/theme/source/ids.scss
+++ b/inst/reveal.js-5.1.0/css/theme/source/ids.scss
@@ -612,18 +612,21 @@
text-indent: -22px ;
}
-.csl-entry::first-line {
- color: #253b43;
-}
-
-.csl-entry {
+// .references scopes these above pandoc's CSL defaults (div.csl-entry), which
+// otherwise win on specificity and pin margin-bottom to 0em.
+.references .csl-entry {
color: #888888;
+ margin-bottom: 0.5em;
}
-/* Add line break after authors and year*/
-.csl-entry :first-child::before {
- content: "\a";
- white-space: pre;
+// "Authors (Year):" as a bold dark first line; the theme template's JS wraps
+// the leading text of each entry in .csl-authors-year (see default.html) --
+// which part of an entry citeproc wraps in spans depends on the entry type, so
+// a CSS-only break cannot place it reliably.
+.csl-entry .csl-authors-year {
+ display: block;
+ font-weight: bold;
+ color: #4d616b;
}
.reveal code.sourceCode:last-child + pre {
diff --git a/inst/reveal.js-5.1.0/dist/theme/ids.css b/inst/reveal.js-5.1.0/dist/theme/ids.css
index b8c44f3..da527dd 100644
--- a/inst/reveal.js-5.1.0/dist/theme/ids.css
+++ b/inst/reveal.js-5.1.0/dist/theme/ids.css
@@ -808,18 +808,21 @@
text-indent: -22px;
}
-.csl-entry::first-line {
- color: #253b43;
-}
-
-.csl-entry {
+/* .references scopes this above pandoc's CSL defaults (div.csl-entry), which
+ otherwise win on specificity and pin margin-bottom to 0em. */
+.references .csl-entry {
color: #888888;
+ margin-bottom: 0.5em;
}
-/* Add line break after authors and year*/
-.csl-entry :first-child::before {
- content: "\a";
- white-space: pre;
+/* "Authors (Year):" as a bold dark first line; the theme template's JS wraps
+ the leading text of each entry in .csl-authors-year (see default.html) --
+ which part of an entry citeproc wraps in spans depends on the entry type, so
+ a CSS-only break cannot place it reliably. */
+.csl-entry .csl-authors-year {
+ display: block;
+ font-weight: bold;
+ color: #4d616b;
}
.reveal code.sourceCode:last-child+pre {
diff --git a/inst/rmarkdown/templates/revealjs_presentation/resources/default.html b/inst/rmarkdown/templates/revealjs_presentation/resources/default.html
index 2d8b497..1854ae0 100644
--- a/inst/rmarkdown/templates/revealjs_presentation/resources/default.html
+++ b/inst/rmarkdown/templates/revealjs_presentation/resources/default.html
@@ -740,6 +740,45 @@
$endif$
$if(theme-ids)$
+<script>
+ // IDS theme: in the bibliography, "Authors (Year):" should form a bold first
+ // line, followed by a line break. Which part of an entry citeproc wraps in
+ // spans/links depends on the entry type, so a CSS "break before first child
+ // element" hack cannot place the break reliably. Wrap the leading text up to
+ // and including the first "):" explicitly instead; entries without a year
+ // marker are left untouched.
+ (function () {
+ document.querySelectorAll('.csl-entry').forEach(function (entry) {
+ var textNodes = [];
+ var accumulated = '';
+ var children = Array.prototype.slice.call(entry.childNodes);
+ for (var i = 0; i < children.length; i++) {
+ var node = children[i];
+ if (node.nodeType !== Node.TEXT_NODE) break; // year marker only valid in leading text
+ textNodes.push(node);
+ accumulated += node.textContent;
+ var idx = accumulated.indexOf('):');
+ if (idx < 0) continue;
+ var remainder = accumulated.length - (idx + 2);
+ var span = document.createElement('span');
+ span.className = 'csl-authors-year';
+ textNodes.slice(0, -1).forEach(function (n) { span.appendChild(n); });
+ var last = textNodes[textNodes.length - 1];
+ if (remainder > 0) {
+ span.appendChild(document.createTextNode(last.textContent.slice(0, -remainder)));
+ last.textContent = last.textContent.slice(-remainder);
+ } else {
+ span.appendChild(last);
+ }
+ entry.insertBefore(span, entry.firstChild);
+ break;
+ }
+ });
+ })();
+</script>
+$endif$
+
+$if(theme-ids)$
<footer id="ids-footer"><span>
$for(author)$$if(author.name)$$author.name$$else$$author$$endif$${ sep }, $endfor$ · $title$ · $date$</span></footer>
$endif$