/** * Citations in Pandoc's syntax (#268): * * - `[@garcia2020]`, `[@garcia2020, p. 33; @lopez2019]` — parenthetical; * - `[see @garcia2020, chap. 2, emphasis added]` — prefix, locator, suffix; * - `[-@garcia2020]` — the author left out; * - `@garcia2020` and `@garcia2020 [p. 33]` — narrative, in the sentence. * * An `@` glued to a letter or a digit (an e-mail address) or escaped * (`\@`) is text, and so is one in inline code. Each citation becomes a * placeholder span; the pipeline formats it, or, when the book has no * reference for it, prints it back as written. */ import type { CitationClusterInput, CitationItemInput } from '../citations/types.js'; import type { InlineSpan } from './types.js'; /** Stands for a citation in the plain text until it is formatted. Not * `TAB_PLACEHOLDER` (U+E1A8): a citation read as a tab dropped the space * before it and lost its place in the source map (#1215). */ export declare const CITATION_PLACEHOLDER = "\uE1A9"; /** A citation as the parser read it. */ export interface CitationMeta { cluster: CitationClusterInput; /** The citation as written, printed back when it cannot be formatted. */ raw: string; /** Absolute source range. */ sourceStart: number; sourceEnd: number; } /** The locator and suffix of the text after an item's key (`, p. 33, * emphasis added`): a known label, else a bare number meaning a page. A * suffix keeps the comma it was written with, a locator or not before it * (`[@k, inter alia]` → `, inter alia`: "(Brown et al., 2020, inter * alia)", as Pandoc prints it); one written with no comma (`[@k inter * alia]`) has none. Emphasis in it stays Markdown (`*inter alia*`): the * formatter reads it (see `affixSpans`). */ export declare function parseLocator(rest: string): Pick; /** A citation's prefix or suffix as spans: its Markdown emphasis read * (`*e.g.*`, `**sic**`, `^a^`, `:smallcaps[…]`, #528), the spaces at its * ends kept. */ export declare function affixSpans(text: string): InlineSpan[]; /** A citation's prefix or suffix in the rich text a CSL processor reads in * an affix (citeproc-js and Pandoc's citeproc alike): ``, ``, * ``, `` and small capitals as ``; the text as written, which the * processor escapes itself. */ export declare function affixRichText(text: string): string; /** * Extract the citations of a line's text, replacing each by * {@link CITATION_PLACEHOLDER}. Runs after the inline references (so * `@sec:id` is taken first) and before the emphasis passes. */ export declare function extractInlineCitations(text: string, fallbackStart: number): { cleaned: string; citations: CitationMeta[]; }; /** Attach a `citation` to each {@link CITATION_PLACEHOLDER} in order. */ export declare function injectCitationSpans(spans: InlineSpan[], citations: CitationMeta[]): InlineSpan[]; //# sourceMappingURL=citations.d.ts.map