Skip to content

Show aliases of citation styles in the docs #6669

@YDX-2147483647

Description

@YDX-2147483647

Description

Some citation styles have multiple names, a main display name, and one or more aliases.

Currently, the docs site says aliases are listed as a dedicated style, but in fact they are not listed anywhere.

https://typst.app/docs/reference/model/bibliography/#parameters-style

/// The bibliography style.
///
/// This can be:
/// - A string with the name of one of the built-in styles (see below). Some
/// of the styles listed below appear twice, once with their full name and
/// once with a short alias.

impl Reflect for CslSource {
#[comemo::memoize]
fn input() -> CastInfo {
let source = std::iter::once(DataSource::input());
let names = ArchivedStyle::all().iter().map(|name| {
CastInfo::Value(name.names()[0].into_value(), name.display_name())
});
CastInfo::Union(source.into_iter().chain(names).collect())
}

"institute-of-electrical-and-electronics-engineers" IEEE

We could change it to

"institute-of-electrical-and-electronics-engineers" IEEE (alias: "ieee")

Warning

It's still uncertain whether this is the right way to go:

this will not compile atm because CastInfo uses a &'static str
but it would indeed also not add it for autocompletion.
Good points. Perhaps we can make some changes to CastInfo. Say, provide a mechanism to annotate two Value(Value, &'static str) are equivalent.

https://discord.com/channels/1054443721975922748/1399326777540608041/1399349305629741081


Besides, it is known "alphanumeric" is listed in both cite and bibliography, but not actually suitable for bibliography.
However, I don't think it worth fixing.

Because CiteElem and BibliographyElem both use this same type, they share the same list

Then I think it's fine to just ignore the difference between cite and bibliography. Since no one would normally want to use alphanumeric for bibliography, even if someone uses it accidentally (e.g., select the wrong item in auto completion), typst still provides a lovely error message. The difference only matters when enumerating all styles, which is quite rare.

https://discord.com/channels/1054443721975922748/1399326777540608041/1399364343296036964

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions