Commit d7a09778 authored by Kaushal Modi's avatar Kaushal Modi

Tweak the version printing

- Now strings like "1.10.1" gets printed without double-quotes
- When multiple tool versions are listed, they get listed as "a 1.0, b 2.0"
  instead of "a 1.0 , b 2.0" (notice that space *before* that comma? ;-))
parent b3ecf269
......@@ -61,9 +61,14 @@
<small>
{{ printf "<span style=\"font-variant: small-caps;\">Versions used</span>:" | safeHTML }}
{{ range $k, $v := . }}
{{ printf "<code>%s</code> %#v" $k $v | safeHTML }}
{{ $.Scratch.Add "__versions_cnt" 1 }}
{{ cond (eq ($.Scratch.Get "__versions_cnt") ($.Scratch.Get "__versions_len")) "" ", " }}
{{ printf "<code>%s</code> " $k | safeHTML }}
{{ if (eq "string" (printf "%T" $v)) }} <!-- Check if the value is a string -->
{{ printf "%s" $v | safeHTML -}} <!-- Don't print strings using "%#v" else they get double-quoted -->
{{- else -}}
{{- printf "%#v" $v | safeHTML -}} <!-- Cannot print floats like 0.39 using "%s", so using "%#v" -->
{{- end -}}
{{- $.Scratch.Add "__versions_cnt" 1 -}}
{{- cond (eq ($.Scratch.Get "__versions_cnt") ($.Scratch.Get "__versions_len")) "" ", " }}
{{ end }}
</small>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment