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.
108 lines
6.4 KiB
108 lines
6.4 KiB
{{ define "main" }} |
|
|
|
<h1>{{ .Title }}</h1> |
|
|
|
<div class="post"> |
|
{{ partial "headline-hash.html" .Content }} |
|
|
|
{{ with .Site.Data.users }} |
|
<script src="{{ "js/libs/jquery/3.3.1/jquery.min.js" | absURL }}" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> |
|
<link rel="stylesheet" href="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.css" integrity="sha384-Y5cgvAigcTOTaObjiReosnMvQCzeJTHVQ3ezBmzGzM1g0Armw98SOB73bclZHywS" crossorigin="anonymous"> |
|
<script src="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.js" integrity="sha384-lGO1Q1P+mA8tLRu41NDOmOxG62K3Z3ATFdolbbX3dWFkRXuJBz0Sl8qYa6b9C9wv" crossorigin="anonymous"></script> |
|
<!-- SHA256 of the below script: |
|
https://report-uri.com/home/hash/ |
|
'sha256-YiWMVJIplziLxmHOI6iqs51JQS9W2hg1wDsKBD3u09g=' |
|
|
|
NOTE that the hash has to be recalculated and updated |
|
in the CSP in the headers each time there's even any |
|
whitespace/indentation change in the below 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 := . }} |
|
{{ $org_dir := $val.org_dir | default "" | replaceRE "/$" "" }} |
|
{{ $branch := $val.branch | default "master" | replaceRE "/" "%2F" }} |
|
{{ $repo_updated_time := "" }} |
|
{{ $github_source := findRE "github\\.com" $val.source }} |
|
{{ $gitlab_source := findRE "gitlab\\.com" $val.source }} |
|
{{ $codingnet_source := findRE "coding\\.net" $val.source }} |
|
{{ if $github_source }} |
|
{{ $repo := replaceRE "^.*github\\.com/([^/]+/[^/]+).*" "${1}" $val.source }} |
|
<!-- https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository --> |
|
<!-- https://api.github.com/repos/kaushalmodi/ox-hugo/commits?path=doc&sha=master --> |
|
{{ $repo_json := getJSON (printf "https://api.github.com/repos/%s/commits?path=%s&sha=%s" $repo $org_dir $branch) }} |
|
{{ $repo_updated_time = (index (index (index (index $repo_json 0) "commit") "committer") "date") }} |
|
{{ else if $gitlab_source }} |
|
{{ $repo := replaceRE "^.*gitlab\\.com/([^/]+/[^/]+).*" "${1}" $val.source | replaceRE "/" "%2F" }} |
|
{{ $org_dir = $org_dir | replaceRE "/" "%2F" }} |
|
<!-- https://docs.gitlab.com/ee/api/commits.html#list-repository-commits --> |
|
<!-- https://gitlab.com/api/v4/projects/kaushalmodi%2Fkaushalmodi.gitlab.io/repository/commits?path=content-org&ref_name=master --> |
|
{{ $repo_json := getJSON (printf "https://gitlab.com/api/v4/projects/%s/repository/commits?path=%s&?ref_name=%s" $repo ($org_dir | replaceRE "/" "%2F") $branch) }} |
|
{{/* partial "debugprint.html" $repo_json */}} |
|
{{ $repo_updated_time = (index (index $repo_json 0) "committed_date") }} |
|
{{ end }} |
|
{{ $org_dir_link := "" }} |
|
{{ if (findRE "\\.org$" $val.source) }} <!-- If the "source" is direct link to an Org file --> |
|
{{ $org_dir_link = $val.source }} |
|
{{ else if (or $github_source $gitlab_source $codingnet_source) }} |
|
{{ $org_dir_link = (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)) }} |
|
{{ $org_dir_link = (printf "%s;a=tree%s;hb=refs/heads/%s" ($val.source | replaceRE "/$" "") $folder_switch $branch) }} |
|
{{ end }} |
|
<tr> |
|
<td>{{ $val.author }}</td> |
|
<!-- Don't make htmltest error out becaue of user-submitted non-secure http domains. |
|
https://github.com/wjdp/htmltest/ |
|
--> |
|
{{ $data_proofer_ignore_tag := "" }} |
|
{{ $secure_icon := "" }} |
|
{{ $user_site_is_nonsecure := findRE "^http://" $val.site }} |
|
{{ if $user_site_is_nonsecure }} |
|
{{ $data_proofer_ignore_tag = ` data-proofer-ignore="true"` }} |
|
{{ else }} |
|
{{ $secure_icon = "🔐 " }} |
|
{{ end }} |
|
<td>{{ printf `%s<a href="%s"%s>%s</a>` $secure_icon $val.site $data_proofer_ignore_tag ($val.site | replaceRE "^https?://" "" | replaceRE "/$" "") | safeHTML }}</td> |
|
<td>{{ printf `<a href="%s">%s</a>` $org_dir_link ($org_dir | default (or $val.org_src_desc "<em>repo root</em>") | replaceRE "[^<]*/" "") | safeHTML }}</td> |
|
<td> |
|
{{ with $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 }}
|
|
|