Specify which CSL style is not suitable for bibliographies (#6306)

Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
Andrew Voynov 2025-06-10 20:59:06 +03:00 committed by GitHub
parent 5d34d54df4
commit a6ab6ac99a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -227,7 +227,15 @@ impl Show for Packed<BibliographyElem> {
let references = works
.references
.as_ref()
.ok_or("CSL style is not suitable for bibliographies")
.ok_or_else(|| match self.style(styles).source {
CslSource::Named(style) => eco_format!(
"CSL style \"{}\" is not suitable for bibliographies",
style.display_name()
),
CslSource::Normal(..) => {
"CSL style is not suitable for bibliographies".into()
}
})
.at(span)?;
if references.iter().any(|(prefix, _)| prefix.is_some()) {

View File

@ -71,6 +71,10 @@ Now we have multiple bibliographies containing @glacier-melt @keshav2007read
#bibliography("/assets/bib/works_too.bib", style: "mla")
--- bibliography-style-not-suitable ---
// Error: 2-62 CSL style "Alphanumeric" is not suitable for bibliographies
#bibliography("/assets/bib/works.bib", style: "alphanumeric")
--- issue-4618-bibliography-set-heading-level ---
// Test that the bibliography block's heading is set to 2 by the show rule,
// and therefore should be rendered like a level-2 heading. Notably, this