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.
82 lines
4.4 KiB
82 lines
4.4 KiB
{{ define "main" }} |
|
|
|
<h1>{{ .Title }}</h1> |
|
|
|
<div class="post"> |
|
{{ partial "headline-hash.html" .Content }} |
|
|
|
{{ with .Site.Data.users }} |
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"> |
|
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> |
|
<script type="text/javascript"> |
|
$(document).ready(function() { |
|
$('.ox-hugo-examples').DataTable({ |
|
"order": [[ 3, 'desc' ]], |
|
"paging": false, |
|
"info": true // Default is true, prints "Showing x of y entries" |
|
}); } ); |
|
</script> |
|
|
|
<table class="ox-hugo-examples"> |
|
<thead> |
|
<tr><th>Author</th><th>Site</th><th>Org Source</th><th>Last Updated*</th></tr> |
|
</thead> |
|
<tbody> |
|
{{ range $key, $val := . }} |
|
{{ $branch := $val.branch | default "master" }} |
|
{{ $.Scratch.Set "__repo_updated_time" "" }} |
|
{{ $github_source := findRE "github\\.com" $val.source }} |
|
{{ $gitlab_source := findRE "gitlab\\.com" $val.source }} |
|
{{ if $github_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 $gitlab_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 "/$" "" }} |
|
{{ if (findRE "\\.org$" $val.source) }} <!-- If the "source" is direct link to an Org file --> |
|
{{ $.Scratch.Set "__org_src" $val.source }} |
|
{{ else if (or $github_source $gitlab_source) }} |
|
{{ $.Scratch.Set "__org_src" (printf "%s/tree/%s/%s" ($val.source | replaceRE "/$" "") $branch $org_dir) }} |
|
{{ else }} |
|
<!-- Example: https://www.kengrimes.com/gitweb/?p=kengrimes.com/content.git;a=tree;f=content;hb=refs/heads/master |
|
$val.source = https://www.kengrimes.com/gitweb/?p=kengrimes.com/content.git |
|
$org_dir if non-nil will be used as f=$org_dir |
|
$branch = master |
|
--> |
|
{{ $folder_switch := (cond (eq "" $org_dir) "" (printf ";f=%s" $org_dir)) }} |
|
{{ $.Scratch.Set "__org_src" (printf "%s;a=tree%s;hb=refs/heads/%s" ($val.source | replaceRE "/$" "") $folder_switch $branch) }} |
|
{{ end }} |
|
<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>" ($.Scratch.Get "__org_src") ($org_dir | default (or $val.org_src_desc "<em>repo root</em>") | replaceRE "[^<]*/" "") | safeHTML }}</td> |
|
<td> |
|
{{ with $.Scratch.Get "__repo_updated_time" }} |
|
{{ . | dateFormat "2006/01/02" }} |
|
{{ end }} |
|
</td> |
|
</tr> |
|
{{ end }} |
|
</tbody> |
|
</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 }}
|
|
|