Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
refactor(Style, RenderItemDate): simplify
Browse files Browse the repository at this point in the history
Just use a single format property.

Signed-off-by: Bruce D'Arcus <[email protected]>
  • Loading branch information
bdarcus committed May 10, 2023
1 parent 525ca78 commit 241b500
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion examples/style.csl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ citation:
bibliography:
format:
- template: author-apa-full
- template: year
- date: issued
format: year
wrap: parentheses
- template: title
- template: container-apa
Expand Down
9 changes: 5 additions & 4 deletions src/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface TemplateFile {
templates: NamedTemplate[];
}

export type DateFormat = "year" | "year-month" | "year-month-day" | "month-day";

export type WrapPunctuation = "parentheses" | "brackets" | "quotes";
export interface HasFormatting {
/**
Expand Down Expand Up @@ -560,10 +562,9 @@ interface RenderItemSimple extends HasFormatting {
}

interface RenderItemDate extends HasFormatting {
variable: Dates;
year?(date: string): string; // CSLDate
month?(date: string): string;
format?(date: string): string;
date: Dates;
// TODO align this with DateOptions
format: DateFormat;
}

interface RenderTitle extends HasFormatting {
Expand Down

0 comments on commit 241b500

Please sign in to comment.