Fix some mishandling of path separators, leading to problems on Windows. (#2920)

This commit is contained in:
Martin Taillefer 2018-11-26 15:38:17 -08:00 committed by GitHub
parent 113f20692e
commit 06d546c52c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 11 deletions

View File

@ -1,10 +1,4 @@
{{ $dir_name := index (last 2 (split .Page.Dir "/" )) 0 }}
{{/* Compensate for a Hugo bug on Windows where it appends a \ on the output of .Page.Dir */}}
{{ if (strings.HasSuffix $dir_name "\\") }}
{{ $dir_name = slicestr $dir_name 0 (sub (len $dir_name) 1) }}
{{ end }}
{{ $dir_name := path.Base .Page.Dir }}
{{ $parts := split $dir_name "." }}
{{ $short_version := $dir_name }}

View File

@ -14,13 +14,11 @@
<td><a title="{{ .Description }}" href="{{ .Permalink }}">{{- .Title -}}</a></td>
<td>
{{ $current_template := split .Dir "/" | last 2 }}
{{ $current_template := index $current_template 0 }}
{{ $current_template := path.Base .Dir }}
{{ $adapters := "" }}
{{ range $a := $adapterPages }}
{{ $adapter_name := split $a.Dir "/" | last 2 }}
{{ $adapter_name := index $adapter_name 0 }}
{{ $adapter_name := path.Base $a.Dir }}
{{ $templates := split .Params.supported_templates "," }}
{{ $templates := sort $templates }}