From 1843748eb6326bfc891c07e8ff7781974e4bede4 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 11 Jun 2024 15:49:21 +0200 Subject: [PATCH 1/3] [web] Added optional paramater to dataFile-shortcode to get version comp --- web/layouts/shortcodes/dataFile.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/layouts/shortcodes/dataFile.html b/web/layouts/shortcodes/dataFile.html index d47c61c71a2..23e7a3a4596 100644 --- a/web/layouts/shortcodes/dataFile.html +++ b/web/layouts/shortcodes/dataFile.html @@ -2,7 +2,14 @@ {{- $map := split . "." }} {{- $url := index $.Site.Data $map -}} {{- if $url -}} -{{- $url -}} + {# Second parameter allows to get a version component, starting with index 1 #} + {{- with $.Get 1 -}} + {# Start with index 1, subtract 1 to get zero-based index #} + {{- $index := math.Sub . 1 -}} + {{- $version_comps := split $url "." -}} + {{- $url = index $version_comps $index -}} + {{- end -}} + {{- $url -}} {{- else -}} {{- errorf "No data for key %s" . -}} {{- end -}} From e5ddf17d08e29065e7f29865ff233ce394487e47 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 11 Jun 2024 15:50:25 +0200 Subject: [PATCH 2/3] [web] Update instructions to install req. gcc on older Ubuntu. --- .../getting-started/prerequisites/index.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/content/docs/devguide/getting-started/prerequisites/index.md b/web/content/docs/devguide/getting-started/prerequisites/index.md index 6583f4f8c6a..11f1a54b001 100644 --- a/web/content/docs/devguide/getting-started/prerequisites/index.md +++ b/web/content/docs/devguide/getting-started/prerequisites/index.md @@ -57,33 +57,33 @@ On Debian-based (we recommend using Ubuntu {{< dataFile "versions.tested_version sudo apt install build-essential ``` -You need to have at least **GCC {{< dataFile "versions.minimum_version.gcc" >}}** which you can check with `gcc --version` (Ubuntu {{< dataFile "versions.tested_version.ubuntu" >}} has already version 11). +You need to have at least **GCC {{< dataFile "versions.minimum_version.gcc" >}}** which you can check with `gcc --version`.
### Install the required compiler on older Ubuntu versions -If you are on an older Ubuntu version you can install a newer compiler from the `ubuntu-toolchain-r/test`-repository (with the following steps e.g. you can install GCC 10.3.0 on Ubuntu 20.04): +If you are on an older Ubuntu version than {{< dataFile "versions.tested_version.ubuntu" >}} you can install a newer compiler from the `ubuntu-toolchain-r/test`-repository (with the following steps e.g. you can install GCC {{< dataFile "versions.minimum_version.gcc" 1 >}} on Ubuntu 20.04): ```bash sudo apt-get install software-properties-common sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update -sudo apt-get install gcc-10 -sudo apt-get install g++-10 +sudo apt-get install gcc-{{< dataFile "versions.minimum_version.gcc" 1 >}} +sudo apt-get install g++-{{< dataFile "versions.minimum_version.gcc" 1 >}} ``` To make the newly installed compiler the default one: ```bash -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-10 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-{{< dataFile "versions.minimum_version.gcc" 1 >}} 60 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-{{< dataFile "versions.minimum_version.gcc" 1 >}} ``` If you do not do this you have to specify the compiler during the first CMake run: ```bash -CC=gcc-10 CXX=c++-10 cmake ../ogs [more CMake options] +CC=gcc-{{< dataFile "versions.minimum_version.gcc" 1 >}} CXX=c++-{{< dataFile "versions.minimum_version.gcc" 1 >}} cmake ../ogs [more CMake options] ```
From e0c3baefbf4f8181d640ebe15454d719149bcee5 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 11 Jun 2024 16:08:54 +0200 Subject: [PATCH 3/3] [web] Shortcode-comments have an interesting syntax. See https://discourse.gohugo.io/t/how-to-comment-out-shortcodes-in-markdown/14893/10 --- web/layouts/shortcodes/dataFile.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/layouts/shortcodes/dataFile.html b/web/layouts/shortcodes/dataFile.html index 23e7a3a4596..19320fce93a 100644 --- a/web/layouts/shortcodes/dataFile.html +++ b/web/layouts/shortcodes/dataFile.html @@ -2,9 +2,9 @@ {{- $map := split . "." }} {{- $url := index $.Site.Data $map -}} {{- if $url -}} - {# Second parameter allows to get a version component, starting with index 1 #} + {{/*% Second parameter allows to get a version component, starting with index 1 % */}} {{- with $.Get 1 -}} - {# Start with index 1, subtract 1 to get zero-based index #} + {{/*% Start with index 1, subtract 1 to get zero-based index % */}} {{- $index := math.Sub . 1 -}} {{- $version_comps := split $url "." -}} {{- $url = index $version_comps $index -}}