-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
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
typst/crates/typst-library/src/model/bibliography.rs
Lines 126 to 131 in 59243da
| /// 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. |
typst/crates/typst-library/src/model/bibliography.rs
Lines 439 to 447 in 59243da
| 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
CastInfouses a&'static str
but it would indeed also not add it for autocompletion.
Good points. Perhaps we can make some changes toCastInfo. Say, provide a mechanism to annotate twoValue(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
CiteElemandBibliographyElemboth use this same type, they share the same list
Then I think it's fine to just ignore the difference between
citeandbibliography. Since no one would normally want to use alphanumeric forbibliography, 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