MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / generateOutput

Function generateOutput

static/ansi-to-html.ts:122–144  ·  view source on GitHub ↗
(stack: string[], token: string, data: string | number, options: AnsiToHtmlOptions)

Source from the content-addressed store, hash-verified

120}
121
122function generateOutput(stack: string[], token: string, data: string | number, options: AnsiToHtmlOptions): string {
123 if (token === 'text') {
124 assert(isString(data), "Param 'data' must be a string at this point");
125 return pushText(data, options);
126 }
127 if (token === 'display') {
128 return handleDisplay(stack, data, options);
129 }
130 if (token === 'xterm256') {
131 assert(isString(data), "Param 'data' must be a string at this point");
132 return handleXterm256(stack, data, options);
133 }
134 if (token === 'rgb') {
135 assert(isString(data), "Param 'data' must be a string at this point");
136 return handleRgb(stack, data, options);
137 }
138 if (token === 'url') {
139 assert(isString(data), "Param 'data' must be a string at this point");
140 return handleUrl(stack, data, options);
141 }
142
143 return '';
144}
145
146function handleRgb(stack: string[], data: string, options: AnsiToHtmlOptions) {
147 data = data.substring(2).slice(0, -1);

Callers 1

toHtmlMethod · 0.85

Calls 7

isStringFunction · 0.85
pushTextFunction · 0.85
handleDisplayFunction · 0.85
handleXterm256Function · 0.85
handleRgbFunction · 0.85
handleUrlFunction · 0.85
assertFunction · 0.70

Tested by

no test coverage detected