1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| {% import ( "github.com/robert-nix/ansihtml"
"{{{ .Package }}}/app/util" ) %}
{% func DisplayTerminal(id string, s string) %}{% stripspace %} {%- code raw := string(ansihtml.ConvertToHTML([]byte(s))) lines := util.StringSplitLines(raw) if len(lines) > 0 && lines[len(lines) - 1] == "" { lines = lines[:len(lines) - 1] } -%} <div class="overflow full-width"> <table class="mt"> <tbody id="{%s id %}"> {%- for idx, line := range lines -%} <tr style="font-family: monospace;"> <td class="shrink br" style="padding: 2px var(--padding) 2px 0; vertical-align: top;">{%d idx + 1 %}</td> <td style="padding: 2px var(--padding);"><div style="white-space: pre-wrap; word-wrap: break-word; word-break: break-word;">{%s= line %}</div></td> </tr> {%- endfor -%} </tbody> </table> </div> {% endstripspace %}{% endfunc %}
|