You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.5 KiB
52 lines
2.5 KiB
{{ define "main" }} |
|
|
|
<h1>{{ .Title }}</h1> |
|
|
|
<div class="post"> |
|
{{ partial "headline-hash.html" .Content }} |
|
|
|
{{ with .Site.Data.users }} |
|
<table class="examples"> |
|
<tr><th>Author</th><th>Site</th><th>Org Source</th><th>Last Updated*</th></tr> |
|
{{ range $key, $val := . }} |
|
{{ $branch := $val.branch | default "master" }} |
|
{{ $.Scratch.Set "__repo_updated_time" "" }} |
|
{{ if (findRE "github\\.com" $val.source) }} |
|
{{ $repo := replaceRE "^.*github\\.com/([^/]+/[^/]+).*" "${1}" $val.source }} |
|
{{ $repo_json := getJSON (printf "https://api.github.com/repos/%s/branches/%s" $repo $branch) }} |
|
{{ $.Scratch.Set "__repo_updated_time" (index (index (index (index $repo_json "commit") "commit") "committer") "date") }} |
|
{{ else if (findRE "gitlab\\.com" $val.source) }} |
|
{{ $repo := replaceRE "^.*gitlab\\.com/([^/]+/[^/]+).*" "${1}" $val.source }} |
|
{{ $repo_json := getJSON (printf "https://gitlab.com/api/v4/projects/%s/repository/branches/%s" ($repo | replaceRE "/" "%2F") $branch) }} |
|
{{ $.Scratch.Set "__repo_updated_time" (index (index $repo_json "commit") "committed_date") }} |
|
{{/* partial "debugprint.html" $repo_json */}} |
|
{{ end }} |
|
{{ $org_dir := $val.org_dir | default "" | replaceRE "/$" "" }} |
|
{{ $org_src := (printf "%s/tree/%s/%s" ($val.source | replaceRE "/$" "") $branch $org_dir) }} |
|
<tr> |
|
<td>{{ $val.author }}</td> |
|
<td>{{ printf "<a href=\"%s\">%s</a>" $val.site ($val.site | replaceRE "^https?://" "" | replaceRE "/$" "") | safeHTML }}</td> |
|
<td>{{ printf "<a href=\"%s\">%s</a>" $org_src ($org_dir | default "<em>repo root</em>" | replaceRE "[^<]*/" "") | safeHTML }}</td> |
|
<td> |
|
{{ with $.Scratch.Get "__repo_updated_time" }} |
|
{{ . | dateFormat "Jan 2, 2006" }} |
|
{{ end }} |
|
</td> |
|
</tr> |
|
{{ end }} |
|
</table> |
|
{{ end }} |
|
|
|
{{ with .Params.after_content }} |
|
<p> |
|
{{ . | markdownify }} |
|
</p> |
|
{{ end }} |
|
|
|
<hr /> |
|
<small> |
|
<sup>*</sup> The "Last Updated" dates were retrieved when this page was last updated.. on {{ now | dateFormat "Jan 2, 2006" }}. |
|
</small> |
|
</div> |
|
|
|
{{ end }}
|
|
|