Skip to content

Instantly share code, notes, and snippets.

@ilius
Last active May 4, 2023 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilius/bde2c7b7bf5374ac151b0f6d4bb254fd to your computer and use it in GitHub Desktop.
Save ilius/bde2c7b7bf5374ac151b0f6d4bb254fd to your computer and use it in GitHub Desktop.
# Go's template funcs:
# https://github.com/golang/go/blob/master/src/text/template/funcs.go
header_template = """
<b><font color='#ccf'>{{.DictName}}</font></b>
<font color='#aaa'> [%{{.Score}}]</font>
{{if .ShowTerms }}
<div dir="ltr" style="font-size: large;font-weight:bold;">
{{ index .Terms 0 }}
</div>
{{if gt (len .Terms) 1}}
{{range $lineI, $terms := wrapterms (slice .Terms 1) 40}}
{{if gt $lineI 0 }}
<br>
{{else}}
<font color="#ffaaaa"> | </font>
{{end}}
{{range $termI, $term := $terms }}
<span dir="ltr" style="font-weight:bold;">
{{if gt $termI 0 }}
<font color="#ffaaaa"> | </font>
{{end}}
{{ $term }}
</span>
{{end}}
{{end}}
{{end}}
{{end}}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment