Render the engine-usage sentence ("simplification", "expansion", "solving").
(u: Usage | undefined)
| 235 | |
| 236 | /** Render the engine-usage sentence ("simplification", "expansion", "solving"). */ |
| 237 | function usageSentence(u: Usage | undefined): string { |
| 238 | if (!u) return ''; |
| 239 | const verbs: string[] = []; |
| 240 | if (u.purposes.has('simplify')) verbs.push('simplification'); |
| 241 | if (u.purposes.has('expand')) verbs.push('expansion'); |
| 242 | if (u.targets.has('solve')) verbs.push('equation solving'); |
| 243 | if (verbs.length === 0) return ''; |
| 244 | const list = |
| 245 | verbs.length === 1 |
| 246 | ? verbs[0] |
| 247 | : verbs.slice(0, -1).join(', ') + ' and ' + verbs[verbs.length - 1]; |
| 248 | return `Used by the Compute Engine for ${list}.`; |
| 249 | } |
| 250 | |
| 251 | /** Turn a reference (URL or citation string) into a markdown link. */ |
| 252 | function renderReference(ref: string): string { |
no test coverage detected