Rename bibliography styles

This commit is contained in:
Laurenz 2023-04-04 18:29:18 +02:00
parent bfec777542
commit 5b0297464e
3 changed files with 20 additions and 19 deletions

View File

@ -12,6 +12,9 @@ description: |
- `typst fonts` to list all fonts - `typst fonts` to list all fonts
- **Breaking:** Manual counters now start at zero. Read the "How to step" - **Breaking:** Manual counters now start at zero. Read the "How to step"
section [here]($func/counter) for more details section [here]($func/counter) for more details
- **Breaking:** Renamed the `{"author-date"}` and `{"author-title"}`
[bibliography styles]($func/bibliography.style) to `{"chicago-author-date"}`
and `{"chicago-author-title"}`
- Added support for clipping in [boxes]($func/box.clip) and - Added support for clipping in [boxes]($func/box.clip) and
[blocks]($func/block.clip) [blocks]($func/block.clip)
- Added [`polygon`]($func/polygon) function for drawing polygons - Added [`polygon`]($func/polygon) function for drawing polygons

View File

@ -218,7 +218,7 @@ pub enum BibliographyStyle {
Apa, Apa,
/// The Chicago Author Date style. Based on the 17th edition of the Chicago /// The Chicago Author Date style. Based on the 17th edition of the Chicago
/// Manual of Style, Chapter 15. /// Manual of Style, Chapter 15.
AuthorDate, ChicagoAuthorDate,
/// The style of the Institute of Electrical and Electronics Engineers. /// The style of the Institute of Electrical and Electronics Engineers.
/// Based on the 2018 IEEE Reference Guide. /// Based on the 2018 IEEE Reference Guide.
Ieee, Ieee,
@ -231,10 +231,10 @@ impl BibliographyStyle {
/// The default citation style for this bibliography style. /// The default citation style for this bibliography style.
pub fn default_citation_style(self) -> CitationStyle { pub fn default_citation_style(self) -> CitationStyle {
match self { match self {
Self::Apa => CitationStyle::AuthorDate, Self::Apa => CitationStyle::ChicagoAuthorDate,
Self::AuthorDate => CitationStyle::AuthorDate, Self::ChicagoAuthorDate => CitationStyle::ChicagoAuthorDate,
Self::Ieee => CitationStyle::Numerical, Self::Ieee => CitationStyle::Numerical,
Self::Mla => CitationStyle::AuthorDate, Self::Mla => CitationStyle::ChicagoAuthorDate,
} }
} }
} }
@ -294,7 +294,7 @@ pub struct CiteElem {
/// ///
/// #bibliography( /// #bibliography(
/// "works.bib", /// "works.bib",
/// style: "author-date", /// style: "chicago-author-date",
/// ) /// )
/// ``` /// ```
#[default(true)] #[default(true)]
@ -354,14 +354,14 @@ pub enum CitationStyle {
/// A simple alphanumerical style. For example, the output could be Rass97 /// A simple alphanumerical style. For example, the output could be Rass97
/// or MKG+21. /// or MKG+21.
Alphanumerical, Alphanumerical,
/// The Chicago Author Date style. Based on the 17th edition of the Chicago
/// Manual of Style, Chapter 15.
AuthorDate,
/// A Chicago-like author-title format. Results could look like this:
/// Prokopov, “It Is Fast or It Is Wrong”.
AuthorTitle,
/// Citations that just consist of the entry keys. /// Citations that just consist of the entry keys.
Keys, Keys,
/// The Chicago Author Date style. Based on the 17th edition of the Chicago
/// Manual of Style, Chapter 15.
ChicagoAuthorDate,
/// The Chicago-like author-title format. Results could look like this:
/// Prokopov, “It Is Fast or It Is Wrong”.
ChicagoAuthorTitle,
} }
impl CitationStyle { impl CitationStyle {
@ -458,10 +458,12 @@ fn create(
CitationStyle::Alphanumerical => { CitationStyle::Alphanumerical => {
Box::new(style::Alphanumerical::new()) Box::new(style::Alphanumerical::new())
} }
CitationStyle::AuthorDate => { CitationStyle::ChicagoAuthorDate => {
Box::new(style::ChicagoAuthorDate::new()) Box::new(style::ChicagoAuthorDate::new())
} }
CitationStyle::AuthorTitle => Box::new(style::AuthorTitle::new()), CitationStyle::ChicagoAuthorTitle => {
Box::new(style::AuthorTitle::new())
}
CitationStyle::Keys => Box::new(style::Keys::new()), CitationStyle::Keys => Box::new(style::Keys::new()),
}; };
} }
@ -515,7 +517,7 @@ fn create(
let bibliography_style: Box<dyn style::BibliographyStyle> = match style { let bibliography_style: Box<dyn style::BibliographyStyle> = match style {
BibliographyStyle::Apa => Box::new(style::Apa::new()), BibliographyStyle::Apa => Box::new(style::Apa::new()),
BibliographyStyle::AuthorDate => Box::new(style::ChicagoAuthorDate::new()), BibliographyStyle::ChicagoAuthorDate => Box::new(style::ChicagoAuthorDate::new()),
BibliographyStyle::Ieee => Box::new(style::Ieee::new()), BibliographyStyle::Ieee => Box::new(style::Ieee::new()),
BibliographyStyle::Mla => Box::new(style::Mla::new()), BibliographyStyle::Mla => Box::new(style::Mla::new()),
}; };

View File

@ -1,9 +1,5 @@
// Test citations and bibliographies. // Test citations and bibliographies.
---
// Error: 15-25 parsing failed at ../assets/files/bad.bib:5: wrong number of digits
#bibliography("/bad.bib")
--- ---
// Test ambiguous reference. // Test ambiguous reference.
= Introduction <arrgh> = Introduction <arrgh>
@ -20,7 +16,7 @@ See also #cite("arrgh", "distress", [p. 22]), @arrgh[p. 4], and @distress[p. 5].
--- ---
// Test unconventional order. // Test unconventional order.
#set page(width: 200pt) #set page(width: 200pt)
#bibliography("/works.bib", title: [Works to be cited], style: "author-date") #bibliography("/works.bib", title: [Works to be cited], style: "chicago-author-date")
#line(length: 100%) #line(length: 100%)
#[#set cite(brackets: false) #[#set cite(brackets: false)
As described by @netwok], As described by @netwok],