diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..75389a3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.md text eol=lf +*.html text eol=lf +*.yaml text eol=lf +*.js text eol=lf +*.scss text eol=lf +*.json text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ac8d64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/resources/_gen \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e4483e2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2021 YOUR_NAME_HERE + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..71f4bc0 --- /dev/null +++ b/go.mod @@ -0,0 +1,4 @@ +module github.com/platenio/hugo-platen + +go 1.16 + diff --git a/layouts/shortcodes/art.html b/layouts/shortcodes/art.html new file mode 100644 index 0000000..c89e25f --- /dev/null +++ b/layouts/shortcodes/art.html @@ -0,0 +1,42 @@ +{{- if .IsNamedParams -}} +{{- $.Scratch.Set "src" (.Get "src") -}} +{{- $.Scratch.Set "alt" (.Get "alt") -}} +{{- $.Scratch.Set "class" (.Get "class") -}} +{{- $.Scratch.Set "content_warning" (.Get "content_warning") -}} +{{- else -}} +{{- $.Scratch.Set "src" (.Get 0) -}} +{{- $.Scratch.Set "alt" (.Get 1) -}} +{{- $.Scratch.Set "class" (.Get 2) -}} +{{- $.Scratch.Set "content_warning" (.Get 3) -}} +{{- end -}} + +{{- $src := $.Scratch.Get "src" -}} +{{- $alt := $.Scratch.Get "alt" | default nil -}} +{{- $class := $.Scratch.Get "class" | default "full" -}} +{{- $content_warning := $.Scratch.Get "content_warning" | default false -}} +{{- $caption := .Inner | default nil -}} + +{{- if eq $alt nil -}} +{{- if $.Site.Params.warnOnMissingAltText -}} +{{- warnf (printf "Missing alt text for '%v'" $src) -}} +{{- else -}} +{{- errorf (printf "Missing alt text for '%v'" $src) -}} +{{- end -}} +{{- end -}} + +{{ if $content_warning }} +
+ {{ $alt }} + {{- if ne $caption nil -}} +
{{ $caption | markdownify }}
+ + {{- end -}} +
+{{ else }} +
+ {{ $alt }} + {{- if ne $caption nil -}} +
{{ $caption | markdownify }}
+ {{- end -}} +
+{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/detail.html b/layouts/shortcodes/detail.html new file mode 100644 index 0000000..c8dd9c8 --- /dev/null +++ b/layouts/shortcodes/detail.html @@ -0,0 +1,16 @@ +{{- if .IsNamedParams -}} +{{- $.Scratch.Set "class" (.Get "class") -}} +{{- $.Scratch.Set "title" (.Get "title") -}} +{{- else -}} +{{- $.Scratch.Set "class" (.Get 0) -}} +{{- $.Scratch.Set "title" (.Get 1) -}} +{{- end -}} + +{{- $class := $.Scratch.Get "class" -}} +{{- $title := $.Scratch.Get "title" -}} +{{- $anchor := urlize $title -}} + +
+ {{ $title }} + {{ .Inner | markdownify }} +
\ No newline at end of file diff --git a/theme.yaml b/theme.yaml new file mode 100644 index 0000000..a876c4f --- /dev/null +++ b/theme.yaml @@ -0,0 +1,15 @@ +name: hugo-platen +license: MIT +licenselink: https://github.com/platenio/hugo-platen/blob/main/LICENSE +description: 'Platen core theme for Hugo: build websites for digital tabletop games' +homepage: http://example.com/ +tags: [] +features: [] +min_version: 0.87.0 +author: + name: Platen Cooperative + homepage: https://platen.io +original: + name: 'hugo-book' + homepage: https://hugo-book-demo.netlify.app + repo: https://github.com/alex-shpak/hugo-book