Add Ken Grime's ox-hugo generated site

See https://www.kengrimes.com/ox-hugo-tutorial/ for his excellent and
detailed writeup on ox-hugo.
master
Kaushal Modi 8 years ago
parent 22622b3b3c
commit 1661884157
  1. 6
      doc/data/users.toml
  2. 16
      doc/layouts/_default/examples.html

@ -167,6 +167,12 @@
org_dir = "content-org"
site = "https://numbersandshapes.net/blog/"
[kengrimes]
author = "Ken Grimes"
source = "https://www.kengrimes.com/gitweb/?p=kengrimes.com/content.git"
branch = "master"
site = "https://www.kengrimes.com/"
# []
# author = ""
# source = ""

@ -26,11 +26,13 @@
{{ range $key, $val := . }}
{{ $branch := $val.branch | default "master" }}
{{ $.Scratch.Set "__repo_updated_time" "" }}
{{ if (findRE "github\\.com" $val.source) }}
{{ $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 (findRE "gitlab\\.com" $val.source) }}
{{ 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") }}
@ -39,8 +41,16 @@
{{ $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 }}
{{ 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>

Loading…
Cancel
Save