summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actualités.sh1
-rwxr-xr-xbuild-member.sh8
-rwxr-xr-xbuild-programs.py22
-rwxr-xr-xbuild.sh9
-rw-r--r--contact.sh1
-rw-r--r--en/contact.sh1
-rw-r--r--en/gallery.sh1
-rw-r--r--en/index.sh1
-rw-r--r--en/news.sh1
-rw-r--r--en/programs.sh9
-rw-r--r--en/quartet.html8
-rw-r--r--en/quartet.sh1
-rw-r--r--en/template.html8
-rw-r--r--galerie.sh1
-rw-r--r--index.sh1
-rw-r--r--programmes.sh9
-rw-r--r--quatuor.sh1
-rw-r--r--template.html4
18 files changed, 62 insertions, 25 deletions
diff --git a/actualités.sh b/actualités.sh
index f18f1e1..a10cf40 100644
--- a/actualités.sh
+++ b/actualités.sh
@@ -1,3 +1,4 @@
title=Actualités
stylesheets=actualités
transforms=("$(transform-li-current-a actualités)")
+translation=news
diff --git a/build-member.sh b/build-member.sh
index d19c835..95e25b6 100755
--- a/build-member.sh
+++ b/build-member.sh
@@ -16,13 +16,15 @@ firstname ()
generate-parameters ()
{
read fullname
+ local -r firstname=$(firstname "${fullname}")
cat <<EOF
title='${fullname}'
stylesheets=(membre)
transforms=("\$(transform-li-dropdown-current-a quatuor)"
"\$(transform-li-current-a quatuor)"
- "\$(transform-li-current-a $(firstname "${fullname}"))")
+ "\$(transform-li-current-a ${firstname})")
+translation=${firstname}
EOF
}
@@ -64,9 +66,11 @@ EOF
EOF
done
+ imgdir=$(realpath --relative-to $(dirname "${template}") images)
+
cat <<EOF
</div>
- <img src="images/${name}/portrait.png" style="background-image: url(images/${name}/bg.jpg)">
+ <img src="${imgdir}/${name}/portrait.png" style="background-image: url(${imgdir}/${name}/bg.jpg)">
</main>
EOF
}
diff --git a/build-programs.py b/build-programs.py
index 69c7057..40398d8 100755
--- a/build-programs.py
+++ b/build-programs.py
@@ -1,8 +1,11 @@
#!/usr/bin/env python3
import html
+from os import path
+from pathlib import Path
import re
from subprocess import run
+from sys import argv
PROGRAM_RE = re.compile('\n'.join((
@@ -24,8 +27,8 @@ BLOCK_TEMPLATE = '''\
<summary>
<div class="name">{name}</div>
<div class="composers">{composers}</div>
- <img class="button open" src="images/chevron-down.svg">
- <img class="button close" src="images/chevron-up.svg">
+ <img class="button open" src="{imgdir}/chevron-down.svg">
+ <img class="button close" src="{imgdir}/chevron-up.svg">
</summary>
{description}
<ol class="pieces">
@@ -53,10 +56,17 @@ def print_program(info):
print(BLOCK_TEMPLATE.format_map(info))
-def main():
- for p in read_programs('programs.in'):
- print_program(p.groupdict())
+def main(programs_src):
+ # pathlib.Path(x).relative_to(y) cannot handle y not being under x,
+ # os.path.relpath('x') yields '' rather than '.'.
+ # 😮‍💨
+ imgdir = path.relpath('images', Path(programs_src).parent)
+
+ for p in read_programs(programs_src):
+ info = p.groupdict()
+ info['imgdir'] = imgdir
+ print_program(info)
if __name__ == '__main__':
- main()
+ main(argv[1])
diff --git a/build.sh b/build.sh
index a9035f3..583bda0 100755
--- a/build.sh
+++ b/build.sh
@@ -32,13 +32,20 @@ sed -i s/'{TITLE}'/"${title}"/ ${output}
link_stylesheets=''
for s in "${stylesheets[@]}"
do
- spath=$(realpath --relative-to $(dirname "${input}") stylesheets/"${s}".css)
+ # Prefer relative paths so that drafts under /admin/drafts find
+ # the correct stylesheets.
+ # ${input} might be a temporary file; assume ${template} is a
+ # bona-fide node in our directory hierarchy, and use that to
+ # compute the path to the stylesheets folder.
+ spath=$(realpath --relative-to $(dirname "${template}") stylesheets/"${s}".css)
link_template='<link rel="stylesheet" href="%s">\n'
link_stylesheets+=$(printf "${link_template}" "${spath}")
done
sed -i /'{STYLESHEETS}'/'c\'"${link_stylesheets}" ${output}
+sed -i s/'{TRANSLATION}'/"${translation}"/ ${output}
+
for transform in "${transforms[@]}"
do
sed -i "${transform}" ${output}
diff --git a/contact.sh b/contact.sh
index 6a7a40c..82eba6c 100644
--- a/contact.sh
+++ b/contact.sh
@@ -2,3 +2,4 @@ title=Contact
stylesheets=(contact)
transforms=('s/class="contact"/class="contact current"/' # Desktop.
"$(transform-li-current-a contact)") # Mobile.
+translation=contact
diff --git a/en/contact.sh b/en/contact.sh
index 6a7a40c..82eba6c 100644
--- a/en/contact.sh
+++ b/en/contact.sh
@@ -2,3 +2,4 @@ title=Contact
stylesheets=(contact)
transforms=('s/class="contact"/class="contact current"/' # Desktop.
"$(transform-li-current-a contact)") # Mobile.
+translation=contact
diff --git a/en/gallery.sh b/en/gallery.sh
index 04b5a5e..6a46fae 100644
--- a/en/gallery.sh
+++ b/en/gallery.sh
@@ -1,3 +1,4 @@
title=Gallery
stylesheets=galerie
transforms=("$(transform-li-current-a gallery)")
+translation=galerie
diff --git a/en/index.sh b/en/index.sh
index 934a371..d0bf618 100644
--- a/en/index.sh
+++ b/en/index.sh
@@ -1,2 +1,3 @@
title=Welcome
stylesheets=(index dark)
+translation=index
diff --git a/en/news.sh b/en/news.sh
index 08b6528..b52b3fa 100644
--- a/en/news.sh
+++ b/en/news.sh
@@ -1,3 +1,4 @@
title=News
stylesheets=actualités
transforms=("$(transform-li-current-a news)")
+translation=actualités
diff --git a/en/programs.sh b/en/programs.sh
index 3f90fb5..57f590d 100644
--- a/en/programs.sh
+++ b/en/programs.sh
@@ -1,8 +1,10 @@
add-programs ()
{
- sed -i \
- -e /'{PROGRAMS}'/'r '<(./build-programs.py) \
- -e /'{PROGRAMS}'/'c\' \
+ local programs_src=$(dirname "${input}")/programs.in
+
+ sed -i \
+ -e /'{PROGRAMS}'/'r '<(./build-programs.py "${programs_src}") \
+ -e /'{PROGRAMS}'/'c\' \
$1
}
@@ -10,3 +12,4 @@ title=Programs
stylesheets=programmes
transforms=("$(transform-li-current-a programs)")
postprocess=add-programs
+translation=programmes
diff --git a/en/quartet.html b/en/quartet.html
index bc432f0..5d31b58 100644
--- a/en/quartet.html
+++ b/en/quartet.html
@@ -1,22 +1,22 @@
<main>
<div id="photos">
<a class="member" href="sophie.html">
- <img class="portrait" src="images/sophie/full.png">
+ <img class="portrait" src="../images/sophie/full.png">
<p class="name">Sophie Guille des Buttes</p>
<p class="instrument">violon</p>
</a>
<a class="member" href="david.html">
- <img class="portrait" src="images/david/full.png">
+ <img class="portrait" src="../images/david/full.png">
<p class="name">David Forest</p>
<p class="instrument">violon</p>
</a>
<a class="member" href="hervé.html">
- <img class="portrait" src="images/hervé/full.png">
+ <img class="portrait" src="../images/hervé/full.png">
<p class="name">Hervé Blandinières</p>
<p class="instrument">alto</p>
</a>
<a class="member" href="enguerrand.html">
- <img class="portrait" src="images/enguerrand/full.png">
+ <img class="portrait" src="../images/enguerrand/full.png">
<p class="name">Enguerrand Bontoux</p>
<p class="instrument">violoncelle</p>
</a>
diff --git a/en/quartet.sh b/en/quartet.sh
index 48d83b5..c0f7762 100644
--- a/en/quartet.sh
+++ b/en/quartet.sh
@@ -11,3 +11,4 @@ stylesheets=quatuor
transforms=("$(transform-li-dropdown-current-a quartet)" # Desktop.
"$(transform-li-current-a quartet)") # Mobile.
postprocess=add-bio
+translation=quatuor
diff --git a/en/template.html b/en/template.html
index 16d80e0..402b4fd 100644
--- a/en/template.html
+++ b/en/template.html
@@ -25,8 +25,8 @@
<h1>Bellefeuille Quartet</h1>
</a>
</header>
- <a class="lang" href="{FR}">
- EN
+ <a class="lang" href="../{TRANSLATION}.html">
+ FR
</a>
<nav class="menu">
<ol>
@@ -98,8 +98,8 @@
{MAIN}
<footer class="social">
- <a class="lang" href="">
- EN
+ <a class="lang" href="../{TRANSLATION}.html">
+ FR
</a>
<a href="https://www.facebook.com/quatuorbellefeuille/"
target="_blank" rel="noreferrer noopener">
diff --git a/galerie.sh b/galerie.sh
index a2ace2b..da2def9 100644
--- a/galerie.sh
+++ b/galerie.sh
@@ -1,3 +1,4 @@
title=Galerie
stylesheets=galerie
transforms=("$(transform-li-current-a galerie)")
+translation=gallery
diff --git a/index.sh b/index.sh
index 2504318..cae96e8 100644
--- a/index.sh
+++ b/index.sh
@@ -1,2 +1,3 @@
title=Bienvenue
stylesheets=(index dark)
+translation=index
diff --git a/programmes.sh b/programmes.sh
index f03a636..d8a410a 100644
--- a/programmes.sh
+++ b/programmes.sh
@@ -1,8 +1,10 @@
add-programs ()
{
- sed -i \
- -e /'{PROGRAMS}'/'r '<(./build-programs.py) \
- -e /'{PROGRAMS}'/'c\' \
+ local programs_src=$(dirname "${input}")/programs.in
+
+ sed -i \
+ -e /'{PROGRAMS}'/'r '<(./build-programs.py "${programs_src}") \
+ -e /'{PROGRAMS}'/'c\' \
$1
}
@@ -10,3 +12,4 @@ title=Programmes
stylesheets=programmes
transforms=("$(transform-li-current-a programmes)")
postprocess=add-programs
+translation=programs
diff --git a/quatuor.sh b/quatuor.sh
index 7bb0e3f..d359d8d 100644
--- a/quatuor.sh
+++ b/quatuor.sh
@@ -11,3 +11,4 @@ stylesheets=quatuor
transforms=("$(transform-li-dropdown-current-a quatuor)" # Desktop.
"$(transform-li-current-a quatuor)") # Mobile.
postprocess=add-bio
+translation=quartet
diff --git a/template.html b/template.html
index d6c3581..ca3b203 100644
--- a/template.html
+++ b/template.html
@@ -25,7 +25,7 @@
<h1>Quatuor Bellefeuille</h1>
</a>
</header>
- <a class="lang" href="{EN}">
+ <a class="lang" href="en/{TRANSLATION}.html">
EN
</a>
<nav class="menu">
@@ -98,7 +98,7 @@
{MAIN}
<footer class="social">
- <a class="lang" href="">
+ <a class="lang" href="en/{TRANSLATION}.html">
EN
</a>
<a href="https://www.facebook.com/quatuorbellefeuille/"