Merge pull request #1 from iquizoo/dev

Refine list template and add one shortcode
This commit is contained in:
Zhang Liang 2018-04-10 11:54:11 +08:00 committed by GitHub
commit 3aab3a4834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View File

@ -10,7 +10,7 @@
<tr>
<th>ID</th>
<th>名称</th>
<th>序列或题库</th>
<th>序列</th>
<th>创建日期</th>
</tr>
{{ range (where .Data.Pages "Section" "!=" "") }}
@ -19,11 +19,11 @@
<td><a href="{{ .URL }}">{{ .Title }}</a></td>
<td>
{{ if fileExists (printf "static/seq/%s.json" .File) }}
<a href="{{ printf "/seq/%s.json" .File }}">{{ printf "%s.json" .File }}</a>
<a href="{{ printf "/seq/%s.json" .File }}" target="_blank">{{ printf "%s.json" .File }}</a>
{{ else if fileExists (printf "static/seq/%s.csv" .File) }}
<a href="{{ printf "/seq/%s.csv" .File }}">{{ printf "%s.csv" .File }}</a>
<a href="{{ printf "/seq/%s.csv" .File }}" target="_blank">{{ printf "%s.csv" .File }}</a>
{{ else if fileExists (printf "static/seq/%s" .File) }}
<a href="{{ printf "/seq/%s/" .File }}">{{ printf "%s" .File }}</a>
<a href="{{ printf "/seq/%s/sequence.json" .File }}" target="_blank">{{ printf "%s.json" .File }}</a>
{{ else }}
暂无
{{ end }}

View File

@ -0,0 +1,13 @@
{{- $pathURL := .Get "pathURL" -}}
{{- $path := .Get "path" -}}
{{- $files := readDir $path -}}
<table>
<th>文件大小(字节)</th>
<th>文件名称</th>
{{- range $files }}
<tr>
<td>{{ .Size }}</td>
<td><a href="{{ $pathURL }}{{ .Name | relURL }}" target="_blank"> {{ .Name }}</a></td>
</tr>
{{- end }}
</table>