/** * @fileoverview `linkTextReader` — the text each link element in one field wraps, as a reader is * left holding it once the element's tags come out: everything from the end of its opening tag * to the first closing tag of its name, with any markup inside removed and whitespace * collapsed. The strip pass asks it one question per link, whether that text contains an * address, and reads the answer off this rather than off a string of its own. * * Every opener before one closer reads a piece of the same text — a link nested in a link, or a * run of openers a deposit never closes, all end at the first closer after them — so the text * up to each closer is read once, with the offset each opener's piece starts at, and every * opener asks its question against that one reading. The markup inside it is removed by a scan * that finds each `<` and the next `>` once, so a run of brackets no `>` follows is read once * rather than once per bracket. What results is exactly what reading each opener's text on its * own would give: a piece starts right after its opener's `>`, where the scan of the whole span * is between tags too. * @module services/crossref/link-text */ /** The text a link element wraps, reduced to the one question asked of it. */ export interface LinkText { /** Whether the text contains `search` verbatim. */ includes(search: string): boolean; } /** * A reader over one field: given where an opener's tag ends and the element's name, the text * that element wraps, or undefined when no closer of its name follows. `closers` holds each * link element's closing-tag pattern, global so a search can start where the opener ends. * * The closer found for a name is kept, and any later opener that ends before it shares it: the * first closer after an earlier position that lies past a later one is the first after that * one too. Only an opener past the kept closer searches again, so no part of the field is * searched or read twice. */ export declare function linkTextReader(whole: string, closers: ReadonlyMap): (from: number, name: string) => LinkText | undefined; //# sourceMappingURL=link-text.d.ts.map