@zsnout/ithkuil
Version:
A set of tools which can generate and parse romanized Ithkuil text and which can generate Ithkuil script from text and JSON data.
49 lines (48 loc) • 1.84 kB
TypeScript
import type { SecondaryCharacter } from "./index.js";
/** Removes `readonly` modifiers from an object. */
export type Mutable<T> = {
-readonly [K in keyof T]: T[K];
};
/** Options modifiying how secondary characters are translated. */
export interface SecondaryTranslationOptions {
/** Whether these characters should be handwritten. */
readonly handwritten?: boolean | undefined;
/**
* Whether all characters other than the first should be placed on extensions.
*
* @default false
*/
readonly forcePlaceholderCharacters?: boolean | undefined;
/**
* The placeholder character to use when needed.
*
* @default "STANDARD_PLACEHOLDER"
*/
readonly placeholder?: "STANDARD_PLACEHOLDER" | "ALPHABETIC_PLACEHOLDER" | undefined;
/**
* How to mark geminates. If `true`, geminates are marked with the special
* `CORE_GEMINATE` extension. If `false`, geminates are marked with standard
* extensions.
*
* @default true
*/
readonly useGeminateMarkers?: boolean | undefined;
/**
* Whether right diacritics should be used to indicate vowels. When `false`,
* VVC(C)(C), (C)(C)CVV, and V(C)C(C)V patterns are translated using multiple
* characters.
*
* @default true
*/
readonly useRightDiacritics?: boolean | undefined;
}
/**
* Converts text into secondary character templates.
*
* @param text The text to be converted. Use spaces to force character breaks,
* and use underscore to force placeholders and extension locations.
* @param options Options that modify how the secondary characters are
* translated.
* @returns An array of secondary characters parsed from the text.
*/
export declare function textToSecondaries(text: string, options: SecondaryTranslationOptions): SecondaryCharacter[];