Browse Source

Switch to pyproject, ruff, djlint, modern stack

master
David Larlet 7 months ago
parent
commit
fc7bc78fb9
Signed by: David Larlet <david@larlet.fr> GPG Key ID: 3E2953A359E7E7BD
8 changed files with 504 additions and 170 deletions
  1. 27
    1
      Makefile
  2. 1
    1
      david/blog/webmention/index.py
  3. 203
    154
      david/templates/base_2020.html
  4. 53
    0
      pyproject.toml
  5. 187
    0
      requirements-dev.txt
  6. 24
    5
      requirements.txt
  7. 8
    7
      site.py
  8. 1
    2
      typography.py

+ 27
- 1
Makefile View File

@@ -1,14 +1,39 @@
.DEFAULT_GOAL := help
RED=\033[0;31m
GREEN=\033[0;32m
ORANGE=\033[0;33m
BLUE=\033[0;34m
NC=\033[0m # No Color

.PHONY: install
install: ## Install the dependencies
python -m pip install -r requirements.txt
@echo "${GREEN}🤖 Installing dependencies${NC}"
python3 -m pip install --upgrade pip
python3 -m pip install --editable .

.PHONY: dev
dev: install ## Install the development dependencies
python3 -m pip install --editable ".[dev]"

.PHONY: deps
deps: ## Generate dependencies from pyproject.toml
@echo "${GREEN}🤖 Updating requirements${NC}"
python3 -m piptools compile --upgrade --quiet --resolver=backtracking --output-file=requirements.txt pyproject.toml
python3 -m piptools compile --upgrade --quiet --resolver=backtracking --extra=dev --output-file=requirements-dev.txt pyproject.toml

.PHONY: lint
lint: ## Ensure code consistency
@echo "${GREEN}🤖 Linting code${NC}"
@ruff site.py --fix
@black . --quiet
@djlint david/templates/base_2020.html --reformat --quiet --format-js --format-css


.PHONY: build
build: ## Generate the site
@python site.py pages tags feed home


.PHONY: publish
publish: ## Make heavy actions
@python site.py search blogroll
@@ -21,6 +46,7 @@ blogroll: ## Generate the blogroll

.PHONY: live
live: ## Rebuild contents on file change.
@echo "${ORANGE}⚠️ You need http://eradman.com/entrproject/${NC}"
ls david/2023/_sources/* | entr -r make build



+ 1
- 1
david/blog/webmention/index.py View File

@@ -1,7 +1,7 @@
#!/usr/bin/python3
import os
import cgi
import cgitb
import os
import subprocess
import urllib.request


+ 203
- 154
david/templates/base_2020.html View File

@@ -1,185 +1,234 @@
<!doctype html><!-- This is a valid HTML5 document. -->
<!DOCTYPE html><!-- This is a valid HTML5 document. -->
<!-- Screen readers, SEO, extensions and so on. -->
<html lang="{% block lang %}fr{% endblock lang %}">
<!-- Has to be within the first 1024 bytes, hence before the `title` element
<!-- Has to be within the first 1024 bytes, hence before the `title` element
See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
<meta charset="utf-8">
<!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
<!-- The viewport meta is quite crowded and we are responsible for that.
<meta charset="utf-8">
<!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
<!-- The viewport meta is quite crowded and we are responsible for that.
See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- Required to make a valid HTML5 document. -->
<title>{% block title %}{% endblock %} — David Larlet</title>
<meta name="description" content="{% block description %}{% endblock %}">
<!-- That good ol' feed, subscribe :). -->
<link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
<!-- Generated from https://realfavicongenerator.net/ such a mess. -->
<link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
<link rel="manifest" href="/static/david/icons2/site.webmanifest">
<link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
<link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
<meta name="msapplication-TileColor" content="#f7f7f7">
<meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
<meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
<!-- Documented, feel free to shoot an email. -->
<link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
<!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
<link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
<link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
<link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
<link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
<link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
<link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
<script>
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- Required to make a valid HTML5 document. -->
<title>
{% block title %}{% endblock %}
— David Larlet</title>
<meta name="description" content="{% block description %}{% endblock %}">
<!-- That good ol' feed, subscribe :). -->
<link rel="alternate"
type="application/atom+xml"
title="Feed"
href="/david/log/">
<!-- Generated from https://realfavicongenerator.net/ such a mess. -->
<link rel="apple-touch-icon"
sizes="180x180"
href="/static/david/icons2/apple-touch-icon.png">
<link rel="icon"
type="image/png"
sizes="32x32"
href="/static/david/icons2/favicon-32x32.png">
<link rel="icon"
type="image/png"
sizes="16x16"
href="/static/david/icons2/favicon-16x16.png">
<link rel="manifest" href="/static/david/icons2/site.webmanifest">
<link rel="mask-icon"
href="/static/david/icons2/safari-pinned-tab.svg"
color="#07486c">
<link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
<meta name="msapplication-TileColor" content="#f7f7f7">
<meta name="msapplication-config"
content="/static/david/icons2/browserconfig.xml">
<meta name="theme-color"
content="#f7f7f7"
media="(prefers-color-scheme: light)">
<meta name="theme-color"
content="#272727"
media="(prefers-color-scheme: dark)">
<!-- Documented, feel free to shoot an email. -->
<link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
<!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
<link rel="preload"
href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2"
as="font"
type="font/woff2"
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
crossorigin>
<link rel="preload"
href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2"
as="font"
type="font/woff2"
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
crossorigin>
<link rel="preload"
href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2"
as="font"
type="font/woff2"
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
crossorigin>
<link rel="preload"
href="/static/david/css/fonts/triplicate_t3_regular.woff2"
as="font"
type="font/woff2"
media="(prefers-color-scheme: dark)"
crossorigin>
<link rel="preload"
href="/static/david/css/fonts/triplicate_t3_bold.woff2"
as="font"
type="font/woff2"
media="(prefers-color-scheme: dark)"
crossorigin>
<link rel="preload"
href="/static/david/css/fonts/triplicate_t3_italic.woff2"
as="font"
type="font/woff2"
media="(prefers-color-scheme: dark)"
crossorigin>
<script>
function toggleTheme(themeName) {
document.documentElement.classList.toggle(
'forced-dark',
themeName === 'dark'
)
document.documentElement.classList.toggle(
'forced-light',
themeName === 'light'
)
document.documentElement.classList.toggle(
'forced-dark',
themeName === 'dark'
)
document.documentElement.classList.toggle(
'forced-light',
themeName === 'light'
)
}
const selectedTheme = localStorage.getItem('theme')
if (selectedTheme !== 'undefined') {
toggleTheme(selectedTheme)
toggleTheme(selectedTheme)
}
</script>
{% block extra_head %}{% endblock %}
<body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">

{% block content %}{% endblock content %}

<hr>

<footer>
<p>
<nobr>
<a href="/david/" title="Aller à l’accueil"
><svg class="icon icon-home">
<use
xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-home"
></use>
</svg>
Accueil</a
>
</nobr>
<nobr>
<a href="/david/log/" title="Accès au flux RSS"
><svg class="icon icon-rss2">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-rss2"></use>
</svg>
Suivre</a
>
</nobr>
<nobr>
<a href="http://larlet.com" title="Go to my English profile" data-instant
><svg class="icon icon-user-tie">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-user-tie"></use>
</svg>
Pro</a
>
</nobr>
<nobr>
<a href="mailto:david%40larlet.fr" title="Envoyer un courriel"
><svg class="icon icon-mail">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-mail"></use>
</svg>
Email</a
>
</nobr>
<nobr>
<abbr
class="nowrap"
title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"
><svg class="icon icon-hammer2">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-hammer2"></use>
</svg>
Légal</abbr
>
</nobr>
</p>
<template id="theme-selector">
<form>
</script>
{% block extra_head %}{% endblock %}
<body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick"
data-instant-intensity="viewport-all">
{% block content %}
{% endblock content %}
<hr>
<footer>
<p>
<nobr>
<a href="/david/" title="Aller à l’accueil">
<svg class="icon icon-home">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-home"></use>
</svg>
Accueil</a>
</nobr>
<nobr>
<a href="/david/log/" title="Accès au flux RSS">
<svg class="icon icon-rss2">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-rss2"></use>
</svg>
Suivre</a>
</nobr>
<nobr>
<a href="http://larlet.com"
title="Go to my English profile"
data-instant>
<svg class="icon icon-user-tie">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-user-tie"></use>
</svg>
Pro</a>
</nobr>
<nobr>
<a href="mailto:david%40larlet.fr" title="Envoyer un courriel">
<svg class="icon icon-mail">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-mail"></use>
</svg>
Email</a>
</nobr>
<nobr>
<abbr class="nowrap"
title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340">
<svg class="icon icon-hammer2">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-hammer2"></use>
</svg>
Légal</abbr>
</nobr>
</p>
<template id="theme-selector">
<form>
<fieldset>
<legend><svg class="icon icon-brightness-contrast">
<legend>
<svg class="icon icon-brightness-contrast">
<use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-brightness-contrast"></use>
</svg> Thème</legend>
<label>
<input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
</label>
<label>
<input type="radio" value="dark" name="chosen-color-scheme"> Foncé
</label>
<label>
<input type="radio" value="light" name="chosen-color-scheme"> Clair
</label>
</svg>
Thème
</legend>
<label>
<input type="radio" value="auto" name="chosen-color-scheme" checked>
Auto
</label>
<label>
<input type="radio" value="dark" name="chosen-color-scheme">
Foncé
</label>
<label>
<input type="radio" value="light" name="chosen-color-scheme">
Clair
</label>
</fieldset>
</form>
</template>
</footer>
<script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
<script>
function loadThemeForm(templateName) {
</form>
</template>
</footer>
<script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
<script>
function loadThemeForm(templateName) {
const themeSelectorTemplate = document.querySelector(templateName)
const form = themeSelectorTemplate.content.firstElementChild
themeSelectorTemplate.replaceWith(form)

form.addEventListener('change', (e) => {
const chosenColorScheme = e.target.value
localStorage.setItem('theme', chosenColorScheme)
toggleTheme(chosenColorScheme)
const chosenColorScheme = e.target.value
localStorage.setItem('theme', chosenColorScheme)
toggleTheme(chosenColorScheme)
})

const selectedTheme = localStorage.getItem('theme')
if (selectedTheme && selectedTheme !== 'undefined') {
form.querySelector(`[value="${selectedTheme}"]`).checked = true
form.querySelector(`[value="${selectedTheme}"]`).checked = true
}
}
}

const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
window.addEventListener('load', () => {
const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
window.addEventListener('load', () => {
let hasDarkRules = false
for (const styleSheet of Array.from(document.styleSheets)) {
let mediaRules = []
for (const cssRule of styleSheet.cssRules) {
if (cssRule.type !== CSSRule.MEDIA_RULE) {
continue
}
// WARNING: Safari does not have/supports `conditionText`.
if (cssRule.conditionText) {
if (cssRule.conditionText !== prefersColorSchemeDark) {
continue
}
} else {
if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
continue
}
}
mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
let mediaRules = []
for (const cssRule of styleSheet.cssRules) {
if (cssRule.type !== CSSRule.MEDIA_RULE) {
continue
}

// WARNING: do not try to insert a Rule to a styleSheet you are
// currently iterating on, otherwise the browser will be stuck
// in a infinite loop…
for (const mediaRule of mediaRules) {
styleSheet.insertRule(mediaRule.cssText)
hasDarkRules = true
// WARNING: Safari does not have/supports `conditionText`.
if (cssRule.conditionText) {
if (cssRule.conditionText !== prefersColorSchemeDark) {
continue
}
} else {
if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
continue
}
}
mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
}

// WARNING: do not try to insert a Rule to a styleSheet you are
// currently iterating on, otherwise the browser will be stuck
// in a infinite loop…
for (const mediaRule of mediaRules) {
styleSheet.insertRule(mediaRule.cssText)
hasDarkRules = true
}
}
if (hasDarkRules) {
loadThemeForm('#theme-selector')
loadThemeForm('#theme-selector')
}
})
</script>
{% block extra_body %}{% endblock %}
</body>
})
</script>
{% block extra_body %}{% endblock %}
</body>
</html>

+ 53
- 0
pyproject.toml View File

@@ -0,0 +1,53 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "larlet-fr-david"
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
"feedparser",
"Jinja2",
"minicli",
"mistune",
"Pillow",
"python-slugify",
"regex",
]

[project.optional-dependencies]
dev = [
"black",
"blinker",
"djlint",
"hatch",
"pip-tools",
"ruff",
]

[tool.hatch.version]
path = "site.py"

[tool.ruff]
select = ["E", "F", "I", "W", "PTH", "RUF"]
fixable = ["I"]
# Espace insecable (guillemets) + fine insecable (ponctuation double, chiffres)
# + vraie apostrophe.
allowed-confusables = [" ", " ", "’"]
show-source = true

[tool.djlint]
profile="jinja"
files=["david/templates"]
indent=2
ignore="H031"
format_css=true
format_js=true

[tool.djlint.js]
indent_size=2

[tool.djlint.css]
indent_size=2

+ 187
- 0
requirements-dev.txt View File

@@ -0,0 +1,187 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml
#
anyio==4.0.0
# via httpcore
black==23.9.0
# via larlet-fr-david (pyproject.toml)
blinker==1.6.2
# via larlet-fr-david (pyproject.toml)
build==1.0.3
# via pip-tools
certifi==2023.7.22
# via
# httpcore
# httpx
click==8.1.7
# via
# black
# djlint
# hatch
# pip-tools
# userpath
colorama==0.4.6
# via djlint
cssbeautifier==1.14.9
# via djlint
distlib==0.3.7
# via virtualenv
djlint==1.32.1
# via larlet-fr-david (pyproject.toml)
editables==0.5
# via hatchling
editorconfig==0.12.3
# via
# cssbeautifier
# jsbeautifier
exceptiongroup==1.1.3
# via anyio
feedparser==6.0.10
# via larlet-fr-david (pyproject.toml)
filelock==3.12.3
# via virtualenv
h11==0.14.0
# via httpcore
hatch==1.7.0
# via larlet-fr-david (pyproject.toml)
hatchling==1.18.0
# via hatch
html-tag-names==0.1.2
# via djlint
html-void-elements==0.1.0
# via djlint
httpcore==0.17.3
# via httpx
httpx==0.24.1
# via hatch
hyperlink==21.0.0
# via hatch
idna==3.4
# via
# anyio
# httpx
# hyperlink
importlib-metadata==6.8.0
# via
# build
# keyring
jaraco-classes==3.3.0
# via keyring
jinja2==3.1.2
# via larlet-fr-david (pyproject.toml)
jsbeautifier==1.14.9
# via
# cssbeautifier
# djlint
json5==0.9.14
# via djlint
keyring==24.2.0
# via hatch
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.3
# via jinja2
mdurl==0.1.2
# via markdown-it-py
minicli==0.5.1
# via larlet-fr-david (pyproject.toml)
mistune==3.0.1
# via larlet-fr-david (pyproject.toml)
more-itertools==10.1.0
# via jaraco-classes
mypy-extensions==1.0.0
# via black
packaging==23.1
# via
# black
# build
# hatch
# hatchling
pathspec==0.11.2
# via
# black
# djlint
# hatchling
pexpect==4.8.0
# via hatch
pillow==10.0.0
# via larlet-fr-david (pyproject.toml)
pip-tools==7.3.0
# via larlet-fr-david (pyproject.toml)
platformdirs==3.10.0
# via
# black
# hatch
# virtualenv
pluggy==1.3.0
# via hatchling
ptyprocess==0.7.0
# via pexpect
pygments==2.16.1
# via rich
pyperclip==1.8.2
# via hatch
pyproject-hooks==1.0.0
# via build
python-slugify==8.0.1
# via larlet-fr-david (pyproject.toml)
pyyaml==6.0.1
# via djlint
regex==2023.8.8
# via
# djlint
# larlet-fr-david (pyproject.toml)
rich==13.5.2
# via hatch
ruff==0.0.287
# via larlet-fr-david (pyproject.toml)
sgmllib3k==1.0.0
# via feedparser
shellingham==1.5.3
# via hatch
six==1.16.0
# via
# cssbeautifier
# jsbeautifier
sniffio==1.3.0
# via
# anyio
# httpcore
# httpx
text-unidecode==1.3
# via python-slugify
tomli==2.0.1
# via
# black
# build
# djlint
# hatchling
# pip-tools
# pyproject-hooks
tomli-w==1.0.0
# via hatch
tomlkit==0.12.1
# via hatch
tqdm==4.66.1
# via djlint
trove-classifiers==2023.8.7
# via hatchling
typing-extensions==4.7.1
# via
# black
# filelock
userpath==1.9.1
# via hatch
virtualenv==20.24.5
# via hatch
wheel==0.41.2
# via pip-tools
zipp==3.16.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools

+ 24
- 5
requirements.txt View File

@@ -1,7 +1,26 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --output-file=requirements.txt pyproject.toml
#
feedparser==6.0.10
Jinja2==3.0.1
minicli==0.5.0
# via larlet-fr-david (pyproject.toml)
jinja2==3.1.2
# via larlet-fr-david (pyproject.toml)
markupsafe==2.1.3
# via jinja2
minicli==0.5.1
# via larlet-fr-david (pyproject.toml)
mistune==3.0.1
Pillow==9.4.0
python-slugify==5.0.2
regex==2021.8.3
# via larlet-fr-david (pyproject.toml)
pillow==10.0.0
# via larlet-fr-david (pyproject.toml)
python-slugify==8.0.1
# via larlet-fr-david (pyproject.toml)
regex==2023.8.8
# via larlet-fr-david (pyproject.toml)
sgmllib3k==1.0.0
# via feedparser
text-unidecode==1.3
# via python-slugify

+ 8
- 7
site.py View File

@@ -29,6 +29,7 @@ from widont import widont
# Useful for dates rendering within Jinja2.
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")

VERSION = "2023.09.10"
HERE = Path(".")
DAVID = HERE / "david"
STATIC = HERE / ".." / "larlet-fr-static"
@@ -383,7 +384,7 @@ def pages():
content = template.render(page=page, prev=previous, next=next_, slugify=slugify)
target_path = Path(page.url[1:])
target_path.mkdir(parents=True, exist_ok=True)
open(target_path / "index.html", "w").write(content)
(target_path / "index.html").write_text(content)
if page.is_draft:
print(f"Draft: {LOCAL_DOMAIN}{page.url} ({page.title})")

@@ -396,7 +397,7 @@ def pages():
content = template.render(
page_list=groupby(page_list, key=group_by_month_year), tags=tags
)
open(root_path / "index.html", "w").write(content)
(root_path / "index.html").write_text(content)


@cli
@@ -412,7 +413,7 @@ def tags():
)
target_path = DAVID / "2023" / slugify(tag)
target_path.mkdir(parents=True, exist_ok=True)
open(target_path / "index.html", "w").write(content)
(target_path / "index.html").write_text(content)


@cli
@@ -422,7 +423,7 @@ def home():
page_list = Page.all(source=SOURCES_PATH, only_published=True)
tags = sorted((slugify(tag), tag, len(pages_by_tags[tag])) for tag in all_tags)
content = template.render(page_list=page_list, tags=tags)
open(DAVID / "index.html", "w").write(content)
(DAVID / "index.html").write_text(content)


@dataclass
@@ -523,7 +524,7 @@ def blogroll():
reverse=True,
)
content = template.render(website_list=website_list, entry_list=entry_list)
open(DAVID / "blogroll" / "index.html", "w").write(content)
(DAVID / "blogroll" / "index.html").write_text(content)


@cli
@@ -571,7 +572,7 @@ def search():
)
search_index = json.dumps([page.search_data for page in page_list], indent=2)
content = template.render(search_index=search_index)
open(DAVID / "recherche" / "index.html", "w").write(content)
(DAVID / "recherche" / "index.html").write_text(content)


@cli
@@ -584,7 +585,7 @@ def feed():
current_dt=TODAY.strftime(NORMALIZED_STRFTIME),
BASE_URL=f"{DOMAIN}/david/",
)
open(DAVID / "log" / "index.xml", "w").write(content)
(DAVID / "log" / "index.xml").write_text(content)


@wrap

+ 1
- 2
typography.py View File

@@ -1,7 +1,6 @@
from dataclasses import dataclass
import html.entities
import unicodedata
from dataclasses import dataclass

import regex # pour le support de "\p{}"


Loading…
Cancel
Save