From 8c1256185ee44b1c4abbccfd8b0bfc92e119e688 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Wed, 30 Dec 2020 20:57:15 +0100 Subject: Refactor "current" class addition Will make it easier to add them up for individual members. --- "actualit\303\251s.sh" | 5 +---- build.sh | 24 ++++++++++++++++++++---- contact.sh | 2 +- gallerie.sh | 5 +---- programmes.sh | 5 +---- quatuor.sh | 5 +---- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git "a/actualit\303\251s.sh" "b/actualit\303\251s.sh" index 6e037f3..f18f1e1 100644 --- "a/actualit\303\251s.sh" +++ "b/actualit\303\251s.sh" @@ -1,6 +1,3 @@ title=Actualités stylesheets=actualités - -old='
  • ' -new='
  • ' -current_div=",${old},${new}," +transforms=("$(transform-li-current-a actualités)") diff --git a/build.sh b/build.sh index fe0d551..077d609 100755 --- a/build.sh +++ b/build.sh @@ -14,6 +14,22 @@ then fi cp template.html ${output} + +transform-li-current-a () +{ + local old="
  • " + local new="
  • " + echo "s/${old}/${new}/" +} + +transform-li-dropdown-current-a () +{ + local old="
  • " + local new="
  • " + echo "s/${old}/${new}/" +} + +transforms=() . ${parameters} sed -i s/'{TITLE}'/"${title}"/ ${output} @@ -26,9 +42,9 @@ done sed -i /'{STYLESHEETS}'/'c\'"${link_stylesheets}" ${output} -if test "${current_div:-}" -then - sed -i s"${current_div}" ${output} -fi +for transform in "${transforms[@]}" +do + sed -i "${transform}" ${output} +done sed -i -e /'{MAIN}'/"r ${input}" -e /'{MAIN}'/'c\' ${output} diff --git a/contact.sh b/contact.sh index e8a08b6..b1e34e3 100644 --- a/contact.sh +++ b/contact.sh @@ -1,3 +1,3 @@ title=Contact stylesheets=(contact) -current_div='/class="contact"/class="contact current"/' +transforms=('s/class="contact"/class="contact current"/') diff --git a/gallerie.sh b/gallerie.sh index 5c39199..b52ee27 100644 --- a/gallerie.sh +++ b/gallerie.sh @@ -1,6 +1,3 @@ title=Gallerie stylesheets=gallerie - -old='
  • ' -new='
  • ' -current_div=",${old},${new}," +transforms=("$(transform-li-current-a gallerie)") diff --git a/programmes.sh b/programmes.sh index 2a3486d..9c8d9e7 100644 --- a/programmes.sh +++ b/programmes.sh @@ -1,6 +1,3 @@ title=Programmes stylesheets=programmes - -old='
  • ' -new='
  • ' -current_div=",${old},${new}," +transforms=("$(transform-li-current-a programmes)") diff --git a/quatuor.sh b/quatuor.sh index 46985dd..de450c3 100644 --- a/quatuor.sh +++ b/quatuor.sh @@ -1,6 +1,3 @@ title=Biographie stylesheets=quatuor - -old='