Initial commit

This commit is contained in:
Leon Mika 2025-02-19 22:21:38 +11:00
commit 93e0de7a04
22 changed files with 310 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
public

0
.hugo_build.lock Normal file
View file

5
archetypes/default.md Normal file
View file

@ -0,0 +1,5 @@
+++
date = '{{ .Date }}'
draft = true
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
+++

91
assets/css/main.css Normal file
View file

@ -0,0 +1,91 @@
@font-face {
font-family: 'atkinson';
src: url('/fonts/AtkinsonHyperlegibleNext-Regular.otf') format('opentype');
}
:root {
--highlight-color: oklch(46.11% 0.198 298.4);
}
body {
color: #222;
font-family: atkinson, sans-serif;
line-height: 1.5;
margin-inline: auto;
padding-inline: 20px;
max-width: 600px;
width: auto;
font-size: 1.2rem;
}
h1 {
color: var(--highlight-color);
}
header {
text-align: center;
}
footer {
font-size: 0.9rem;
color: #777;
}
div.filter {
text-align: center;
margin-block-end: 20px;
}
input {
font-size: 1.2rem;
}
table {
margin-inline: auto;
border-collapse: collapse;
table-layout: fixed;
width: 400px;
}
table thead {
color: var(--highlight-color);
}
table thead th:nth-child(1) {
width: 80px;
}
table tbody td {
padding: 2px 8px;
}
table tbody td:nth-child(1) {
background-color: oklch(94.1% 0.046 305.24);
text-align: center;
}
table thead th {
border-bottom: 1px solid #222;
margin-bottom: 1rem;
}
table {
border-bottom: 1px solid #222;
}
footer {
text-align: center;
}
a {
color: #00e;
text-decoration: none;
}
.hidden {
display: none;
}
table tbody tr.exact td {
background: oklch(95% 0.07 92.39);
}

42
assets/js/main.js Normal file
View file

@ -0,0 +1,42 @@
let fitler = document.querySelector("#filter");
let lastFilterValue = "";
function applyFilter(fval) {
if (fval == "") {
document.querySelectorAll('tr[data-role="country"]').forEach((x) => {
x.classList.remove("hidden", "exact");
})
}
const fvalLower = fval.toLowerCase();
document.querySelectorAll('tr[data-role="country"]').forEach((x) => {
const matches = (x.dataset["code"].indexOf(fvalLower) != -1) ||
(x.dataset["name"].indexOf(fvalLower) != -1);
if (!matches) {
x.classList.add("hidden");
x.classList.remove("exact");
} else {
x.classList.remove("hidden");
if ((x.dataset["code"] == fvalLower) || (x.dataset["name"] == fvalLower)) {
x.classList.add("exact");
} else {
x.classList.remove("exact");
}
}
})
}
filter.addEventListener("keyup", (ev) => {
ev.preventDefault();
if (filter.value == lastFilterValue) {
return;
}
lastFilterValue = filter.value;
applyFilter(filter.value);
})

0
content/_index.md Normal file
View file

1
data/cclist.json Normal file

File diff suppressed because one or more lines are too long

3
hugo.toml Normal file
View file

@ -0,0 +1,3 @@
baseURL = 'https://example.org/'
languageCode = 'en-us'
title = '2LCC'

BIN
layouts/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
<head>
{{ partial "head.html" . }}
</head>
<body>
<header>
{{ partial "header.html" . }}
</header>
<main>
{{ block "main" . }}{{ end }}
</main>
<footer>
{{ partial "footer.html" . }}
</footer>
</body>
</html>

View file

@ -0,0 +1,29 @@
{{ define "main" }}
{{ .Content }}
<div class="filter">
<input placeholder="filter" id="filter">
</div>
<table>
<thead>
<tr>
<th>Code</th>
<th>Country</th>
</tr>
</thead>
<tbody>
{{ range .Site.Data.cclist }}
<tr data-role="country" data-code="{{lower .Code}}" data-name="{{lower .Name}}">
<td>{{ .Code }}</td>
<td>{{ .Name }}</td>
</tr>
{{ end }}
</tbody>
</table>
{{ range site.RegularPages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,8 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,10 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format ":date_long" }}
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
{{ .Content }}
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
{{ end }}

View file

@ -0,0 +1 @@
<p>Last updated {{ now.Year }}. <a href="https://web.archive.org/web/20170825133505/http://data.okfn.org/data/core/country-list">Source</a></p>

View file

@ -0,0 +1,5 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
{{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }}

View file

@ -0,0 +1,9 @@
{{- with resources.Get "css/main.css" }}
{{- if eq hugo.Environment "development" }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{- else }}
{{- with . | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,12 @@
{{- with resources.Get "js/main.js" }}
{{- if eq hugo.Environment "development" }}
{{- with . | js.Build }}
<script src="{{ .RelPermalink }}" type="module"></script>
{{- end }}
{{- else }}
{{- $opts := dict "minify" true }}
{{- with . | js.Build $opts | fingerprint }}
<script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous" type="module"></script>
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,2 @@
<h1>{{ site.Title }}</h1>
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}

View file

@ -0,0 +1,51 @@
{{- /*
Renders a menu for the given menu ID.
@context {page} page The current page.
@context {string} menuID The menu ID.
@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
*/}}
{{- $page := .page }}
{{- $menuID := .menuID }}
{{- with index site.Menus $menuID }}
<nav>
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
</nav>
{{- end }}
{{- define "partials/inline/menu/walk.html" }}
{{- $page := .page }}
{{- range .menuEntries }}
{{- $attrs := dict "href" .URL }}
{{- if $page.IsMenuCurrent .Menu . }}
{{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
{{- else if $page.HasMenuCurrent .Menu .}}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }}
{{- $name := .Name }}
{{- with .Identifier }}
{{- with T . }}
{{- $name = . }}
{{- end }}
{{- end }}
<li>
<a
{{- range $k, $v := $attrs }}
{{- with $v }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end -}}
>{{ $name }}</a>
{{- with .Children }}
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
{{- end }}
</li>
{{- end }}
{{- end }}

View file

@ -0,0 +1,23 @@
{{- /*
For a given taxonomy, renders a list of terms assigned to the page.
@context {page} page The current page.
@context {string} taxonomy The taxonomy.
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
*/}}
{{- $page := .page }}
{{- $taxonomy := .taxonomy }}
{{- with $page.GetTerms $taxonomy }}
{{- $label := (index . 0).Parent.LinkTitle }}
<div>
<div>{{ $label }}:</div>
<ul>
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
</div>
{{- end }}

Binary file not shown.

BIN
themes/.DS_Store vendored Normal file

Binary file not shown.