export to theme

This commit is contained in:
Simon 2020-02-27 11:20:14 +01:00
parent 5c0ac24daf
commit 5007e65946
29 changed files with 12 additions and 1285 deletions

6
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "themes/hugo-social-metadata"] [submodule "themes/hugo-theme-lowtech"]
path = themes/hugo-social-metadata path = themes/hugo-theme-lowtech
url = https://github.com/msfjarvis/hugo-social-metadata.git url = https://gitea.lamelio.fr/kosssi/hugo-theme-lowtech.git

View File

@ -1,41 +0,0 @@
.grid { display: flex; flex-wrap: wrap; }
.grid.\-top { align-items: flex-start; }
.grid.\-middle { align-items: center; }
.grid.\-bottom { align-items: flex-end; }
.grid.\-stretch { align-items: stretch; }
.grid.\-baseline { align-items: baseline; }
.grid.\-left { justify-content: flex-start; }
.grid.\-center { justify-content: center; }
.grid.\-right { justify-content: flex-end; }
.grid.\-between { justify-content: space-between; }
.grid.\-around { justify-content: space-around; }
.cell { flex: 1; box-sizing: border-box; }
.cell.\-left { text-align: left ;}
.cell.\-right { text-align: right; }
.cell.\-center { text-align: center ;}
.cell img { max-width: 100% }
@media screen and (min-width: 600px) {
.\-even-reverse:nth-child(even) { flex-direction: row-reverse; }
.cell.\-1of12 { flex: 0 0 calc(100% * 1 / 12); }
.cell.\-2of12 { flex: 0 0 calc(100% * 2 / 12); }
.cell.\-3of12 { flex: 0 0 calc(100% * 3 / 12); }
.cell.\-4of12 { flex: 0 0 calc(100% * 4 / 12); }
.cell.\-5of12 { flex: 0 0 calc(100% * 5 / 12); }
.cell.\-6of12 { flex: 0 0 calc(100% * 6 / 12); }
.cell.\-7of12 { flex: 0 0 calc(100% * 7 / 12); }
.cell.\-8of12 { flex: 0 0 calc(100% * 8 / 12); }
.cell.\-9of12 { flex: 0 0 calc(100% * 9 / 12); }
.cell.\-10of12 { flex: 0 0 calc(100% * 10 / 12); }
.cell.\-11of12 { flex: 0 0 calc(100% * 11 / 12); }
}
@media screen and (max-width: 599px) {
.grid {
flex-direction: column;
}
.cell {
flex: 0 0 auto;
}
}

View File

@ -11,7 +11,7 @@ $size-xl: 1280px
$size-2x: 1440px $size-2x: 1440px
@import "./font" @import "./font"
@import "./grid" @import "../../themes/hugo-theme-lowtech/assets/styles/grid"
@import "./card" @import "./card"
body body

View File

@ -1,7 +1,7 @@
baseURL = "https://histoiredunpied.com/" baseURL = "https://histoiredunpied.com/"
languageCode = "fr-fr" languageCode = "fr-fr"
title = "Histoire d'un Pied" title = "Histoire d'un Pied"
theme = ["lowtech"] theme = ["hugo-theme-lowtech"]
disableKinds = ["taxonomy", "taxonomyTerm"] disableKinds = ["taxonomy", "taxonomyTerm"]

View File

@ -1,2 +0,0 @@
test
{{ .Page.Dir }}

View File

@ -0,0 +1,2 @@
{{ $style := resources.Get "css/main.sass" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}">

View File

@ -1,10 +0,0 @@
{{ $class := .Get "class" }}
{{ $body := .Get "text" | default .Inner }}
{{ $markdown := .Get "markdown" | default false }}
<div class="cell{{ with $class }} {{ . }}{{ end }}">
{{ if $markdown }}
{{ $.Page.RenderString .Inner }}
{{ else }}
{{ .Inner }}
{{ end }}
</div>

View File

@ -1,39 +0,0 @@
{{/* https://github.com/martignoni/hugo-cloak-email */}}
{{/* Get address, protocol and other parameters */}}
{{- $address := .Get "address" | default (.Get 0) -}}
{{- $protocol := .Get "protocol" | default "mailto" -}}
{{- $class := .Get "class" -}}
{{- $displaytext := .Get "display" -}}
{{- $parts := split $address "@" -}}
{{- $user := (index $parts 0) -}}
{{- $domain := (index $parts 1) | default "" -}}
{{- $query := .Get "query" | default "" -}}
{{/* Compute md5 fingerprint */}}
{{- $fingerprint := md5 (print (.Get "address") $protocol (index (seq 999 | shuffle) 0)) | truncate 8 "" -}}
{{/* Set via CSS what is displayed when Javascript is disabled. Query is never displayed */}}
<style type="text/css">
#id-{{ $fingerprint }}.cloaked-e-mail:before {
content:{{ with $domain }}attr(data-domain) "\0040" {{ end }}attr(data-user);
unicode-bidi:bidi-override;
direction:rtl;
}
</style>
&#32;<span class="cloaked-e-mail" data-user="{{ range $index := seq (sub (len $user) 1) 0}}{{ substr $user $index 1}}{{ end }}"{{ with $domain }} data-domain="{{ range $index := seq (sub (len $domain) 1) 0}}{{ substr $domain $index 1}}{{ end }}"{{ end }} id="id-{{ $fingerprint }}"></span>&#32;
{{/* Alter display with Javascript by changing DOM */}}
<script id="id-{{ $fingerprint }}">
var scriptTag = document.getElementById("id-{{ $fingerprint }}");
var link = document.createElement("a");
var address = "{{ range $index := seq (sub (len $user) 1) 0}}{{ substr $user $index 1}}{{ end }}".split('').reverse().join(''){{ with $domain }} + "@" + "{{ range $index := seq (sub (len $domain) 1) 0}}{{ substr $domain $index 1}}{{ end }}".split('').reverse().join(''){{ with $query }} + "?" + "{{ range $index := seq (sub (len $query) 1) 0}}{{ substr $query $index 1}}{{ end }}".split('').reverse().join(''){{ end }}{{ end }};
link.href = {{ $protocol }} + ":" + address;
{{ with $displaytext }}
link.innerText = {{ $displaytext }};
{{ else }}
link.innerText = address.split('?')[0];
{{ end }}
{{ with $class }}
link.className = "{{ $class }}";
{{ end }}
scriptTag.parentElement.insertBefore(link, scriptTag.previousElementSibling);
scriptTag.parentElement.removeChild(scriptTag.previousElementSibling)
</script>
{{/* The end */}}

View File

@ -1,3 +0,0 @@
{{ $class := .Get "class" }}
{{ $body := .Get "text" | default .Inner }}
<div class="grid{{ with $class }} {{ . }}{{ end }}">{{ $body }}</div>

View File

@ -1 +0,0 @@
{{ partial "image.html" . }}

View File

@ -1 +0,0 @@
{{ now.Format "2006" }}

1024
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,10 @@
"name": "histoiredunpied", "name": "histoiredunpied",
"version": "0.1.0", "version": "0.1.0",
"description": "Source code of histoiredunpied.com", "description": "Source code of histoiredunpied.com",
"main": "index.js",
"scripts": { "scripts": {
"start": "hugo server -D", "start": "hugo server -D",
"serve": "(cd public && python3 -m http.server 8080)", "serve": "(cd public && python3 -m http.server 8080)",
"build": "rm -rf public && hugo -D --minify && node typo", "build": "rm -rf public && hugo -D --minify && node themes/hugo-theme-lowtech/scripts/typo",
"favicon": "convert static/icon.png -resize 32x32 -colors 16 \\( -clone 0 -resize 16x16 -extent 16x16 \\) \\( -clone 0 -resize 32x32 -extent 32x32 \\) -delete 0 static/favicon.ico", "favicon": "convert static/icon.png -resize 32x32 -colors 16 \\( -clone 0 -resize 16x16 -extent 16x16 \\) \\( -clone 0 -resize 32x32 -extent 32x32 \\) -delete 0 static/favicon.ico",
"deploy": "docker-compose up -d --build", "deploy": "docker-compose up -d --build",
"ftp-deploy": "lftp -u $HISTOIREDUNPIED_FTP_USER,$HISTOIREDUNPIED_FTP_PASSWORD $HISTOIREDUNPIED_FTP_HOST -e 'mirror -e -R ./public /www ; quit'", "ftp-deploy": "lftp -u $HISTOIREDUNPIED_FTP_USER,$HISTOIREDUNPIED_FTP_PASSWORD $HISTOIREDUNPIED_FTP_HOST -e 'mirror -e -R ./public /www ; quit'",
@ -14,11 +13,5 @@
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "Simon <simon@lamelio.fr>", "author": "Simon <simon@lamelio.fr>",
"license": "GPL-3.0", "license": "GPL-3.0"
"devDependencies": {
"fledermaus": "7.1.0",
"richtypo": "4.0.7",
"richtypo-rules-common": "4.0.2",
"richtypo-rules-fr": "4.0.2"
}
} }

@ -1 +0,0 @@
Subproject commit 13c8288ad46948c5fef476849e0cf0616bb7ec4d

@ -0,0 +1 @@
Subproject commit b5e2e32c9eca1b1d7d13f2f9647cfead6b1892af

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2020 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.

View File

@ -1,2 +0,0 @@
+++
+++

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<div id="content">
{{- block "main" . }}{{- end }}
</div>
{{- partial "footer.html" . -}}
</body>
</html>

View File

@ -1,2 +0,0 @@
{{ define "main" }}
{{ end }}

View File

@ -1,12 +0,0 @@
<meta charset="utf-8">
<base href="{{ .Site.BaseURL }}">
<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">
{{ $style := resources.Get "css/main.sass" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{ partial "social_metadata.html" . }}

View File

@ -1,47 +0,0 @@
<!-- Configure meta and title tags -->
<meta property="og:type" content="website" />
{{ if .Site.Params.TwitterCardType }}
<meta name="twitter:card" content="{{ .Site.Params.TwitterCardType }}" />
{{ else }}
<meta name="twitter:card" content="summary_large_image" />
{{ end }}
{{ if .Site.Params.TwitterUsername }}
<meta name="twitter:site" content="{{ .Site.Params.TwitterUsername }}" />
{{ end }}
{{ if .IsHome }}
<title>{{ .Site.Title }}</title>
<meta name="description" content="{{ $.Site.Params.description }}" />
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
<meta property="og:image" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
<meta property="og:url" content="{{ .Site.BaseURL }}" />
<meta property="og:title" content="{{ .Site.Title }}" />
<meta name="og:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:title" content="{{ .Site.Title }}" />
<meta name="twitter:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:url" content="{{ .Site.BaseURL }}" />
<meta name="twitter:image:src" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
{{ else }}
<title>{{ .Title }} &middot; {{ .Site.Title }}</title>
<meta name="description" content="{{ .Description }}" />
{{ if .Params.tags }}
<meta name="keywords" content="{{ range .Params.tags }}{{ . }},{{ end }}" />
{{ else }}
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
{{ end }}
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:title" content="{{ .Title }} &middot; {{ .Site.Title }}" />
<meta name="twitter:title" content="{{ .Title }} &middot; {{ .Site.Title }}" />
{{ if .Description }}
<meta name="og:description" content="{{ .Description }}" />
<meta name="twitter:description" content="{{ .Description }}" />
{{ else }}
<meta name="og:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:description" content="{{ $.Site.Params.description }}" />
{{ end }}
<meta name="twitter:url" content="{{ .Permalink }}" />
{{ if .Params.SocialImage }}
<meta name="twitter:image:src" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" />
{{ else }}
<meta name="twitter:image:src" content="{{ .Site.Params.SocialImage }}" />
{{ end }}
{{ end }}

View File

@ -1,21 +0,0 @@
# theme.toml template for a Hugo theme
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
name = "Lowtech"
license = "MIT"
licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE"
description = ""
homepage = "http://example.com/"
tags = []
features = []
min_version = "0.41"
[author]
name = ""
homepage = ""
# If porting an existing theme
[original]
name = ""
homepage = ""
repo = ""

34
typo.js
View File

@ -1,34 +0,0 @@
'use strict';
const path = require('path');
const { loadSourceFiles, savePages } = require('fledermaus');
const richtypo = require('richtypo');
const frRules = require('richtypo-rules-fr');
const { definitions } = require('richtypo-rules-common');
console.log('Prepares your texts to publication on web: applies typography rules.');
const openingQuote = '«';
const closingQuote = '»';
const quotes = text => text
.replace(
new RegExp(`${definitions.notInTag}(["“«]|&ldquo;)((${definitions.tag})?(${definitions.dash}${definitions.space})?${definitions.letter})`, 'gmi'),
`${openingQuote}$2`
)
.replace(
new RegExp(`${definitions.notInTag}(["”»]|&rdquo;)`, 'gmi'),
`${closingQuote}`
);
const rt = richtypo.default([frRules.default, quotes]);
let documents = loadSourceFiles(path.resolve(__dirname, 'public'), ['html'], {});
const pages = documents.map(doc => {
return {
pagePath: doc.sourcePath,
content: rt(doc.content),
};
});
savePages(pages, path.resolve(__dirname, 'public'));