diff --git a/src/processor.ts b/src/processor.ts index 457d2d5..8cb5899 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -167,9 +167,9 @@ export class Processor { getProcReferences(): ProcReference[] { const citekeys = Object.keys(this.bibliography); // first check bib sort config, then fallback to global - const sortConfig = this.style.bibliography?.options?.sort || - this.style.options?.sort || undefined; - const groupConfig = this.style.bibliography?.options?.group || + const sortConfig = this.style.bibliography?.options?.processing?.sort || + this.style.options?.processing?.sort || undefined; + const groupConfig = this.style.bibliography?.options?.processing?.group || this.style.options?.group || undefined; const references = citekeys.map((citekey) => { const pref = new ProcReference(this.bibliography[citekey], {}); diff --git a/src/style/options.ts b/src/style/options.ts index 4e047a3..07ec63b 100644 --- a/src/style/options.ts +++ b/src/style/options.ts @@ -32,21 +32,13 @@ export interface Options { */ export interface OptionGroup { /** - * Sorting configuration. - */ - sort?: SortConfig[]; - /** - * Grouping configuration. + * Processing configuration. */ - group?: GroupSortKeys[]; + processing?: Processing | ProcessingPresets; // allow a string key for this also /** * Substitution configuration. */ substitute?: Substitution; - /** - * Disambiguation configuration of rendererd group display names. - */ - disambiguate?: Disambiguation; /** * Localization configuration. */ @@ -61,6 +53,38 @@ export interface OptionGroup { contributors?: ContributorListFormatting; } +/** + * Preconfigured processing options. + */ +export type ProcessingPresets = + /// For author-date (Doe, 2019) citations; typically in-text, though can also be footnote-based. + | "author-date" + /// For numeric (1) citations, where the number is the order of first appearance in the document. + | "numeric-as-cited" + /// For numeric (1) citations, where the number based on author-date sorted of the reference list. + // Review: Is this actually a thing? + | "numeric-sorted" + /// TODO + | "note"; + +/** + * Processing configures the often-related sorting, grouping and disambiguation operations. + */ +export interface Processing { + /** + * Sorting configuration. + */ + sort?: SortConfig[]; + /** + * Grouping configuration. + */ + group?: GroupSortKeys[]; + /** + * Disambiguation configuration of rendererd group display names. + */ + disambiguate?: Disambiguation; +} + /** * Terms and data localization configuration. */ diff --git a/src/style/template.ts b/src/style/template.ts index 12ee569..a219aaf 100644 --- a/src/style/template.ts +++ b/src/style/template.ts @@ -4,7 +4,13 @@ import { LocalizedTermFormat, LocalizedTermName } from "./locale.ts"; import { HasFormatting, Locators, Variables } from "../style/mod.ts"; -import { ContributorRoles, Dates, ReferenceTypes, SimpleTypes, Titles } from "../variables.ts"; +import { + ContributorRoles, + Dates, + ReferenceTypes, + SimpleTypes, + Titles, +} from "../variables.ts"; import { Options } from "./options.ts"; export type DateFormat = "year" | "year-month" | "full" | "month-day";