Simple site layout design
This commit is contained in:
parent
63861e1721
commit
94950041f6
125
assets/bib2yaml.py
Normal file
125
assets/bib2yaml.py
Normal file
@ -0,0 +1,125 @@
|
||||
import sys
|
||||
import re
|
||||
def remove_comments(text):
|
||||
return re.sub(r'(?m)^[ \t]*%.*\n?', '', text)
|
||||
|
||||
def find_entries(bibtex_content):
|
||||
entry_regex = re.compile(r'@(\w+)\s*[{(]', re.IGNORECASE)
|
||||
positions = [m.start() for m in entry_regex.finditer(bibtex_content)]
|
||||
entries = []
|
||||
for i, start in enumerate(positions):
|
||||
end = positions[i+1] if i+1 < len(positions) else len(bibtex_content)
|
||||
entries.append(bibtex_content[start:end].strip())
|
||||
return entries
|
||||
|
||||
def parse_bibtex_entry(entry):
|
||||
entry = entry.strip()
|
||||
if not entry or entry.startswith('%'):
|
||||
return None
|
||||
m = re.match(r'@(\w+)\s*[{(]\s*([^,]+),?', entry, re.DOTALL)
|
||||
if not m:
|
||||
return None
|
||||
entry_type, entry_key = m.groups()
|
||||
entry_type = entry_type.lower()
|
||||
if entry_type in ('comment', 'preamble'):
|
||||
return None
|
||||
if entry_type == 'string':
|
||||
return None
|
||||
body = entry[m.end():]
|
||||
body = body.rstrip('})').strip()
|
||||
fields = {}
|
||||
field_regex = re.compile(r'(\w+)\s*=\s*', re.DOTALL)
|
||||
pos = 0
|
||||
while pos < len(body):
|
||||
m = field_regex.match(body, pos)
|
||||
if not m:
|
||||
break
|
||||
field = m.group(1)
|
||||
pos = m.end()
|
||||
if body[pos] == '{':
|
||||
brace_level = 1
|
||||
val_start = pos + 1
|
||||
pos += 1
|
||||
while pos < len(body) and brace_level > 0:
|
||||
if body[pos] == '{':
|
||||
brace_level += 1
|
||||
elif body[pos] == '}':
|
||||
brace_level -= 1
|
||||
pos += 1
|
||||
value = body[val_start:pos-1]
|
||||
elif body[pos] == '"':
|
||||
val_start = pos + 1
|
||||
pos += 1
|
||||
while pos < len(body) and body[pos] != '"':
|
||||
if body[pos] == '\\':
|
||||
pos += 2
|
||||
else:
|
||||
pos += 1
|
||||
value = body[val_start:pos]
|
||||
pos += 1
|
||||
else:
|
||||
val_start = pos
|
||||
while pos < len(body) and body[pos] not in ',\n':
|
||||
pos += 1
|
||||
value = body[val_start:pos].strip()
|
||||
fields[field] = value.replace('\n', ' ').strip()
|
||||
while pos < len(body) and body[pos] in ', \n\r\t':
|
||||
pos += 1
|
||||
return entry_type, entry_key, fields
|
||||
|
||||
def escape_yaml_string(s):
|
||||
# Escape double quotes and backslashes, wrap in double quotes if needed
|
||||
if not s:
|
||||
return '""'
|
||||
if any(c in s for c in ':\'"{}[],&*#?|-<>=!%@`\\\n'):
|
||||
s = s.replace('\\', '\\\\').replace('"', '\\"')
|
||||
return f'"{s}"'
|
||||
return s
|
||||
|
||||
def dict_to_yaml(d, indent=0):
|
||||
lines = []
|
||||
for k, v in d.items():
|
||||
if isinstance(v, list):
|
||||
lines.append(' ' * indent + f"{k}:")
|
||||
for item in v:
|
||||
lines.append(' ' * (indent + 2) + f"- {escape_yaml_string(item)}")
|
||||
else:
|
||||
lines.append(' ' * indent + f"{k}: {escape_yaml_string(v)}")
|
||||
return '\n'.join(lines)
|
||||
|
||||
def bibtex_to_yaml(bibtex_content):
|
||||
bibtex_content = remove_comments(bibtex_content)
|
||||
entries = find_entries(bibtex_content)
|
||||
yaml_entries = []
|
||||
for entry in entries:
|
||||
parsed = parse_bibtex_entry(entry)
|
||||
if not parsed:
|
||||
continue
|
||||
entry_type, entry_key, fields = parsed
|
||||
entry_dict = {'key': entry_key}
|
||||
if "author" in fields:
|
||||
authors = [a.strip() for a in re.split(r'\s+and\s+', fields["author"])]
|
||||
entry_dict['author'] = authors
|
||||
del fields["author"]
|
||||
entry_dict.update(fields)
|
||||
yaml_entries.append(entry_dict)
|
||||
yaml_str = "publications:\n"
|
||||
for entry in yaml_entries:
|
||||
yaml_str += " - " + dict_to_yaml(entry, indent=4).lstrip().replace('\n', '\n ') + "\n"
|
||||
return yaml_str
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print(f"Usage: {sys.argv[0]} <input.bib>")
|
||||
sys.exit(1)
|
||||
bibfile = sys.argv[1]
|
||||
with open(bibfile, 'r', encoding='utf-8') as f:
|
||||
bibtex_content = f.read()
|
||||
yaml_content = bibtex_to_yaml(bibtex_content)
|
||||
yamlfile = bibfile.rsplit('.', 1)[0] + '.yaml'
|
||||
with open(yamlfile, 'w', encoding='utf-8') as f:
|
||||
f.write(yaml_content)
|
||||
print(f"YAML exported to {yamlfile}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,22 +0,0 @@
|
||||
body {
|
||||
color: #222;
|
||||
font-family: sans-serif;
|
||||
line-height: 1.5;
|
||||
margin: 1rem;
|
||||
max-width: 768px;
|
||||
}
|
||||
|
||||
header {
|
||||
border-bottom: 1px solid #222;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: 1px solid #222;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00e;
|
||||
text-decoration: none;
|
||||
}
|
81
assets/sass/_fonts.sass
Normal file
81
assets/sass/_fonts.sass
Normal file
@ -0,0 +1,81 @@
|
||||
$font-path: '/fonts/static/'
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 100
|
||||
src: local('Source Sans 3 ExtraLight'), local('SourceSans3-ExtraLight'), url('#{$font-path}SourceSans3-ExtraLight.woff2') format('woff2'), url('#{$font-path}SourceSans3-ExtraLight.ttf') format('truetype')
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 200
|
||||
src: local('Source Sans 3 ExtraLight'), local('SourceSans3-ExtraLight'), url('#{$font-path}SourceSans3-ExtraLight.woff2') format('woff2'), url('#{$font-path}SourceSans3-ExtraLight.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 300
|
||||
src: local('Source Sans 3 Light'), local('SourceSans3-Light'), url('#{$font-path}SourceSans3-Light.woff2') format('woff2'), url('#{$font-path}SourceSans3-Light.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 400
|
||||
src: local('Source Sans 3 Regular'), local('SourceSans3-Regular'), url('#{$font-path}SourceSans3-Regular.woff2') format('woff2'), url('#{$font-path}SourceSans3-Regular.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: italic
|
||||
font-display: swap
|
||||
font-weight: 400
|
||||
src: local('Source Sans 3 Italic'), local('SourceSans3-Italic'), url('#{$font-path}SourceSans3-Italic.woff2') format('woff2'), url('#{$font-path}SourceSans3-Italic.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 500
|
||||
src: local('Source Sans 3 Medium'), local('SourceSans3-Medium'), url('#{$font-path}SourceSans3-Medium.woff2') format('woff2'), url('#{$font-path}SourceSans3-Medium.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 600
|
||||
src: local('Source Sans 3 SemiBold'), local('SourceSans3-SemiBold'), url('#{$font-path}SourceSans3-SemiBold.woff2') format('woff2'), url('#{$font-path}SourceSans3-SemiBold.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 700
|
||||
src: local('Source Sans 3 Bold'), local('SourceSans3-Bold'), url('#{$font-path}SourceSans3-Bold.woff2') format('woff2'), url('#{$font-path}SourceSans3-Bold.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: italic
|
||||
font-display: swap
|
||||
font-weight: 700
|
||||
src: local('Source Sans 3 Bold Italic'), local('SourceSans3-BoldItalic'), url('#{$font-path}SourceSans3-BoldItalic.woff2') format('woff2'), url('#{$font-path}SourceSans3-BoldItalic.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 800
|
||||
src: local('Source Sans 3 ExtraBold'), local('SourceSans3-ExtraBold'), url('#{$font-path}SourceSans3-ExtraBold.woff2') format('woff2'), url('#{$font-path}SourceSans3-ExtraBold.ttf') format('truetype')
|
||||
|
||||
@font-face
|
||||
font-family: 'Source Sans 3'
|
||||
font-style: normal
|
||||
font-display: swap
|
||||
font-weight: 900
|
||||
src: local('Source Sans 3 Black'), local('SourceSans3-Black'), url('#{$font-path}SourceSans3-Black.woff2') format('woff2'), url('#{$font-path}SourceSans3-Black.ttf') format('truetype')
|
||||
|
||||
|
||||
*
|
||||
font-family: 'Source Sans 3', sans-serif
|
4
assets/sass/main.sass
Normal file
4
assets/sass/main.sass
Normal file
@ -0,0 +1,4 @@
|
||||
@import "fonts"
|
||||
*
|
||||
color: white
|
||||
background: black
|
@ -1,9 +0,0 @@
|
||||
+++
|
||||
title = 'Home'
|
||||
date = 2023-01-01T08:00:00-07:00
|
||||
draft = false
|
||||
+++
|
||||
|
||||
Laborum voluptate pariatur ex culpa magna nostrud est incididunt fugiat
|
||||
pariatur do dolor ipsum enim. Consequat tempor do dolor eu. Non id id anim anim
|
||||
excepteur excepteur pariatur nostrud qui irure ullamco.
|
@ -1,7 +0,0 @@
|
||||
+++
|
||||
title = 'Posts'
|
||||
date = 2023-01-01T08:30:00-07:00
|
||||
draft = false
|
||||
+++
|
||||
|
||||
Tempor est exercitation ad qui pariatur quis adipisicing aliquip nisi ea consequat ipsum occaecat. Nostrud consequat ullamco laboris fugiat esse esse adipisicing velit laborum ipsum incididunt ut enim. Dolor pariatur nulla quis fugiat dolore excepteur. Aliquip ad quis aliqua enim do consequat.
|
@ -1,10 +0,0 @@
|
||||
+++
|
||||
title = 'Post 1'
|
||||
date = 2023-01-15T09:00:00-07:00
|
||||
draft = false
|
||||
tags = ['red']
|
||||
+++
|
||||
|
||||
Tempor proident minim aliquip reprehenderit dolor et ad anim Lorem duis sint eiusmod. Labore ut ea duis dolor. Incididunt consectetur proident qui occaecat incididunt do nisi Lorem. Tempor do laborum elit laboris excepteur eiusmod do. Eiusmod nisi excepteur ut amet pariatur adipisicing Lorem.
|
||||
|
||||
Occaecat nulla excepteur dolore excepteur duis eiusmod ullamco officia anim in voluptate ea occaecat officia. Cillum sint esse velit ea officia minim fugiat. Elit ea esse id aliquip pariatur cupidatat id duis minim incididunt ea ea. Anim ut duis sunt nisi. Culpa cillum sit voluptate voluptate eiusmod dolor. Enim nisi Lorem ipsum irure est excepteur voluptate eu in enim nisi. Nostrud ipsum Lorem anim sint labore consequat do.
|
@ -1,10 +0,0 @@
|
||||
+++
|
||||
title = 'Post 2'
|
||||
date = 2023-02-15T10:00:00-07:00
|
||||
draft = false
|
||||
tags = ['red','green']
|
||||
+++
|
||||
|
||||
Anim eiusmod irure incididunt sint cupidatat. Incididunt irure irure irure nisi ipsum do ut quis fugiat consectetur proident cupidatat incididunt cillum. Dolore voluptate occaecat qui mollit laborum ullamco et. Ipsum laboris officia anim laboris culpa eiusmod ex magna ex cupidatat anim ipsum aute. Mollit aliquip occaecat qui sunt velit ut cupidatat reprehenderit enim sunt laborum. Velit veniam in officia nulla adipisicing ut duis officia.
|
||||
|
||||
Exercitation voluptate irure in irure tempor mollit Lorem nostrud ad officia. Velit id fugiat occaecat do tempor. Sit officia Lorem aliquip eu deserunt consectetur. Aute proident deserunt in nulla aliquip dolore ipsum Lorem ut cupidatat consectetur sit sint laborum. Esse cupidatat sit sint sunt tempor exercitation deserunt. Labore dolor duis laborum est do nisi ut veniam dolor et nostrud nostrud.
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
@ -1,12 +0,0 @@
|
||||
+++
|
||||
title = 'Post 3'
|
||||
date = 2023-03-15T11:00:00-07:00
|
||||
draft = false
|
||||
tags = ['red','green','blue']
|
||||
+++
|
||||
|
||||
Occaecat aliqua consequat laborum ut ex aute aliqua culpa quis irure esse magna dolore quis. Proident fugiat labore eu laboris officia Lorem enim. Ipsum occaecat cillum ut tempor id sint aliqua incididunt nisi incididunt reprehenderit. Voluptate ad minim sint est aute aliquip esse occaecat tempor officia qui sunt. Aute ex ipsum id ut in est velit est laborum incididunt. Aliqua qui id do esse sunt eiusmod id deserunt eu nostrud aute sit ipsum. Deserunt esse cillum Lorem non magna adipisicing mollit amet consequat.
|
||||
|
||||

|
||||
|
||||
Sit excepteur do velit veniam mollit in nostrud laboris incididunt ea. Amet eu cillum ut reprehenderit culpa aliquip labore laborum amet sit sit duis. Laborum id proident nostrud dolore laborum reprehenderit quis mollit nulla amet veniam officia id id. Aliquip in deserunt qui magna duis qui pariatur officia sunt deserunt.
|
21
hugo.toml
21
hugo.toml
@ -1,24 +1,5 @@
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-US'
|
||||
title = 'My New Hugo Site'
|
||||
|
||||
[menus]
|
||||
[[menus.main]]
|
||||
name = 'Home'
|
||||
pageRef = '/'
|
||||
weight = 10
|
||||
|
||||
[[menus.main]]
|
||||
name = 'Posts'
|
||||
pageRef = '/posts'
|
||||
weight = 20
|
||||
|
||||
[[menus.main]]
|
||||
name = 'Tags'
|
||||
pageRef = '/tags'
|
||||
weight = 30
|
||||
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
extended = false
|
||||
min = '0.146.0'
|
||||
|
||||
|
5
layouts/_partials/favicon.html
Normal file
5
layouts/_partials/favicon.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{- $faviconsDir := absURL site.Params.faviconsDir }}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href='{{ printf "%sapple-touch-icon.png" $faviconsDir }}'>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href='{{ printf "%sfavicon-32x32.png" $faviconsDir }}'>
|
||||
<link rel="icon" type="image/png" sizes='16x16' href='{{ printf "%sfavicon-16x16.png" $faviconsDir }}'>
|
||||
<link rel="manifest" href='{{ printf "%ssite.webmanifest" $faviconsDir }}'>
|
@ -1,5 +1,12 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<!-- <meta name="viewport" content="width=device-width"> -->
|
||||
<meta name="viewport" content ="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
{{ partialCached "head/css.html" . }}
|
||||
{{ partialCached "head/js.html" . }}
|
||||
{{- partial "opengraph" . }}
|
||||
{{- partialCached "favicon" . }}
|
||||
{{- partialCached "styles" . }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
{{- with resources.Get "css/main.css" }}
|
||||
{{- if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{- else }}
|
||||
{{- with . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -1,16 +0,0 @@
|
||||
{{- with resources.Get "js/main.js" }}
|
||||
{{- $opts := dict
|
||||
"minify" (not hugo.IsDevelopment)
|
||||
"sourceMap" (cond hugo.IsDevelopment "external" "")
|
||||
"targetPath" "js/main.js"
|
||||
}}
|
||||
{{- with . | js.Build $opts }}
|
||||
{{- if hugo.IsDevelopment }}
|
||||
<script src="{{ .RelPermalink }}"></script>
|
||||
{{- else }}
|
||||
{{- with . | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
0
layouts/_partials/head/sass.html
Normal file
0
layouts/_partials/head/sass.html
Normal file
@ -1,2 +1,2 @@
|
||||
<h1>{{ site.Title }}</h1>
|
||||
<h1><a href="{{ "/" | relURL }}">{{ site.Title }}</a></h1>
|
||||
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
|
||||
|
70
layouts/_partials/opengraph.html
Normal file
70
layouts/_partials/opengraph.html
Normal file
@ -0,0 +1,70 @@
|
||||
{{- $config := site.Params }}
|
||||
{{- $permalink := .Permalink }}
|
||||
{{ $st := site.Title }}
|
||||
{{- $summary := "" }}
|
||||
{{- with .Summary }}
|
||||
{{- $summary = . }}
|
||||
{{- else }}
|
||||
{{- $summary = $config.description }}
|
||||
{{- end }}
|
||||
{{- $summary = truncate 160 "" $summary }}
|
||||
{{- $logo := absURL (printf "images/%s" $config.logo) }}
|
||||
{{- if in $config.logo "https://" }}
|
||||
{{- $logo = $config.logo }}
|
||||
{{- end }}
|
||||
{{ $image := "" }}
|
||||
{{- with .Params.image }}
|
||||
{{ if in . "https://" }}
|
||||
{{- $image = . }}
|
||||
{{ else }}
|
||||
{{- $image = absURL (printf "images/%s" .) }}
|
||||
{{ end }}
|
||||
{{- else }}
|
||||
{{- $image = $logo }}
|
||||
{{- end }}
|
||||
<meta name="keywords" content="{{ $st }}">
|
||||
<meta property="og:locale" content='{{ default "en_US" $config.locale }}'>
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:title" content="{{ .Title }}">
|
||||
<meta property="og:description" content="{{ $summary }}">
|
||||
<meta property="og:url" content="{{ $permalink }}">
|
||||
<meta property="og:image" content="{{ $image }}">
|
||||
{{- if eq .Section $config.blogDir -}}
|
||||
{{- $date := .Date.Format "2006-02-01" -}}
|
||||
<meta property="article:published_time" content="{{ htmlUnescape $date }}" />
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"mainEntityOfPage":"{{ $permalink }}",
|
||||
"name": "{{ $st }}",
|
||||
"headline": "{{ .Title }}",
|
||||
"description": "{{ $summary }}",
|
||||
"url": "{{ $permalink }}",
|
||||
"datePublished": "{{ $date }}",
|
||||
"dateModified": "{{ $date }}",
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ .Params.author }}"
|
||||
},
|
||||
"image":{
|
||||
"@type":"ImageObject",
|
||||
"url": "{{ $image }}"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"logo": {
|
||||
"@type":"ImageObject",
|
||||
"url": "{{ $logo }}"
|
||||
},
|
||||
"name": "{{ $st }}"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:creator" content="{{ $config.twitter }}">
|
||||
<meta name="twitter:title" content="{{ .Title }}">
|
||||
<meta name="twitter:description" content="{{ $summary }}">
|
||||
<meta name="twitter:image" content="{{ $image }}">
|
||||
{{- end }}
|
||||
<link rel="canonical" href="{{ $permalink }}">
|
4
layouts/_partials/styles.html
Normal file
4
layouts/_partials/styles.html
Normal file
@ -0,0 +1,4 @@
|
||||
{{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "expanded" "enableSourceMap" "true") -}}
|
||||
{{ $mainSassFile := "sass/main.sass" }}
|
||||
{{- $styles := resources.Get $mainSassFile | resources.ExecuteAsTemplate $mainSassFile . | css.Sass $options | resources.Fingerprint "sha512" }}
|
||||
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
|
14
layouts/_partials/term-link.html
Normal file
14
layouts/_partials/term-link.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{ $name := .name }}
|
||||
{{ $taxonomy := .taxonomy }}
|
||||
|
||||
{{ $hash := md5 $name }}
|
||||
{{ $r := printf "0x%s" (substr $hash 0 2) | int }}
|
||||
{{ $g := printf "0x%s" (substr $hash 2 2) | int }}
|
||||
{{ $b := printf "0x%s" (substr $hash 4 2) | int }}
|
||||
{{ $rgba := printf "rgba(%d,%d,%d,0.2)" $r $g $b }}
|
||||
<a
|
||||
id="{{ $taxonomy | urlize }}_{{ $name | urlize }}"
|
||||
style="background:rgba({{ $r }},{{ $g }},{{ $b }},0.4)"
|
||||
href="{{ "/" | relLangURL}}{{ $taxonomy | urlize }}{{ "/" | relLangURL}}{{ $name | urlize }}">
|
||||
{{ $name }}
|
||||
</a>
|
@ -1,23 +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" .) }}
|
||||
*/}}
|
||||
{{- .Site }}
|
||||
<section>
|
||||
<ul id="all-taxonomies">
|
||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||
{{ $taxonomyname }}
|
||||
<li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
|
||||
<ul>
|
||||
{{ range $key, $value := $taxonomy }}
|
||||
<li> {{ $key }} </li>
|
||||
<ul>
|
||||
{{ range $value.Pages }}
|
||||
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{- $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 }}
|
||||
|
@ -6,5 +6,21 @@
|
||||
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
|
||||
|
||||
{{ .Content }}
|
||||
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
|
||||
|
||||
<section>
|
||||
<ul id="taxonomies">
|
||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||
<li>{{ $taxonomyname | strings.FirstUpper }}
|
||||
<!-- <li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a> -->
|
||||
<ul>
|
||||
{{ range $key, $value := $taxonomy }}
|
||||
<li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}{{ "/" | relLangURL}}{{ $key | urlize }}">{{ $key }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
||||
{{ end }}
|
||||
|
86
layouts/tools/page.html
Normal file
86
layouts/tools/page.html
Normal file
@ -0,0 +1,86 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
|
||||
{{ $dateHuman := .Date | time.Format ":date_long" }}
|
||||
Updated <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
|
||||
|
||||
{{ with .Params.links }}
|
||||
<section>
|
||||
<h2>Links</h2>
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li><a href="{{ .url }}" target="_blank" rel="noopener">{{ .title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.website }}
|
||||
<p>
|
||||
Website: <a href="{{ . }}" target="_blank" rel="noopener">{{ . }}</a>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.github }}
|
||||
<p>
|
||||
<a href="{{ . }}" target="_blank" rel="noopener">View on GitHub</a>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
<section>
|
||||
<h2>At a Glance</h2>
|
||||
<table id="taxonomies">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Taxonomy</th>
|
||||
<th>Terms</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||
{{ with $taxonomy }}
|
||||
<tr>
|
||||
<th>{{ $taxonomyname | strings.FirstUpper }}</th>
|
||||
<td>
|
||||
{{ range $key, $value := $taxonomy }}
|
||||
{{ partial "term-link.html" (dict "name" $key "taxonomy" $taxonomyname) }}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Description</h2>
|
||||
{{ .Content }}
|
||||
</section>
|
||||
|
||||
{{ with .Params.publications}}
|
||||
<section>
|
||||
<h2>Publications</h2>
|
||||
<ul>
|
||||
{{ range $citation, $pub := site.Data.publications }}
|
||||
{{ range $pub }}
|
||||
{{ if in $.Params.publications .key }}
|
||||
<li>
|
||||
{{ if .year }} <strong>{{ .year }}</strong>: {{ end }}
|
||||
{{ if .title }} <em>{{ .title }}</em> {{ end }}
|
||||
{{ if .author }} <br /> by {{ delimit .author " | " | html }} {{ end }}
|
||||
{{ if .booktitle }} <br />Appears in <em>{{ .booktitle }}</em> {{ end }}
|
||||
{{ if .journal }} <br />Appears in <em>{{ .journal }}</em> {{ end }}
|
||||
{{ if .volume }} <strong>{{ .volume }}</strong> {{ end }}
|
||||
{{ if .pages }} ({{ .pages }}) {{ end }}
|
||||
{{ if .doi }} <br /><a href="https://doi.org/{{ . }}" target="_blank" rel="noopener">DOI: {{ .doi }}</a> {{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
93
static/fonts/OFL.txt
Normal file
93
static/fonts/OFL.txt
Normal file
@ -0,0 +1,93 @@
|
||||
Copyright 2010-2020 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
79
static/fonts/README.txt
Normal file
79
static/fonts/README.txt
Normal file
@ -0,0 +1,79 @@
|
||||
Source Sans 3 Variable Font
|
||||
===========================
|
||||
|
||||
This download contains Source Sans 3 as both variable fonts and static fonts.
|
||||
|
||||
Source Sans 3 is a variable font with this axis:
|
||||
wght
|
||||
|
||||
This means all the styles are contained in these files:
|
||||
SourceSans3-VariableFont_wght.ttf
|
||||
SourceSans3-Italic-VariableFont_wght.ttf
|
||||
|
||||
If your app fully supports variable fonts, you can now pick intermediate styles
|
||||
that aren’t available as static fonts. Not all apps support variable fonts, and
|
||||
in those cases you can use the static font files for Source Sans 3:
|
||||
static/SourceSans3-ExtraLight.ttf
|
||||
static/SourceSans3-Light.ttf
|
||||
static/SourceSans3-Regular.ttf
|
||||
static/SourceSans3-Medium.ttf
|
||||
static/SourceSans3-SemiBold.ttf
|
||||
static/SourceSans3-Bold.ttf
|
||||
static/SourceSans3-ExtraBold.ttf
|
||||
static/SourceSans3-Black.ttf
|
||||
static/SourceSans3-ExtraLightItalic.ttf
|
||||
static/SourceSans3-LightItalic.ttf
|
||||
static/SourceSans3-Italic.ttf
|
||||
static/SourceSans3-MediumItalic.ttf
|
||||
static/SourceSans3-SemiBoldItalic.ttf
|
||||
static/SourceSans3-BoldItalic.ttf
|
||||
static/SourceSans3-ExtraBoldItalic.ttf
|
||||
static/SourceSans3-BlackItalic.ttf
|
||||
|
||||
Get started
|
||||
-----------
|
||||
|
||||
1. Install the font files you want to use
|
||||
|
||||
2. Use your app's font picker to view the font family and all the
|
||||
available styles
|
||||
|
||||
Learn more about variable fonts
|
||||
-------------------------------
|
||||
|
||||
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
|
||||
https://variablefonts.typenetwork.com
|
||||
https://medium.com/variable-fonts
|
||||
|
||||
In desktop apps
|
||||
|
||||
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
|
||||
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
|
||||
|
||||
Online
|
||||
|
||||
https://developers.google.com/fonts/docs/getting_started
|
||||
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
|
||||
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
|
||||
|
||||
Installing fonts
|
||||
|
||||
MacOS: https://support.apple.com/en-us/HT201749
|
||||
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
|
||||
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
|
||||
|
||||
Android Apps
|
||||
|
||||
https://developers.google.com/fonts/docs/android
|
||||
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
|
||||
|
||||
License
|
||||
-------
|
||||
Please read the full license text (OFL.txt) to understand the permissions,
|
||||
restrictions and requirements for usage, redistribution, and modification.
|
||||
|
||||
You can use them in your products & projects – print or digital,
|
||||
commercial or otherwise.
|
||||
|
||||
This isn't legal advice, please consider consulting a lawyer and see the full
|
||||
license for all details.
|
BIN
static/fonts/SourceSans3-Italic-VariableFont_wght.ttf
Normal file
BIN
static/fonts/SourceSans3-Italic-VariableFont_wght.ttf
Normal file
Binary file not shown.
BIN
static/fonts/SourceSans3-Italic-VariableFont_wght.woff2
Normal file
BIN
static/fonts/SourceSans3-Italic-VariableFont_wght.woff2
Normal file
Binary file not shown.
BIN
static/fonts/SourceSans3-VariableFont_wght.ttf
Normal file
BIN
static/fonts/SourceSans3-VariableFont_wght.ttf
Normal file
Binary file not shown.
BIN
static/fonts/SourceSans3-VariableFont_wght.woff2
Normal file
BIN
static/fonts/SourceSans3-VariableFont_wght.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Black.ttf
Normal file
BIN
static/fonts/static/SourceSans3-Black.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Black.woff2
Normal file
BIN
static/fonts/static/SourceSans3-Black.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-BlackItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-BlackItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-BlackItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-BlackItalic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Bold.ttf
Normal file
BIN
static/fonts/static/SourceSans3-Bold.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Bold.woff2
Normal file
BIN
static/fonts/static/SourceSans3-Bold.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-BoldItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-BoldItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraBold.ttf
Normal file
BIN
static/fonts/static/SourceSans3-ExtraBold.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraBold.woff2
Normal file
BIN
static/fonts/static/SourceSans3-ExtraBold.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraBoldItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-ExtraBoldItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraBoldItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-ExtraBoldItalic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraLight.ttf
Normal file
BIN
static/fonts/static/SourceSans3-ExtraLight.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraLight.woff2
Normal file
BIN
static/fonts/static/SourceSans3-ExtraLight.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraLightItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-ExtraLightItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-ExtraLightItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-ExtraLightItalic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Italic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-Italic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Italic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-Italic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Light.ttf
Normal file
BIN
static/fonts/static/SourceSans3-Light.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Light.woff2
Normal file
BIN
static/fonts/static/SourceSans3-Light.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-LightItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-LightItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-LightItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-LightItalic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Medium.ttf
Normal file
BIN
static/fonts/static/SourceSans3-Medium.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Medium.woff2
Normal file
BIN
static/fonts/static/SourceSans3-Medium.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-MediumItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-MediumItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-MediumItalic.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Regular.ttf
Normal file
BIN
static/fonts/static/SourceSans3-Regular.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-Regular.woff2
Normal file
BIN
static/fonts/static/SourceSans3-Regular.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-SemiBold.ttf
Normal file
BIN
static/fonts/static/SourceSans3-SemiBold.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-SemiBold.woff2
Normal file
BIN
static/fonts/static/SourceSans3-SemiBold.woff2
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-SemiBoldItalic.ttf
Normal file
BIN
static/fonts/static/SourceSans3-SemiBoldItalic.ttf
Normal file
Binary file not shown.
BIN
static/fonts/static/SourceSans3-SemiBoldItalic.woff2
Normal file
BIN
static/fonts/static/SourceSans3-SemiBoldItalic.woff2
Normal file
Binary file not shown.
8
static/fonts/static/woff2.sh
Executable file
8
static/fonts/static/woff2.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# Compress all font files in the current directory using woff2_compress
|
||||
|
||||
for font in *.ttf *.otf; do
|
||||
if [[ -f "$font" ]]; then
|
||||
woff2_compress "$font"
|
||||
fi
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user