Squashed 'themes/paperesque/' content from commit 228903d

git-subtree-dir: themes/paperesque
git-subtree-split: 228903d2bad09f92d4de8a2922806fafd24d3966
This commit is contained in:
2020-10-09 23:41:57 +05:30
commit e186c5d6f7
108 changed files with 4071 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html
lang="{{ .Site.LanguageCode }}"
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"
>
<head>
<meta charset="utf-8" />
{{ partial "meta.html" . }}
<title>{{ .Title }}{{ if ne $.Site.Title .Title }} || {{ $.Site.Title }}{{ end }}</title>
<link rel="canonical" href="{{ .Permalink }}" />
{{ with .Site.Params.RSSCanonicalLink }}
<link rel="alternate" type="application/rss+xml" href="{{ . | absURL }}" title="{{$.Site.Title}}" />
{{ else }}
{{- with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{- end -}}
{{ end }}
{{ partial "head_includes.html" . }}
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
</head>
<body
class="{{ block "body-classes" . }}{{ end }}"
lang="{{ .Site.LanguageCode }}">
<div class="nav-bkg">
<nav class="content-container pagewide-bar-padding">
<span class="divider">/ </span>
<a href="{{ .Site.Home.RelPermalink }}" >{{ .Site.Title }}</a>
{{ block "breadcrumbs" . }}
{{- with .Parent -}}
{{- if not .IsHome -}}
<span class="divider">/ </span>
<a href="{{ .RelPermalink }}">
{{- with .Params.breadcrumb_label -}}
{{- . -}}
{{- else -}}
{{- .Title -}}
{{- end -}}
</a>
{{- end -}}
{{- end -}}
{{ end }}
{{ partial "right-links" . }}
</nav>
</div>
{{ block "content" . }}{{ end }}
{{ block "footer" .}}{{ end }}
</body>
</html>

View File

@@ -0,0 +1,24 @@
{{ define "content" }}
<section id="main" class="content-container article-pad-v">
<div>
<h1 id="title" style="margin-bottom: 0.75em">{{.Title}}</h1>
<ul id="list" class="list-unstyled list-of-titles">
{{ range .Data.Pages.ByDate.Reverse }}
<li class="{{if .Draft }}draft{{ end }}">
<a href="{{ .RelPermalink}}">
<span class="post-title">{{ .Title }}</span>
<br>
<span class="post-meta">{{ .Date.Format "January 2, 2006" }}</span>
<br>
<span class="post-meta">
{{ range .Params.tags }}
#{{ . }}&nbsp;
{{ end }}
</span>
</a>
</li>
{{ end }}
</ul>
</div>
</section>
{{ end }}

View File

@@ -0,0 +1,3 @@
{{ with (.Page.Scratch.Get "droplist") }}
{{- range (. | sort | uniq) }}{{.}}
{{end -}}{{end}}

View File

@@ -0,0 +1,37 @@
{{ define "body-classes" -}}
{{ if .Draft }}draft{{ end }} look-sheet-bkg
{{- end }}
{{ define "content" }}
{{- partial "single-article" . -}}
{{ end }}
{{ define "footer" }}
<!-- TODO: right now, this gets weird when there's a big title on the right.
There might be better info here: https://stackoverflow.com/questions/34995740/css-when-inline-block-elements-line-break-parent-wrapper-does-not-fit-new-width
and you can test on the android-development-developer-productivity article.
Would also be cool to make this fold on mobile so there's two links on separate lines.
-->
{{if (and (not .Parent.IsHome) (or .PrevInSection .NextInSection)) }}
<div class="nav-bkg-50 content-container-narrow-pad bottom-links text-0p75">
<nav class="flex-row">
{{if .PrevInSection}}
<a href="{{.PrevInSection.Permalink}}" class="flex-row v-center no-underline" style="max-width:45%;">
<span class="text-1p5"></span>&nbsp;<span class="re-underline">Previous: {{ .PrevInSection.Title }}</span>
</a>
{{else}}
<span class="flex-row v-center"></span>
{{end}}
{{if .NextInSection}}
<a href="{{.NextInSection.Permalink}}" class="flex-row v-center no-underline" style="max-width: 45%;">
<span class="re-underline">Next: {{.NextInSection.Title}}</span>&nbsp;<span class="text-1p5"></span>
</a>
{{else}}
<span class="flex-row v-center"></span>
{{end}}
</nav>
</div>
{{ end }}
{{ end }}

16
layouts/index.html Normal file
View File

@@ -0,0 +1,16 @@
{{ define "content" }}
<section id="main" class="content-container article-pad-v">
<div>
<h1 id="title" style="margin-bottom: 0.75em">{{.Title}}</h1>
<ul id="list" class="list-unstyled list-of-titles">
{{ range .Site.Params.Menu }}
<li>
<a href="{{ .url | relURL }}">
<span class="post-title">{{ .name }}</span>
</a>
</li>
{{ end }}
</ul>
</div>
</section>
{{ end }}

View File

@@ -0,0 +1,15 @@
{{/* The featured image, using the same rules as what the twitter cards use. */}}
{{- with $.Params.images -}}
{{- index . 0 | absURL -}}
{{- else -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}}
{{- with $featured -}}
{{- $featured.Permalink -}}
{{- else -}}
{{- with $.Site.Params.images -}}
{{- index . 0 | absURL -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,9 @@
<link rel="stylesheet" href="{{ relURL "/css/reboot.css" }}" />
<link rel="stylesheet" href="{{ relURL "/css/style.css" }}" />
<link rel="stylesheet" href="{{ relURL "/css/syntax.css" }}" />
{{ $opts := dict "targetPath" "js/main.js" "minify" true "target" "es2015" }}
{{ $mainJs := resources.Get "js/main.js" | js.Build $opts }}
<script type="text/javascript" src="{{ $mainJs.RelPermalink }}" defer></script>
<link href="https://fonts.googleapis.com/css?family=Lora&display=swap" rel="stylesheet">

View File

@@ -0,0 +1,28 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" sizes="180x180" href="{{.Site.BaseURL}}/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{.Site.BaseURL}}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{.Site.BaseURL}}/favicon-16x16.png">
<link rel="manifest" href="{{.Site.BaseURL}}/site.webmanifest">
<link rel="mask-icon" href="{{.Site.BaseURL}}/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
{{ with.Description }}<meta name="description" content="{{ . }}" />
{{ end }}
<meta name="keywords" content="{{ if .Keywords }}{{ range.Keywords }}{{ . }},
{{ end }}{{else if isset .Params "tags" }}{{ range.Params.tags }}{{ . }},
{{ end }}{{ end }}">
{{ template "_internal/opengraph.html" . }}
<meta property="og:site_name" content="{{ .Site.Title }}" />
{{ partial "twitter_cards_default_small.html" . }}
{{ template "_internal/schema.html" . }}

View File

@@ -0,0 +1,9 @@
<ul class="list-unstyled right-links">
{{ range .Site.Params.TopMenu }}
<li>
<a href="{{ .url | relURL }}">
<span class="post-title">{{ .name }}</span>
</a>
</li>
{{ end }}
</ul>

View File

View File

@@ -0,0 +1,33 @@
<article
id="main"
class="content-container look-sheet article-pad-v {{ if (or .Params.disableMarginNotes .Site.Params.disableMarginNotes) }}no-floating-footnotes{{ end }}"
itemscope
itemtype="https://schema.org/Article" >
<meta itemprop="author" content="{{ .Site.Params.Author }}" />
<meta itemprop="publisher" content="{{ .Site.Params.Author }}" />
<meta itemprop="image" content="{{ partial "feature_image" . }}" />
<h1 itemprop="name" id="title">{{ .Title }}</h1>
<meta itemprop="headline" content="{{ .Title }}" />
{{ with .Params.tags }}
<div class="post-tags">
{{ range . }}
<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">#{{ . }}</a>&nbsp;
{{ end }}
</div>
{{ end }}
{{ if .Date }}
{{ if eq .Lastmod .Date }}
<div class="post-date"><span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div>
<meta itemprop="dateModified" content="{{ .Lastmod.Format "January 2, 2006" }}"/>
{{ else }}
<div class="post-date">Created: <span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div>
<div class="post-date">Last Edited: <span itemprop="dateModified">{{ .Lastmod.Format "January 2, 2006" }}</span></div>
{{ end }}
{{ end }}
{{ if .Draft }}
<div class="post-date">{{ .WordCount }} words</div>
{{ end }}
<div itemprop="articleBody" id="content" class="article-body margin-top-2em">
{{ .Content }}
</div>
</article>

View File

@@ -0,0 +1,30 @@
{{/* This is a modified copy/paste of https://github.com/gohugoio/hugo/blob/2b73e89d6d2822e86360a6c92c87f539677c119b/tpl/tplimpl/embedded/templates/twitter_cards.html */}}
{{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}}
{{- with $featured -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
{{- else -}}
{{- with $.Site.Params.images -}}
<meta name="twitter:card" content="summary"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
<meta name="twitter:card" content="summary"/>
{{- end -}}
{{- end -}}
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
{{ range .Site.Authors }}
{{ with .twitter -}}
<meta name="twitter:creator" content="@{{ . }}"/>
{{ end -}}
{{ end -}}

View File

@@ -0,0 +1,3 @@
<aside class="article-aside look-sheet-border">
{{- .Inner -}}
</aside>

View File

@@ -0,0 +1,5 @@
<aside class="content-warning">
<p>
<strong>Content Note:</strong> {{ trim .Inner "\n" }}
</p>
</aside>

View File

@@ -0,0 +1,18 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<!--
Ok, so - see this: https://gohugo.io/content-management/shortcodes/#shortcodes-with-markdown
The outcome is that by default, accessing .Inner returns the Markdown. Because we're putting it
inside a div, it doesn't get rendered later. So we restore the old behaviour, which renders
everything to HTML as a first step (but apparently breaks the TOC functionality).
-->
<!-- Expander: hides content by default, shows it when clicked on. -->
<div class="expander look-sheet">
{{ $radioGroup := anchorize (.Get "title") }}
<h2>{{ .Get "title" }}</h2>
<input type=radio id="expand-{{$radioGroup}}-show" class="hidden show" name="{{$radioGroup}}">
<input type=radio id="expand-{{$radioGroup}}-hide" class="hidden hide" name="{{$radioGroup}}" checked="checked">
<label class="button button-show" for="expand-{{$radioGroup}}-show">+ Expand</label><label class="button button-hide" for="expand-{{$radioGroup}}-hide">- Collapse</label>
<div class="inner">
{{ .Inner }}
</div>
</div>

View File

@@ -0,0 +1,53 @@
{{- $path := (.Get "src") -}}
{{- $original := .Page.Resources.GetMatch $path -}}
{{- if not $original -}}
{{- errorf "couldn't find resource for src: %s" $path -}}
{{- else if and (ne "jpeg" $original.MediaType.SubType) (ne "png" $original.MediaType.SubType) -}}
{{- errorf "src %s is a '%s', expected 'jpeg' or 'png'" $path $original.MediaType.SubType -}}
{{- else -}}
{{- /* Below is a copy paste of https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/figure.html from Hugo commit aba2647c152ffff927f42523b77ee6651630cd67, with the img tag modified to use srcsets */ -}}
{{- /* Note that it presently uses `markdownify` instead of $.Page.RenderString for consistency with Hugo's `figure` shortcode. */ -}}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end }}
{{ if (or (ge $original.Width 1304) (ge $original.Height 1304)) -}}
{{/* Add the original to the droplist, so it will get removed later. */}}
{{- if not (.Page.Scratch.Get "droplist") -}}
{{- .Page.Scratch.Set "droplist" (slice) -}}
{{- end -}}
{{- .Page.Scratch.Add "droplist" $original.RelPermalink -}}
{{/* Note: 652px is the max width of an img in article content. I measured this using dev tools; but it's dependent on the styles for the page. */}}
{{- $resized_1x := $original.Fit "652x652 q95" -}}
{{- $resized_2x := $original.Fit "1304x1304 q95" -}}
<img srcset="{{ $resized_1x.RelPermalink }},
{{ $resized_2x.RelPermalink }} 2x"
{{- /* Use small one by default to be kind to old browsers */}}
src="{{ $resized_1x.RelPermalink }}"
{{ else }}
<img src="{{ $original.RelPermalink }}"
{{ end }}
{{- if or (.Get "alt") (.Get "caption") -}}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
/> <!-- Closing img tag -->
{{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
<figcaption>
{{ with (.Get "title") -}}
<h4>{{ . }}</h4>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p>
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>
{{- end -}}

View File

@@ -0,0 +1,33 @@
{{- /* This is a copy paste of
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/figure.html
from Hugo commit aba2647c152ffff927f42523b77ee6651630cd67, with the img tag
replaced with an object tag, with type=svg. This allows for embedded SVGs to
be animated with CSS in Safari 13.1. See also: https://stackoverflow.com/q/60975613/996592
*/ -}}
{{- /* Note that it presently uses `markdownify` instead of $.Page.RenderString for consistency with Hugo's `figure` shortcode. */ -}}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end }}
<object type="image/svg+xml" data="{{ .Get "src" }}"
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
></object>
{{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption>
{{ with (.Get "title") -}}
<h4>{{ . }}</h4>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p>
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>

View File

@@ -0,0 +1,18 @@
{{ define "content" }}
<section id="main" class="content-container article-pad-v">
<div>
<h1 id="title" style="margin-bottom: 0.75em">{{.Title}}</h1>
<ul id="list" class="list-unstyled list-of-titles">
{{ range .Data.Pages.ByDate.Reverse }}
<li class="{{ if .Draft }}draft{{ end }}">
<a href="{{ .RelPermalink}}">
<span class="post-title">{{ .Title }}</span>
<br>
<span class="post-meta">{{ .Date.Format "January 2, 2006" }}</span>
</a>
</li>
{{ end }}
</ul>
</div>
</section>
{{ end }}

View File

@@ -0,0 +1,27 @@
{{ define "content" }}
<section id="main" class="content-container article-pad-v">
<div>
<h1 id="title" style="margin-bottom: 0.75em">{{.Title}}</h1>
<ul id="list" class="list-unstyled list-of-titles">
{{ range .Data.Terms.ByCount }}
{{ with .Page }}
{{ $numDrafts := len (where .Pages ".Draft" true) }}
<li class="{{ if gt $numDrafts 0 }}draft{{ end }}">
<a href="{{ .RelPermalink}}">
<span class="post-title">#{{ .Title }}</span>
<br>
<span class="post-meta">{{len .Pages}} {{if ne (len .Pages) 1}}entries{{else}}entry{{end}}</span>
<br>
{{ if gt $numDrafts 0 }}
<span class="post-meta draft">Including {{ $numDrafts }} {{if ne $numDrafts 1}}drafts{{else}}draft{{end}}</span>
<br>
{{ end }}
<span class="post-meta">Last updated {{ .Lastmod.Format "January 2, 2006" }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>
</section>
{{ end }}