open-agreements
Version:
Open-source legal template filling CLI and library
35 lines • 1.24 kB
TypeScript
/**
* Shared parsing logic for replacement key syntax extensions.
*
* Key formats:
* - Simple: "search text" → replaces all occurrences
* - Context: "context > placeholder" → in tables, replaces placeholder in rows
* where label matches; in paragraphs, replaces first placeholder after context
*/
/** A replacement value: either a plain string or an object with value + formatting. */
export type ReplacementValue = string | {
value: string;
format?: Record<string, unknown>;
};
/** Extract the plain string value from a ReplacementValue. */
export declare function resolveReplacementValue(rv: ReplacementValue): string;
export type ParsedKey = {
type: 'simple';
searchText: string;
value: string;
} | {
type: 'context';
context: string;
searchText: string;
value: string;
};
/**
* Parse a replacement key string into its typed representation.
*/
export declare function parseReplacementKey(key: string, value: string): ParsedKey;
/**
* Extract the actual search text from a replacement key.
* Used by the verifier and validators to check for leftover placeholders.
*/
export declare function extractSearchText(key: string): string;
//# sourceMappingURL=replacement-keys.d.ts.map