summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 51 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 1db569a..cfce620 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,10 @@ BASE_HTML=tmp/left.htm tmp/headers.htm
ALL_ARTICLES=$(wildcard articles/*.md)
ALL_ARTICLES_OUT=$(ALL_ARTICLES:.md=.html)
ALL_ARTICLES_INTRO_OUT=$(addprefix articles/tmp/,$(shell cat articles_intro_out))
+ALL_NOTES_OUT=$(addprefix notes/,$(shell cat notes/notes_out))
+ALL_NOTES_TMP=$(addprefix notes/tmp/,$(shell cat notes/notes_out))
+ALL_NOTES_TMP_OUT=$(ALL_NOTES_TMP:.html=.hml)
+ALL_NOTES_CARDS_OUT=$(ALL_NOTES_TMP:.html=_card.htm)
SCRIPT_JS=s/js/main.js
SHEET_CSS=s/css/style.css
@@ -16,10 +20,9 @@ SHEET_CSS=s/css/style.css
# Les bases en premiers
# Puis les articles
# Et enfin index (qui possède une liste des introductions des articles)
-all: $(ALL_ARTICLES_OUT) $(BASE_HTML) index.html contact/index.html $(SHEET_CSS) $(SCRIPT_JS)
+all: $(ALL_ARTICLES_OUT) $(BASE_HTML) index.html contact/index.html $(SHEET_CSS) $(SCRIPT_JS) $(ALL_NOTES_OUT) notes/index.html
.PHONY: all
-
# > Création des articles depuis le markdown
# On compile le fichier md vers html (tmp/%.htm)
# On rajoute les headers (tmp/%_header.htm)
@@ -50,6 +53,52 @@ tmp/articles.htm: $(ALL_ARTICLES_INTRO_OUT) articles_intro_out
mkdir -p tmp
cat $(ALL_ARTICLES_INTRO_OUT) > $@
+#####################################################################
+#### NOTES
+#####################################################################
+
+notes/index.html: notes/tmp/index.htm notes/tmp/notes_cards.htm
+# On rajoute les headers (tmp/%_header.htm)
+# On fini d'ajouter le squelette HTML (notes/%.html
+notes/%.html: notes/tmp/%.htm notes/tmp/notes_cards.htm
+ @echo "> Création des notes ($@)"
+ m4 -D tmpFileNameNote=$(addprefix notes/tmp/,$(notdir $(@:.html=.htm))) -D linkFileNameNote=$(<:.md=) -D HEADER_HEADER=$(addprefix notes/tmp/,$(notdir $(basename $@)_header.htm)) -D CANONIC="https://ache.one/$@" notes/note.m4 | $(HTML_MINIFIER_CMD) > $@
+
+notes/tmp/%.htm: notes/%.md
+ @echo
+ @echo "# Compile temporaire de la note $@"
+ mkdir -p notes/tmp
+ cat $< | $(MD_CMD) > $@
+
+# > Création des notes depuis le markdown
+# On compile le fichier md vers html (tmp/%.htm)
+# On rajoute les headers (tmp/%_header.htm)
+# On fini d'ajouter le squelette HTML (notes/%.html
+notes/%.html: notes/tmp/%.htm notes/tmp/notes_cards.htm
+ @echo "> Création des notes ($@)"
+ m4 -D TITLE_TITLE="`echo Licornes, hérissons et renards`" headers.m4 > $(addprefix notes/tmp/,$(notdir $(basename $@)_header.htm))
+ m4 -D tmpFileNameNote=$(addprefix notes/tmp/,$(notdir $(@:.html=.htm))) -D linkFileNameNote=$(<:.md=) -D HEADER_HEADER=$(addprefix notes/tmp/,$(notdir $(basename $@)_header.htm)) -D CANONIC="https://ache.one/$@" notes/note.m4 | $(HTML_MINIFIER_CMD) > $@
+
+# > Création de la liste des notes (format cartes)
+# On assemble juste les cartes de notes ensemble
+notes/tmp/notes_cards.htm: $(ALL_NOTES_CARDS_OUT)
+ @echo "> Création de la liste des cartes de notes"
+ mkdir -p tmp
+ cat $(ALL_NOTES_CARDS_OUT) > $@
+
+# > Création des cartes de chaque note
+notes/tmp/%_card.htm: notes/tmp/%.htm notes/notes_out
+ @echo "> Création de carte de note : $@ (need $<)"
+ mkdir -p tmp
+ cat $< | $(CATCH_CMD) "h1" > $@.tmp
+ cat $< | $(CATCH_CMD) "p:last-child" | sed 's/res\//notes\/res\//' >> $@.tmp
+ m4 -D tmpCard=$@.tmp notes/card.m4 > $@
+
+
+
+####################################################################
+### MAIN PAGE
+####################################################################
# > Création de la page principale
# On se sert du menu de gauche, du header, et de la liste des introductions