/** * The citations of a book (#272): every reference its documents define, * every citation in reading order, and where each document's citations * sit in that order. Numbering, disambiguation and *ibid.* see the whole * book, so each document is formatted against its book's context — the * host builds it once (`bookCitationContexts`) and hands each chapter its * own; a document laid out alone is a book of one. */ import type { ContentBlock } from '../parse/index.js'; import type { CitationClusterInput, CslItem } from './types.js'; import { type ReferenceIssue } from './data.js'; import type { Resource } from '../types.js'; /** A document's share of its book's citations. */ export interface CitationContext { /** Every reference of the book (the first definition of a key wins). */ items: CslItem[]; /** Keys the book lists without citing them (`'*'`: all). */ nocite: string[]; /** Every citation of the book in note order: reading order, a citation * inside a footnote at its note's place. `noteIndex` is the note a * note style sets it in. */ clusters: CitationClusterInput[]; /** The index in {@link clusters} of each citation of this document, in * the order the document's spans hold them. */ local: number[]; /** Some document of the book places the bibliography (`:::bibliography`). */ placed: boolean; /** This document is the book's last (the bibliography goes after it when * nothing places it). */ last: boolean; /** Problems with this document's reference data. */ issues: ReferenceIssue[]; /** The citations in the caption and the note of each resource this * document places (#529): the index in {@link clusters} of each, in the * order the caption's, then the note's, text holds them. A caption cites * where the resource is placed: right after the block that first * refers to it in the book (its `::resource` block or first `:ref`). */ captions?: Record; /** The chapter of each citation of {@link clusters} (#537): counted * through the book, a new one at each document and at each level-1 * heading after a citation. `citations.numbering: 'chapter'` processes * each chapter's citations on their own. */ chapters?: number[]; } /** Where a resource's caption and note citations sit in a book's * {@link CitationContext.clusters}. */ export interface CaptionCitationIndexes { caption: number[]; note: number[]; } /** The resources a block refers to (a `::resource` block, `:ref` spans), * in order. */ export declare function blockResourceIds(b: ContentBlock, isResource: (id: string) => boolean): string[]; /** The citations of a parsed document, each with the note it sits in: * `note` is the footnote id for a citation in a footnote's text. */ export declare function citationsOfBlocks(blocks: readonly ContentBlock[]): { cluster: CitationClusterInput; note?: string; }[]; /** Whether a document has anything for the citations to do: a citation, * a `:::references` or `:::bibliography` block, or references in its front * matter. */ export declare function needsCitationContext(blocks: readonly ContentBlock[], metadata: Record | object | undefined): boolean; /** Whether the parsed content places a bibliography. */ export declare function hasBibliographyDirective(blocks: readonly ContentBlock[]): boolean; /** One document of a book, parsed: its front matter and blocks. */ export interface CitationSource { metadata?: Record; blocks: readonly ContentBlock[]; } /** The parsed form of a document's markdown, for {@link bookCitationContexts}. */ export declare function citationSourceOf(markdown: string): CitationSource; /** * The citation context of every document of a book, in order. Notes are * counted through the book: a footnote marker takes the next note the * first time its id is cited, a citation in the text takes a note of its * own (where a note style sets it), and a citation in a footnote's text * sits in that footnote's note. With the book's `resources`, the citations * of a caption or a note (#529) follow those of the block that first * refers to the resource (where it is placed), in the note that block * reached. */ export declare function bookCitationContexts(sources: readonly CitationSource[], resources?: readonly Pick[]): CitationContext[]; /** A fingerprint of a context's book-wide part: what a chapter's citations * and bibliography depend on (a host compares it to know a chapter's * layout went stale). */ export declare function citationContextKey(ctx: CitationContext | undefined): string; //# sourceMappingURL=context.d.ts.map