add notes

pull/2/head
Yax 2 years ago
parent 9c23a7318e
commit a0846b387a

@ -1,6 +1,6 @@
# Blog du Yax
This blog is built on excellent work performed by fspaolo with [Makesite.py](https://github.com/fspaolo/makesite).
This blog is built on top of the great work performed by fspaolo on [Makesite.py](https://github.com/fspaolo/makesite).
I cut some features and wristed the code to focus on blog posts and support my [commenting system](https://github.com/kianby/stacosys). You should check fspaolo's repository to really understand Makesite.py's philosophy and find technical details.
This static blog generator code is under MIT license.

@ -1,28 +0,0 @@
<!-- title: Lorem Ipsum -->
<!-- subtitle: Dolor Sit -->
<h1>Lorem Ipsum</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nibh
tellus, vehicula ut maximus sed, fringilla a justo. Nunc vitae efficitur
nisl. Ut sapien erat, pretium et commodo nec, rutrum bibendum magna. Sed
ut massa massa. Etiam euismod neque lacus, id tincidunt risus iaculis a.
Aliquam porta venenatis bibendum. Nam id varius nulla. Sed vitae purus
ac odio ornare vestibulum vitae tempor arcu. Nunc non venenatis purus.
Duis a augue at nulla congue egestas. Morbi mattis felis sit amet tortor
euismod, fringilla viverra est elementum.
</p>
<p>
Suspendisse vestibulum sed massa eu tincidunt. Pellentesque cursus, nisl
at gravida suscipit, odio quam placerat mi, in iaculis nunc risus eu
sapien. Suspendisse potenti. Nullam fermentum, tellus vel faucibus
dictum, arcu ante rutrum nisi, ut iaculis eros felis a lectus. Etiam vel
maximus nulla, sed mattis lectus. Aliquam commodo est massa, at
vestibulum diam commodo vehicula. Nullam et tristique tortor. Praesent
luctus, leo id mattis mattis, ex dui dapibus dolor, nec ultrices turpis
nibh in sem. In efficitur, velit ut bibendum interdum, libero turpis
mattis odio, non pharetra metus leo nec arcu. Maecenas auctor laoreet
maximus. Donec metus massa, scelerisque a lacinia et, viverra eget
metus. Aenean vitae tellus vehicula, mattis metus in, facilisis purus.
In purus erat, fringilla ut diam et, convallis convallis nunc. Morbi
sagittis interdum ipsum sit amet fringilla.
</p>

@ -1,23 +0,0 @@
<!-- title: About -->
<h1>About</h1>
<p>
Quisque quam nisl, egestas nec convallis vitae, fringilla nec mauris.
Sed et cursus lacus, a pharetra ex. Pellentesque rhoncus malesuada elit
at sodales. In ut elit lectus. Phasellus et hendrerit odio, ac hendrerit
ante. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. Quisque sem nibh, auctor vel dictum
eu, pharetra sit amet nunc. Integer suscipit suscipit dapibus.
Suspendisse vulputate sed mauris eget tempus. Etiam rhoncus, leo nec
cursus elementum, massa lorem fermentum nisi, non convallis nisl dolor
vel ipsum.
</p>
<p>
Aliquam imperdiet vel purus sed facilisis. Mauris condimentum vel nulla
ac tempor. In non venenatis arcu. Nam in sapien purus. Suspendisse
faucibus, erat et fringilla vestibulum, ligula nisi porta odio, ut
tristique dui ante eu nisi. Mauris vitae vulputate lorem. Proin tortor
nisl, vehicula sed justo sed, volutpat bibendum purus. Phasellus luctus
fringilla augue ac sodales. Aenean ac nisi sit amet neque pulvinar
tincidunt ut nec ipsum. Aliquam purus tellus, dignissim a augue
placerat, aliquet semper turpis. Fusce id lacinia quam, vel porta quam.
</p>

@ -1,21 +0,0 @@
<!-- title: Contact -->
<h1>Contact</h1>
<p>
In hac habitasse platea dictumst. Suspendisse purus leo, laoreet ac
scelerisque vitae, gravida vitae turpis. Etiam lacinia justo in pharetra
tincidunt. Donec id mi in elit euismod feugiat. Fusce eget velit nec
nunc fermentum ultrices ut auctor tellus. Suspendisse convallis lacus a
mollis volutpat. Donec maximus eros lorem, non faucibus sapien tristique
a. Proin ut magna eget nunc sagittis sodales ac suscipit dolor.
Vestibulum sit amet velit nunc. Nam euismod fermentum neque ac
facilisis. Phasellus imperdiet arcu a lorem pulvinar accumsan. Sed
maximus neque tristique, sollicitudin risus sed, interdum enim.
</p>
<p>
Curabitur vel augue mattis, blandit libero rhoncus, fringilla augue.
Aenean condimentum ex justo. In hac habitasse platea dictumst. Etiam
ullamcorper finibus enim, nec cursus dui tristique nec. Phasellus et
tortor libero. Vivamus viverra euismod pulvinar. Fusce maximus, ante
quis lobortis facilisis, lectus mi consequat purus, sed vestibulum ipsum
mi sit amet dui.
</p>

@ -0,0 +1,3 @@
<div class="article">
{{ content }}
</div>

@ -51,6 +51,7 @@
<div class="column column-50 column-offset-25 txtright" id="menu-blog">
<a href="/">Blog</a>
<a href="/archives/">Archives</a>
<a href="/notes/">Notes</a>
</div>
</div>

@ -295,6 +295,41 @@ def make_posts(
return sorted(items, key=lambda x: x["date"], reverse=True)
def make_notes(
src, src_pattern, dst, layout, **params
):
"""Generate notes from notes directory."""
items = []
for posix_path in Path(src).glob(src_pattern):
src_path = str(posix_path)
content = read_content(src_path)
# render text / summary for basic fields
content["content"] = render(content["content"], **params)
content["summary"] = render(content["summary"], **params)
page_params = dict(params, **content)
page_params["header"] = ""
page_params["footer"] = ""
page_params["friendly_date"] = ""
page_params["category_label"] = ""
page_params["post_url"] = "notes/" + page_params["slug"] + "/"
content["post_url"] = page_params["post_url"]
content["friendly_date"] = page_params["friendly_date"]
content["category_label"] = page_params["category_label"]
items.append(content)
dst_path = render(dst, **page_params)
output = render(layout, **page_params)
log("Rendering {} => {} ...", src_path, dst_path)
fwrite(dst_path, output)
return sorted(items, key=lambda x: x["date"], reverse=True)
def make_list(
posts, dst, list_layout, item_layout, header_layout, footer_layout, **params
):
@ -374,10 +409,12 @@ def main(param_file):
rss_item_xml = fread("layout/rss_item.xml")
sitemap_xml = fread("layout/sitemap.xml")
sitemap_item_xml = fread("layout/sitemap_item.xml")
note_layout = fread("layout/note.html")
# Combine layouts to form final layouts.
post_layout = render(page_layout, content=post_layout)
list_layout = render(page_layout, content=list_layout)
note_layout = render(page_layout, content=note_layout)
# Create blogs.
blog_posts = make_posts(
@ -503,6 +540,25 @@ def main(param_file):
)
# Create notes.
notes = make_notes(
"notes",
"**/*.md",
"_site/{{ post_url }}/index.html",
note_layout,
**params
)
make_list(
notes,
"_site/notes/index.html",
list_layout,
item_nosummary_layout,
archive_title_layout,
None,
**params
)
# Test parameter to be set temporarily by unit tests.
_test = None

@ -0,0 +1,136 @@
<!-- title: Les commandes de Git -->
# Git
Pousser nouvelle branche :
git push -u origin <nom branche>
Lier branche locale à branche distante :
git branch --set-upstream-to=origin/deployment deployment
Fusion sans fast-forward pour préserver les commits :
git merge --no-ff <source branch>
Créer une nouvelle branche à partir d'un commit :
git checkout <id de commit> && git branch -b <nom de la branche>
Annuler des changements :
# committer l'annulation d'un commit :
git revert <id de commit>
# restaurer l'état d'un fichier par rapport au dernier commit
git checkout -- <chemin du fichier>
# annuler le dernier commit pour un fichier particulier (n° de checkout + ~1 pour reculer d'un commit)
git checkout c5f567~1 -- file1/to/restore
Retrouver les branches qui contiennent un commit :
git branch --contains <id de commit>
Récupérer toutes les branches localement :
# ne pas récupérer les branches supprimées
git fetch --prune
# créer toutes les branches
for BRANCH in $(git branch -a | grep remotes | grep -v HEAD); do git branch --track \"${BRANCH#remotes/origin/}\" \"${BRANCH}\"; done
Rechercher dans toutes les branches :
git grep "the magic string" `git show-ref --heads`
La plupart des commandes peuvent être restreintes à un chemin de fichier :
git stash push -- <filepath(s)>
git diff <id commit 1> <id commit 2> -- <filepath(s)>
La gestion des stash :
# voir le contenu d'un stash (0 est le plus récent)
git stash show -p [stash@{<n>}]
# appliquer un stash sans le supprimer
git stash apply [stash@{<n>}]
Récupérer un fichier d'une autre branche :
git checkout <branch> -- <path(s)>
Travailler sur plusieurs branches à la fois (pour comparer par exemple) :
git worktree add ../my-other-awesome-feature my-other-awesome-feature-branch
git worktree remove ../my-other-awesome-feature
Supprimer une branche distante
git push origin --delete <remote_branch>
Lister les commits manquants sur la branche release par rapport à develop
# depuis branche release
git cherry develop
git log release..develop
# la version one-liner
git log --oneline --graph --decorate --abbrev-commit release..develop
Créer un patch à partir d'une suite de commits consécutifs
git format-patch cc1dde0dd^..6de6d4b06 --stdout > foo.patch
Restaurer un fichier pendant une phase de merge
git checkout -m FILE
Modifier l'historique des auteurs / e-mails avec git-filter-repo
git filter-repo --mailmap my-mailmap
# ficher my-mailmap de la forme :
# Proper Name <proper@email.xx> <commit@email.xx>
Créer un nouveau dépôt à partir de la ligne de commande
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:user/project.git
git push -u origin main
Pousser un dépôt existant depuis la ligne de commande
git remote add origin git@github.com:user/projectgit
git branch -M main
git push -u origin main
Modifier la racine d'un dépôt
On peut modifier la racine pour un répertoire enfant sans perdre l'historique :
- déplacer le répertoire .git vers ce répertoire enfant
- ajouter tous les fichiers modifiés (git add) ce qui renomme les fichiers existants
- committer et pousser
Transformer un id long de commit en id court
git rev-parse --short d40f13c5886a8f44e7653f68829dd094045a5499
# GitHub
Générer un Personal Access Token pour les accès HTTPS
git config --global credential.https://github.com.helper cache
git credential approve <<EOF
protocol=https
host=github.com
username=$GITHUB_USERNAME
password=$GITHUB_TOKEN
EOF

59
poetry.lock generated

@ -1,18 +1,18 @@
[[package]]
name = "certifi"
version = "2021.10.8"
version = "2022.6.15"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
python-versions = "*"
python-versions = ">=3.6"
[[package]]
name = "charset-normalizer"
version = "2.0.12"
version = "2.1.0"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "main"
optional = false
python-versions = ">=3.5.0"
python-versions = ">=3.6.0"
[package.extras]
unicode_backport = ["unicodedata2"]
@ -35,57 +35,51 @@ python-versions = "*"
[[package]]
name = "pygments"
version = "2.11.2"
version = "2.12.0"
description = "Pygments is a syntax highlighting package written in Python."
category = "main"
optional = false
python-versions = ">=3.5"
python-versions = ">=3.6"
[[package]]
name = "requests"
version = "2.27.1"
version = "2.28.1"
description = "Python HTTP for Humans."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
python-versions = ">=3.7, <4"
[package.dependencies]
certifi = ">=2017.4.17"
charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""}
idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""}
charset-normalizer = ">=2,<3"
idna = ">=2.5,<4"
urllib3 = ">=1.21.1,<1.27"
[package.extras]
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"]
[[package]]
name = "urllib3"
version = "1.26.8"
version = "1.26.10"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"]
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[metadata]
lock-version = "1.1"
python-versions = "^3.9"
content-hash = "b3549c90bfc38d7a2afe0ca851eb4476175964767e68c6d101067b7e0dd3e92c"
python-versions = "^3.8"
content-hash = "77e6f4dcedb219aa6f4d4ab99393659aad46c1a2612778c23a96f665bc027389"
[metadata.files]
certifi = [
{file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"},
{file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"},
]
charset-normalizer = [
{file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"},
{file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"},
]
certifi = []
charset-normalizer = []
idna = [
{file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"},
{file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"},
@ -94,15 +88,6 @@ mistune = [
{file = "mistune-0.8.4-py2.py3-none-any.whl", hash = "sha256:88a1051873018da288eee8538d476dffe1262495144b33ecb586c4ab266bb8d4"},
{file = "mistune-0.8.4.tar.gz", hash = "sha256:59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e"},
]
pygments = [
{file = "Pygments-2.11.2-py3-none-any.whl", hash = "sha256:44238f1b60a76d78fc8ca0528ee429702aae011c265fe6a8dd8b63049ae41c65"},
{file = "Pygments-2.11.2.tar.gz", hash = "sha256:4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a"},
]
requests = [
{file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"},
{file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"},
]
urllib3 = [
{file = "urllib3-1.26.8-py2.py3-none-any.whl", hash = "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed"},
{file = "urllib3-1.26.8.tar.gz", hash = "sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c"},
]
pygments = []
requests = []
urllib3 = []

Loading…
Cancel
Save