all repos — h3rald @ f69f731e99fc49c0b08fe7cbfcfd722c76fd923a

The sources of https://h3rald.com

Grimoire.
h3rald h3rald@h3rald.com
Sat, 24 Feb 2024 13:51:56 +0100
commit

f69f731e99fc49c0b08fe7cbfcfd722c76fd923a

parent

1952229d90556d8e1d8bda6cc821229872dcfd62

5 files changed, 129 insertions(+), 8 deletions(-)

jump to
D contents/grimoire.md

@@ -1,7 +0,0 @@

------ -id: grimoire -title: Grimoire -content-type: page ------ - -_Coming soon!_
A contents/grimoire/change-git-author.md

@@ -0,0 +1,28 @@

+----- +id: change-git-author +title: "Change the author of git commits" +subtitle: "How to rewrite git history to fix author names and emails" +content-type: spell +----- + +A simple bash script to change the author of existing git commits, by searching for a specific email address. + +```bash +#!/bin/sh + +git filter-branch --env-filter ' +OLD_EMAIL="ENTER OLD EMAIL HERE" +CORRECT_NAME="ENTER NAME HERE" +CORRECT_EMAIL="ENTER EMAIL HERE" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] +then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] +then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi +' --tag-name-filter cat -- --branches --tags +```
M rules.minrules.min

@@ -4,10 +4,11 @@ {} :ARCHIVES

() :ARTICLES {} :HOME () :PROJECTS +() :SPELLS "contents/articles" ls size :articles-count 17 :projects-count -0 :grimoire-count +"contents/grimoire" ls size :grimoire-count ( symbol to-date

@@ -65,6 +66,28 @@ output-fwrite

) ) :: ;; Create the Projects page + +( + symbol create-grimoire-page + (==>) + ( + {} + "grimoire/index" %id + "grimoire.html" %path + ".html" %ext + "GRIMOIRE" %title + "page" %content-type + SPELLS (/id swap /id <) sort %spells + projects-count %projects-count + articles-count %articles-count + grimoire-count %grimoire-count + dup "grimoire" swap mustache :page + "grimoire" page process-icons + %contents + output-fwrite + ) +) :: +;; Create the Grimoire page ( symbol process-timestamp

@@ -296,6 +319,7 @@ (((content 'draft dhas? not) (content 'content-type dhas?)) &&)

( content /id :id (content /content-type "project" ==) (content PROJECTS append @PROJECTS) when + (content /content-type "spell" ==) (content SPELLS append @SPELLS) when content projects-count %projects-count articles-count %articles-count

@@ -309,6 +333,7 @@ ) foreach

; Create aggregator pages create-projects-page + create-grimoire-page create-articles-page ; Generate home page
A scripts/spell.min

@@ -0,0 +1,41 @@

+;Generates a new spell page. +"" :ident +"" :title +"" :subtitle +false :valid-id + +( + (str) expect first :ident + ident "^[a-z0-9-]+$" match? :valid-regexp + (. "contents" "grimoire") => "/" join ls :filelist + filelist (filename "(.+)\..+$" search 1 get) map ident in? not :valid-file + valid-regexp valid-file and +) ^validate + +(valid-id not) ( + "ID" ask @ident + ident validate @valid-id + (valid-id not) + ("ID must not be already used and it must contain only lowercase letters, numbers, or -" warn) + when +) while + +"Title" ask @title +"Subtitle" ask @subtitle + +"----- +id: $1 +title: \"$2\" +subtitle: \"$3\" +content-type: spell +----- + +" (ident title subtitle) =% :metadata + +("Cast spell?" confirm) + ( + (ident ".md") => "" join :fn + (. "contents" "grimoire" fn) => "/" join :path + metadata path fwrite + ) +when
A templates/grimoire.mustache

@@ -0,0 +1,34 @@

+<!DOCTYPE html> +<html lang="en"> + {{> _head}} + <body> + {{> _theme_switcher}} + <div class="main container-fluid themed-content"> + <div class="row"> + <div class="col-xs-12 sidebar"> + {{> _header}} + </div> + </div> + <div class="row main-content"> + <div class="col-xs-12"> + <article class="{{content-type}} box content"> + {{> _page_header}} + <p>This is the old grimoire of Herald. It contains <strong>{{grimoire-count}}</strong> powerful spells and enchantments to unlock the secret magic of Unix or the dark curses of Windows.</p> + <div id="body-text" class="hyphenate"> + <ul> + {{#spells}} + <li><a href="{{id}}">{{title}}</a></li> + {{/spells}} + </ul> + </div> + </article> + </div> + </div> + <div class="row"> + <div class="col-xs-12"> + {{> _footer}} + </div> + </div> + </div> + </body> +</html>