diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-12-30 19:20:36 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-12-30 19:20:36 +0100 |
| commit | 8170b6616c13828b434e0103b362ca0e056309d0 (patch) | |
| tree | d7c8367ffc38c507a7cec22327a5e62a19ce5ae9 | |
| parent | 74a28fd0f2ccab43a51430dd29093053f9e366ea (diff) | |
| download | quatuorbellefeuille.com-8170b6616c13828b434e0103b362ca0e056309d0.tar.xz | |
Add template machinery
*Of course* it's going to be an ugly Bash script. Is there anything
else?
| -rw-r--r-- | Makefile | 16 | ||||
| -rwxr-xr-x | build.sh | 34 | ||||
| -rw-r--r-- | contact.html | 128 | ||||
| -rw-r--r-- | contact.sh | 3 | ||||
| -rw-r--r-- | template.html | 64 |
5 files changed, 146 insertions, 99 deletions
@@ -1,21 +1,27 @@ -pages = $(wildcard *.html) +pages_src = $(wildcard *.html) +pages = $(foreach p,$(pages_src),public/$(p)) + sheets = $(wildcard *.css) images = $(wildcard *.svg) feeds = $(wildcard *.xml) -resources = $(pages) $(sheets) $(images) $(feeds) -targets = $(foreach f,$(resources),public/$(f)) +resources_src = $(sheets) $(images) $(feeds) +resources = $(foreach f,$(resources_src),public/$(f)) + .PHONY: all clean site all: site -site: $(targets) +site: $(pages) $(resources) public: mkdir $@ -$(targets): public/%: % | public +$(resources): public/%: % | public cp $< $@ +$(pages): public/%.html: %.html | public + ./build.sh $< $@ + clean: rm -r public diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..62487bd --- /dev/null +++ b/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eu + +input=$1 +output=$2 + +parameters=${input/%.html/.sh} + +if ! test -f ${parameters} +then + cp ${input} ${output} + exit +fi + +cp template.html ${output} +. ${parameters} + +sed -i s/'{TITLE}'/"${title}"/ ${output} + +link_stylesheets='' +for s in "${stylesheets[@]}" +do + link_stylesheets+=$(printf '<link rel="stylesheet" href="%s.css">\n' "${s}") +done + +sed -i /'{STYLESHEETS}'/'c\'"${link_stylesheets}" ${output} + +if test "${current_div}" +then + sed -i s"${current_div}" ${output} +fi + +sed -i -e /'{MAIN}'/"r ${input}" -e /'{MAIN}'/'c\' ${output} diff --git a/contact.html b/contact.html index 8983d7f..cf849a0 100644 --- a/contact.html +++ b/contact.html @@ -1,94 +1,34 @@ -<!DOCTYPE html> -<html lang="fr"> - <head> - <meta charset="utf-8"> - <title>Contact - Quatuor Camelot</title> - <link rel="stylesheet" href="commun.css"> - <link rel="stylesheet" href="contact.css"> - <link rel="alternate" type="application/rss+xml" href="feed.xml"> - </head> - <body> - <header class="banner"> - - <div class="brand"> - <a href="index.html"> - <img src="https://upload.wikimedia.org/wikipedia/en/a/a4/Golden_Sun_icon.png" - alt="logo"> - <h1 class="qname">Quatuor Camelot</h1> - </a> - </div> - - <nav> - <ol> - <li class="dropdown"> - <a href="quatuor.html">Le quatuor</a> - <ul> - <li><a href="vlad.html"><img src="https://static.wikia.nocookie.net/goldensun/images/8/87/Isaac2.gif">Vlad</a></li> - <li><a href="garet.html"><img src="https://static.wikia.nocookie.net/goldensun/images/3/3e/Garet_icon.gif">Garet</a></li> - <li><a href="ivan.html"><img src="https://static.wikia.nocookie.net/goldensun/images/3/3d/Ivan_platinum.gif">Ivan</a></li> - <li><a href="sofia.html"><img src="https://static.wikia.nocookie.net/goldensun/images/4/43/Mia.gif">Sofia</a></li> - </ul> - </li> - <li><a href="actualités.html">Actualités</a></li> - <li><a href="programmes.html">Programmes</a></li> - <li><a href="gallerie.html">Gallerie</a></li> - </ol> - </nav> - - <div class="lang"> - EN - </div> - - </header> - - <main> - <div id="contact-us"> - <h1>Contact</h1> - <p>Nos coordonnées :</p> - <dl> - <dt>Email : - <dd><a href="mailto:contact@example.com">contact@example.com</a></dd> - </dt> - <dt>Téléphone : - <dd><a href="tel:+33-01-99-00-01-02">01 99 00 01 02</a></dd> - </dt> - </dl> - <p> - Tenez-vous au courant des actualités du - quatuor <a href="feed.xml">en vous abonnant à notre - flux.</a> - </p> - </div> - <div id="partners"> - <h1>Partenaires</h1> - <p> - Nous offrons nos plus sincères remerciements aux personnes à - qui nous avons emprunté des images, vidéos et musiques : - - <ul> - <li><a href="https://goldensun-world.com/home">Golden Sun World</a></li> - <li><a href="https://old.reddit.com/r/GoldenSun/comments/hmb56u/the_restoration_that_took_2_weeks_and_all_my/">Isaac730</a></li> - <li><a href="https://www.youtube.com/playlist?list=PLA874B3EAA867625C">A. K.-O.</a></li> - <li><a href="https://downloads.khinsider.com/">Kingdom Hearts Insider</a></li> - <li><a href="https://wikipedia.org">Wikipédia</a></li> - <li>Et bien sûr, <a href="https://fr.wikipedia.org/wiki/Camelot_Software_Planning">le studio Camelot</a></li> - </ul> - </div> - </main> - - <footer class="social"> - <img src="https://upload.wikimedia.org/wikipedia/en/9/9f/Twitter_bird_logo_2012.svg"> - <img src="https://upload.wikimedia.org/wikipedia/commons/c/c2/F_icon.svg"> - <a href="feed.xml"> - <img src="https://upload.wikimedia.org/wikipedia/en/4/43/Feed-icon.svg"> - </a> - <p class="contact current"> - <a href="contact.html">Contact</a> - </p> - </footer> - - <footer class="legal"> - <p>Mentions légales - Plan du site</p> - </footer> - </body> -</html> +<main> + <div id="contact-us"> + <h1>Contact</h1> + <p>Nos coordonnées :</p> + <dl> + <dt>Email : + <dd><a href="mailto:contact@example.com">contact@example.com</a></dd> + </dt> + <dt>Téléphone : + <dd><a href="tel:+33-01-99-00-01-02">01 99 00 01 02</a></dd> + </dt> + </dl> + <p> + Tenez-vous au courant des actualités du + quatuor <a href="feed.xml">en vous abonnant à notre + flux.</a> + </p> + </div> + <div id="partners"> + <h1>Partenaires</h1> + <p> + Nous offrons nos plus sincères remerciements aux personnes à + qui nous avons emprunté des images, vidéos et musiques : + + <ul> + <li><a href="https://goldensun-world.com/home">Golden Sun World</a></li> + <li><a href="https://old.reddit.com/r/GoldenSun/comments/hmb56u/the_restoration_that_took_2_weeks_and_all_my/">Isaac730</a></li> + <li><a href="https://www.youtube.com/playlist?list=PLA874B3EAA867625C">A. K.-O.</a></li> + <li><a href="https://downloads.khinsider.com/">Kingdom Hearts Insider</a></li> + <li><a href="https://wikipedia.org">Wikipédia</a></li> + <li>Et bien sûr, <a href="https://fr.wikipedia.org/wiki/Camelot_Software_Planning">le studio Camelot</a></li> + </ul> + </div> +</main> diff --git a/contact.sh b/contact.sh new file mode 100644 index 0000000..e8a08b6 --- /dev/null +++ b/contact.sh @@ -0,0 +1,3 @@ +title=Contact +stylesheets=(contact) +current_div='/class="contact"/class="contact current"/' diff --git a/template.html b/template.html new file mode 100644 index 0000000..bfb1550 --- /dev/null +++ b/template.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<html lang="fr"> + <head> + <meta charset="utf-8"> + <title>{TITLE} - Quatuor Camelot</title> + <link rel="stylesheet" href="commun.css"> +{STYLESHEETS} + <link rel="alternate" type="application/rss+xml" href="feed.xml"> + </head> + <body> + <header class="banner"> + + <div class="brand"> + <a href="index.html"> + <img src="https://upload.wikimedia.org/wikipedia/en/a/a4/Golden_Sun_icon.png" + alt="logo"> + <h1 class="qname">Quatuor Camelot</h1> + </a> + </div> + + <nav> + <ol> + <li class="dropdown"> + <a href="quatuor.html">Le quatuor</a> + <ul> + <li><a href="vlad.html"><img src="https://static.wikia.nocookie.net/goldensun/images/8/87/Isaac2.gif">Vlad</a></li> + <li><a href="garet.html"><img src="https://static.wikia.nocookie.net/goldensun/images/3/3e/Garet_icon.gif">Garet</a></li> + <li><a href="ivan.html"><img src="https://static.wikia.nocookie.net/goldensun/images/3/3d/Ivan_platinum.gif">Ivan</a></li> + <li><a href="sofia.html"><img src="https://static.wikia.nocookie.net/goldensun/images/4/43/Mia.gif">Sofia</a></li> + </ul> + </li> + <li><a href="actualités.html">Actualités</a></li> + <li><a href="programmes.html">Programmes</a></li> + <li><a href="gallerie.html">Gallerie</a></li> + </ol> + </nav> + + <div class="lang"> + EN + </div> + + </header> + +{MAIN} + + <footer class="social"> + <img src="https://upload.wikimedia.org/wikipedia/en/9/9f/Twitter_bird_logo_2012.svg"> + <img src="https://upload.wikimedia.org/wikipedia/commons/c/c2/F_icon.svg"> + <a href="feed.xml"> + <img src="https://upload.wikimedia.org/wikipedia/en/4/43/Feed-icon.svg"> + </a> + <p class="contact"> + <a href="contact.html">Contact</a> + </p> + </footer> + + <footer class="legal"> + <p> + Mentions légales (<a href="https://feathericons.com">icônes</a>) + - Plan du site + </p> + </footer> + </body> +</html> |
