diff --git a/content/descarregues/rutes/linia-2.ca.md b/content/descarregues/rutes/linia-2.ca.md index eb2b9be..ebbc15a 100644 --- a/content/descarregues/rutes/linia-2.ca.md +++ b/content/descarregues/rutes/linia-2.ca.md @@ -13,7 +13,7 @@ title: "Línia 2 del Ferrocarril Metropolità de Barcelona" ## Instal·lació -**Darrera versió (27/11/2016): [Descarrega (72 MB)](https://github.com/MarcRiera/FCMB-L2/releases/download/v1.0/FCMB_L2_v1.0.obp)** +{{< download_obp route-l2 >}} {{< openbve_notice >}} diff --git a/content/descarregues/rutes/linia-2.en.md b/content/descarregues/rutes/linia-2.en.md index 1f7a33d..0fe5021 100644 --- a/content/descarregues/rutes/linia-2.en.md +++ b/content/descarregues/rutes/linia-2.en.md @@ -14,7 +14,7 @@ title: "Barcelona Metro Line 2" ## Installation -**Latest version (27/11/2016): [Download (72 MB)](https://github.com/MarcRiera/FCMB-L2/releases/download/v1.0/FCMB_L2_v1.0.obp)** +{{< download_obp route-l2 >}} {{< openbve_notice >}} diff --git a/content/descarregues/rutes/linia-2.es.md b/content/descarregues/rutes/linia-2.es.md index 5e66961..7008796 100644 --- a/content/descarregues/rutes/linia-2.es.md +++ b/content/descarregues/rutes/linia-2.es.md @@ -14,7 +14,7 @@ title: "Línea 2 del Ferrocarril Metropolitano de Barcelona" ## Instalación -**Última versión (27/11/2016): [Descargar (72 MB)](https://github.com/MarcRiera/FCMB-L2/releases/download/v1.0/FCMB_L2_v1.0.obp)** +{{< download_obp route-l2 >}} {{< openbve_notice >}} diff --git a/content/descarregues/rutes/linia-3.ca.md b/content/descarregues/rutes/linia-3.ca.md index ee39b41..4b96197 100644 --- a/content/descarregues/rutes/linia-3.ca.md +++ b/content/descarregues/rutes/linia-3.ca.md @@ -13,7 +13,7 @@ title: "Línia 3 del Ferrocarril Metropolità de Barcelona" ## Instal·lació -**Darrera versió (30/10/2016): [Descarrega (10,5 MB)](https://github.com/MarcRiera/FCMB-L3/releases/download/v1.0/FCMB_L3_v1.0.obp)** +{{< download_obp route-l3 >}} {{< openbve_notice >}} diff --git a/content/descarregues/rutes/linia-3.en.md b/content/descarregues/rutes/linia-3.en.md index 86308a1..a907d7b 100644 --- a/content/descarregues/rutes/linia-3.en.md +++ b/content/descarregues/rutes/linia-3.en.md @@ -14,7 +14,7 @@ title: "Barcelona Metro Line 3" ## Installation -**Latest version (30/10/2016): [Download (10.5 MB)](https://github.com/MarcRiera/FCMB-L3/releases/download/v1.0/FCMB_L3_v1.0.obp)** +{{< download_obp route-l3 >}} {{< openbve_notice >}} diff --git a/content/descarregues/rutes/linia-3.es.md b/content/descarregues/rutes/linia-3.es.md index 5692666..643e5f2 100644 --- a/content/descarregues/rutes/linia-3.es.md +++ b/content/descarregues/rutes/linia-3.es.md @@ -14,7 +14,7 @@ title: "Línea 3 del Ferrocarril Metropolitano de Barcelona" ## Instalación -**Última versión (30/10/2016): [Descargar (10,5 MB)](https://github.com/MarcRiera/FCMB-L3/releases/download/v1.0/FCMB_L3_v1.0.obp)** +{{< download_obp route-l3 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-2000.ca.md b/content/descarregues/trens/serie-2000.ca.md index 2515d8e..96666d7 100644 --- a/content/descarregues/trens/serie-2000.ca.md +++ b/content/descarregues/trens/serie-2000.ca.md @@ -23,7 +23,7 @@ title: "Sèrie 2000 del Ferrocarril Metropolità de Barcelona" ## Instal·lació -**Darrera versió (4/10/2016): [Descarrega (22,4 MB)](https://github.com/MarcRiera/FCMB-2000/releases/download/v1.3/FCMB_2000_v1.3.obp)** +{{< download_obp train-2000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-2000.en.md b/content/descarregues/trens/serie-2000.en.md index 0b59cb9..45e2600 100644 --- a/content/descarregues/trens/serie-2000.en.md +++ b/content/descarregues/trens/serie-2000.en.md @@ -24,7 +24,7 @@ title: "Barcelona Metro 2000 Series" ## Installation -**Latest version (4/10/2016): [Download (22.4 MB)](https://github.com/MarcRiera/FCMB-2000/releases/download/v1.3/FCMB_2000_v1.3.obp)** +{{< download_obp train-2000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-2000.es.md b/content/descarregues/trens/serie-2000.es.md index eddc1f0..09af9d3 100644 --- a/content/descarregues/trens/serie-2000.es.md +++ b/content/descarregues/trens/serie-2000.es.md @@ -24,7 +24,7 @@ title: "Serie 2000 del Ferrocarril Metropolitano de Barcelona" ## Instalación -**Última versión (4/10/2016): [Descargar (22,4 MB)](https://github.com/MarcRiera/FCMB-2000/releases/download/v1.3/FCMB_2000_v1.3.obp)** +{{< download_obp train-2000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-3000.ca.md b/content/descarregues/trens/serie-3000.ca.md index 265b420..aa4f0f9 100644 --- a/content/descarregues/trens/serie-3000.ca.md +++ b/content/descarregues/trens/serie-3000.ca.md @@ -23,7 +23,7 @@ title: "Sèrie 3000 del Ferrocarril Metropolità de Barcelona" ## Instal·lació -**Darrera versió (4/10/2016): [Descarrega (22,4 MB)](https://github.com/MarcRiera/FCMB-3000/releases/download/v1.3/FCMB_3000_v1.3.obp)** +{{< download_obp train-3000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-3000.en.md b/content/descarregues/trens/serie-3000.en.md index 801dbee..4671457 100644 --- a/content/descarregues/trens/serie-3000.en.md +++ b/content/descarregues/trens/serie-3000.en.md @@ -24,7 +24,7 @@ title: "Barcelona Metro 3000 Series" ## Installation -**Latest version (4/10/2016): [Download (22.4 MB)](https://github.com/MarcRiera/FCMB-3000/releases/download/v1.3/FCMB_3000_v1.3.obp)** +{{< download_obp train-3000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-3000.es.md b/content/descarregues/trens/serie-3000.es.md index fa00563..86bc496 100644 --- a/content/descarregues/trens/serie-3000.es.md +++ b/content/descarregues/trens/serie-3000.es.md @@ -24,7 +24,7 @@ title: "Serie 3000 del Ferrocarril Metropolitano de Barcelona" ## Instalación -**Última versión (4/10/2016): [Descargar (22,4 MB)](https://github.com/MarcRiera/FCMB-3000/releases/download/v1.3/FCMB_3000_v1.3.obp)** +{{< download_obp train-3000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-9000.ca.md b/content/descarregues/trens/serie-9000.ca.md index 143039b..e4baa01 100644 --- a/content/descarregues/trens/serie-9000.ca.md +++ b/content/descarregues/trens/serie-9000.ca.md @@ -21,7 +21,7 @@ title: "Sèrie 9000 del Ferrocarril Metropolità de Barcelona" ## Instal·lació -**Darrera versió (8/2/2016): [Descarrega (5,0 MB)](https://github.com/MarcRiera/FCMB-9000/releases/download/v1.0/FCMB_9000_v1.0.obp)** +{{< download_obp train-9000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-9000.en.md b/content/descarregues/trens/serie-9000.en.md index 9b6fcbb..959d4ef 100644 --- a/content/descarregues/trens/serie-9000.en.md +++ b/content/descarregues/trens/serie-9000.en.md @@ -22,7 +22,7 @@ title: "Barcelona Metro 9000 Series" ## Installation -**Latest version (8/2/2016): [Download (5.0 MB)](https://github.com/MarcRiera/FCMB-9000/releases/download/v1.0/FCMB_9000_v1.0.obp)** +{{< download_obp train-9000 >}} {{< openbve_notice >}} diff --git a/content/descarregues/trens/serie-9000.es.md b/content/descarregues/trens/serie-9000.es.md index c1d3215..170112f 100644 --- a/content/descarregues/trens/serie-9000.es.md +++ b/content/descarregues/trens/serie-9000.es.md @@ -22,7 +22,7 @@ title: "Serie 9000 del Ferrocarril Metropolitano de Barcelona" ## Instalación -**Última versión (8/2/2016): [Descargar (5,0 MB)](https://github.com/MarcRiera/FCMB-9000/releases/download/v1.0/FCMB_9000_v1.0.obp)** +{{< download_obp train-9000 >}} {{< openbve_notice >}} diff --git a/layouts/shortcodes/download_obp.html b/layouts/shortcodes/download_obp.html new file mode 100644 index 0000000..26602c4 --- /dev/null +++ b/layouts/shortcodes/download_obp.html @@ -0,0 +1,47 @@ +{{ $currentlang := .Site.Language.Lang }} +{{ $currentdownload := .Get 0 }} + +{{ $urlPre := "https://api.github.com/repos/MarcRiera" }} +{{ $.Scratch.Add "releaseJ" "" }} + +{{ if eq $currentdownload "train-2000" }} + {{ $.Scratch.Set "releaseJ" (getJSON $urlPre "/FCMB-2000/releases") }} +{{ else if eq $currentdownload "train-3000" }} + {{ $.Scratch.Set "releaseJ" (getJSON $urlPre "/FCMB-3000/releases") }} +{{ else if eq $currentdownload "train-4000" }} + {{ $.Scratch.Set "releaseJ" (getJSON $urlPre "/FCMB-4000/releases") }} +{{ else if eq $currentdownload "train-9000" }} + {{ $.Scratch.Set "releaseJ" (getJSON $urlPre "/FCMB-9000/releases") }} +{{ else if eq $currentdownload "route-l2" }} + {{ $.Scratch.Set "releaseJ" (getJSON $urlPre "/FCMB-L2/releases") }} +{{ else if eq $currentdownload "route-l3" }} + {{ $.Scratch.Set "releaseJ" (getJSON $urlPre "/FCMB-L3/releases") }} +{{ end }} + +{{ if ne ($.Scratch.Get "releaseJ") "" }} +{{ range first 1 (where ($.Scratch.Get "releaseJ") ".prerelease" false) }} + {{ $latestversion := .tag_name }} + {{ $latestupdate := .published_at }} + + {{ range first 1 .assets}} + {{ $filesize := (div .size 1048576) }} + {{ if eq $currentlang "ca" }} +
Darrera versió ({{ dateFormat "2006/01/02" $latestupdate }}): Descarrega {{ print $latestversion }} ({{ lang.NumFmt 2 $filesize "- ," }} MB)
+ {{ else if eq $currentlang "es" }} +Última versión ({{ dateFormat "2006/01/02" $latestupdate }}): Descargar {{ print $latestversion }} ({{ lang.NumFmt 2 $filesize "- ," }} MB)
+ {{ else }} +Latest version ({{ dateFormat "2006/01/02" $latestupdate }}): Download {{ print $latestversion }} ({{ lang.NumFmt 2 $filesize "- ." }} MB)
+ {{ end }} + + {{ end }} + +{{ end }} +{{ else }} + {{ if eq $currentlang "ca" }} +Descàrrega no disponible.
+ {{ else if eq $currentlang "es" }} +Descarga no disponible.
+ {{ else }} +Download not available.
+ {{ end }} +{{ end }} diff --git a/layouts/shortcodes/openbve_notice.html b/layouts/shortcodes/openbve_notice.html index f7727d5..3b0f338 100644 --- a/layouts/shortcodes/openbve_notice.html +++ b/layouts/shortcodes/openbve_notice.html @@ -6,11 +6,11 @@ {{ $latestversion := .tag_name }} {{ if eq $currentlang "ca" }} - Assegureu-vos sempre que teniu la versió més recent ({{ print $latestversion }}) de l'openBVE, disponible al lloc web oficial del simulador, i instal·leu el fitxer OBP des del Gestor de paquets. +Assegureu-vos sempre que teniu la versió més recent ({{ print $latestversion }}) de l'openBVE, disponible al lloc web oficial del simulador, i instal·leu el fitxer OBP des del Gestor de paquets.
{{ else if eq $currentlang "es" }} - Asegúrate siempre de que tienes la versión más reciente ({{ print $latestversion }}) de openBVE, disponible en el sitio web oficial del simulador, e instala el archivo OBP desde el Gestor de paquetes. +Asegúrate siempre de que tienes la versión más reciente ({{ print $latestversion }}) de openBVE, disponible en el sitio web oficial del simulador, e instala el archivo OBP desde el Gestor de paquetes.
{{ else }} - Always make sure you have the latest ({{ print $latestversion }}) openBVE version, available at the simulator's official website, and install the OBP file from the Package Manager. +Always make sure you have the latest ({{ print $latestversion }}) openBVE version, available at the simulator's official website, and install the OBP file from the Package Manager.
{{ end }} {{ end }}