(mapper: htmlTextMapper, codes: CharacterDiff[])
| 169 | // codes are (span class, start, end) triples. |
| 170 | // This wraps html[start..end] in appropriate <span>..</span>s. |
| 171 | export function codesToHtml(mapper: htmlTextMapper, codes: CharacterDiff[]) { |
| 172 | let html = ''; |
| 173 | for (const [type, start, limit] of codes) { |
| 174 | const thisHtml = mapper.getHtmlSubstring(start, limit); |
| 175 | if (type == null) { |
| 176 | html += thisHtml; |
| 177 | } else { |
| 178 | html += '<span class="char-' + type + '">' + thisHtml + '</span>'; |
| 179 | } |
| 180 | } |
| 181 | return html; |
| 182 | } |
no test coverage detected