41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
|
/**
|
||
|
* A word whose value is text with provenance- this literal value appeared in the source
|
||
|
* code, and was not the result of any backslash, variable, or command substitutions.
|
||
|
*
|
||
|
* This provides a level of intentionality that commands can use to distinguish switches:
|
||
|
*
|
||
|
* ```tcl
|
||
|
* puts -stderr text ;# -stderr can be interpreted as a flag and is not part of the message to print
|
||
|
* puts "-stderr" text ;# -stderr is not a flag, but is part of the message to print
|
||
|
* puts $var text ;# The value of $var is part of the message to print, even if the value happens to be "-stderr"
|
||
|
* ```
|
||
|
*/
|
||
|
export type EnchantedWord = {
|
||
|
enchanted: string;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* A word whose value is plain text, with no special provenance.
|
||
|
*/
|
||
|
export type TextWord = {
|
||
|
text: string;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* A word whose value is "safe" HTML using allowlisted elements/attributes/styles,
|
||
|
* suitable for inclusion in HTML output with no escaping.
|
||
|
*/
|
||
|
export type HtmlWord = {
|
||
|
html: string;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* A word whose value needs to be determined by evaluating some combination of variable and command
|
||
|
* substitutions, and concatenating the results with any literal spans.
|
||
|
*/
|
||
|
export type InterpolatedWord = {
|
||
|
pieces: [];
|
||
|
};
|
||
|
|
||
|
export type Word = EnchantedWord | TextWord | HtmlWord | InterpolatedWord;
|