{{ $dir := printf "/content/%s/%s%s" .Page.Language.Lang .Page.File.Dir "metrics" -}}
{{ $regexp := .Get "regexp" | default "." -}}

{{ $counter := 0 -}}
<table>
  {{ range readDir $dir -}}
    {{ if eq 0 (mod $counter 6) -}}
    <tr>
    {{ end -}}
      {{ if (findRE $regexp .Name) -}}
        {{ $displayName := .Name | replaceRE "^etcd-metrics-" "" | replaceRE ".txt$" "" -}}
        <td><a href="{{ .Name }}">{{ $displayName }}</a></td>
      {{ end -}}
    {{ if eq 5 (mod $counter 6) -}}
    </tr>
    {{ end -}}
    {{ $counter = add $counter 1 -}}
  {{ end -}}
</table>
