diff --git a/_config.yml b/_config.yml
index 008a39325a..4f559b2295 100644
--- a/_config.yml
+++ b/_config.yml
@@ -22,8 +22,6 @@ scala-3-version: 3.1.2
collections:
contribute_resources:
output: false
- install_tabs:
- output: false
style:
output: true
overviews:
diff --git a/_fr/getting-started/index.md b/_fr/getting-started/index.md
index 0228e5ea0b..4b73224c27 100644
--- a/_fr/getting-started/index.md
+++ b/_fr/getting-started/index.md
@@ -27,14 +27,43 @@ L'installateur Scala est un outil nommé [Coursier](https://get-coursier.io/docs
Il s'assure que la JVM est les outils standards de Scala sont installés sur votre système.
Installez-le sur votre système avec les instructions suivantes.
-
-
-
- {% include tabsection.html language='fr' id='install-cs-setup-tabs' collection=site.install_tabs %}
-
-
-
-
+
+{% tabs install-cs-setup-tabs class=platform-os-options %}
+
+
+{% tab macOS for=install-cs-setup-tabs %}
+{% include code-snippet.html language='bash' codeSnippet=site.data.setup-scala.macOS-brew %}
+{% altDetails cs-setup-macos-nobrew "Alternativement, si vous n'utilisez pas Homebrew:" %}
+ {% include code-snippet.html language='bash' codeSnippet=site.data.setup-scala.macOS-default %}
+{% endaltDetails %}
+{% endtab %}
+
+
+
+{% tab Linux for=install-cs-setup-tabs %}
+ {% include code-snippet.html language='bash' codeSnippet=site.data.setup-scala.linux %}
+{% endtab %}
+
+
+
+{% tab Windows for=install-cs-setup-tabs %}
+ Téléchargez et exécutez [l'intallateur Scala pour Windows]({{site.data.setup-scala.windows-link}}) basé sur Coursier.
+{% endtab %}
+
+
+
+{% tab Other for=install-cs-setup-tabs defaultTab %}
+
+ Suivez
+ [les instructions pour installer la commande `cs`](https://get-coursier.io/docs/cli-installation)
+ puis exécutez `./cs setup`.
+{% endtab %}
+
+
+{% endtabs %}
+
En plus de gérer les JVMs, `cs setup` installe aussi des utilitaires en ligne de commande :
diff --git a/_includes/_ja/getting-started.md b/_includes/_ja/getting-started.md
index 4faa2e2a35..f200bcb759 100644
--- a/_includes/_ja/getting-started.md
+++ b/_includes/_ja/getting-started.md
@@ -17,14 +17,41 @@ Scala をインストールすると、コンパイラやビルドツールな
Scala のインストーラーは[Coursier](https://get-coursier.io/docs/cli-overview)というツールで、コマンドは`cs`です。このツールを使うと、JVM と標準 Scala ツールがシステムにインストールされます。
以下の手順でお使いのシステムにインストールしてください。
-
-
-
- {% include tabsection.html language='ja' id='install-cs-setup-tabs' collection=site.install_tabs %}
-
diff --git a/_includes/getting-started.md b/_includes/getting-started.md
index 4a900782ff..491859f405 100644
--- a/_includes/getting-started.md
+++ b/_includes/getting-started.md
@@ -20,30 +20,56 @@ The Scala installer is a tool named [Coursier](https://get-coursier.io/docs/cli-
It ensures that a JVM and standard Scala tools are installed on your system.
Install it on your system with the following instructions.
-{% capture scalaDemo %}$ scala -version
-Scala code runner version {{site.scala-3-version}} -- Copyright 2002-2022, LAMP/EPFL{% endcapture %}
-
-
-
-
- {% include tabsection.html language='en' id='install-cs-setup-tabs' collection=site.install_tabs %}
-
- {% capture checkSetupDetail %}
-
-
-
Check your setup with the command scala -version, which should output:
- {% include code-snippet.html nocopy=true language='bash' codeSnippet=scalaDemo %}
-
If that does not work, you may need to log out and log back in (or reboot) in order for the changes to take
- effect.
-
-
-
- {% endcapture %}
-
- {% include alt-details.html id='testing-your-setup' title='Testing your setup' detail=checkSetupDetail %}
-
-
-
+
+{% tabs install-cs-setup-tabs class=platform-os-options %}
+
+
+{% tab macOS for=install-cs-setup-tabs %}
+Run the following command in your terminal, following the on-screen instructions:
+{% include code-snippet.html language='bash' codeSnippet=site.data.setup-scala.macOS-brew %}
+{% altDetails cs-setup-macos-nobrew "Alternatively, if you don't use Homebrew:" %}
+ {% include code-snippet.html language='bash' codeSnippet=site.data.setup-scala.macOS-default %}
+{% endaltDetails %}
+{% endtab %}
+
+
+
+{% tab Linux for=install-cs-setup-tabs %}
+ Run the following command in your terminal, following the on-screen instructions:
+ {% include code-snippet.html language='bash' codeSnippet=site.data.setup-scala.linux %}
+{% endtab %}
+
+
+
+{% tab Windows for=install-cs-setup-tabs %}
+ Download and execute [the Scala installer for Windows]({{site.data.setup-scala.windows-link}})
+ based on Coursier, and follow the on-screen instructions.
+{% endtab %}
+
+
+
+{% tab Other for=install-cs-setup-tabs defaultTab %}
+
+ Follow the documentation from Coursier on
+ [how to install and run `cs setup`](https://get-coursier.io/docs/cli-installation).
+{% endtab %}
+
+
+{% endtabs %}
+
+
+
+{% altDetails testing-your-setup 'Testing your setup' %}
+Check your setup with the command `scala -version`, which should output:
+```bash
+$ scala -version
+Scala code runner version {{site.scala-3-version}} -- Copyright 2002-2022, LAMP/EPFL
+```
+If that does not work, you may need to log out and log back in (or reboot) in order for the changes to take effect.
+{% endaltDetails %}
+
Along with managing JVMs, `cs setup` also installs useful command-line tools:
diff --git a/_includes/tabsection.html b/_includes/tabsection.html
deleted file mode 100644
index f779ce2efb..0000000000
--- a/_includes/tabsection.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
- {% for tabRoot in include.collection %}
- {% if tabRoot.language == include.language %}
-
- {% endif %}
- {% endfor %}
-
- {% for tabRoot in include.collection %}
- {% if tabRoot.language == include.language %}
-
-
-
- {% endif %}
- {% endfor %}
-
-
- {% for tabRoot in include.collection %}
- {% if tabRoot.language == include.language %}
-
- {{tabRoot.content}}
-
- {% endif %}
- {% endfor %}
-
diff --git a/_plugins/alt-details-lib/alt-details.rb b/_plugins/alt-details-lib/alt-details.rb
new file mode 100644
index 0000000000..4ddbee64f4
--- /dev/null
+++ b/_plugins/alt-details-lib/alt-details.rb
@@ -0,0 +1,39 @@
+require 'erb'
+
+module Jekyll
+ module AltDetails
+ class AltDetailsBlock < Liquid::Block
+ SYNTAX = /^\s*(#{Liquid::QuotedFragment})\s+(#{Liquid::QuotedFragment})/o
+ Syntax = SYNTAX
+
+ alias_method :render_block, :render
+
+ def unquote(string)
+ string.gsub(/^['"]|['"]$/, '')
+ end
+
+ def initialize(block_name, markup, tokens)
+ super
+
+ if markup =~ SYNTAX
+ @name = unquote($1)
+ @title = unquote($2)
+ else
+ raise SyntaxError.new("Block #{block_name} requires an id and a title")
+ end
+ end
+
+ def render(context)
+ site = context.registers[:site]
+ converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
+ altDetailsContent = converter.convert(render_block(context))
+ currentDirectory = File.dirname(__FILE__)
+ templateFile = File.read(currentDirectory + '/template.erb')
+ template = ERB.new(templateFile)
+ template.result(binding)
+ end
+ end
+ end
+end
+
+Liquid::Template.register_tag('altDetails', Jekyll::AltDetails::AltDetailsBlock)
diff --git a/_plugins/alt-details-lib/alt-details/version.rb b/_plugins/alt-details-lib/alt-details/version.rb
new file mode 100644
index 0000000000..147e33df9c
--- /dev/null
+++ b/_plugins/alt-details-lib/alt-details/version.rb
@@ -0,0 +1,5 @@
+module Jekyll
+ module AltDetails
+ VERSION = "1.1.1"
+ end
+end
diff --git a/_plugins/alt-details-lib/template.erb b/_plugins/alt-details-lib/template.erb
new file mode 100644
index 0000000000..6aba6f127f
--- /dev/null
+++ b/_plugins/alt-details-lib/template.erb
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+ <%= altDetailsContent %>
+
+
+
+
diff --git a/_plugins/alt_details.rb b/_plugins/alt_details.rb
new file mode 100644
index 0000000000..57d2420105
--- /dev/null
+++ b/_plugins/alt_details.rb
@@ -0,0 +1 @@
+require_relative "alt-details-lib/alt-details"
diff --git a/_plugins/jekyll-tabs-lib/LICENCE b/_plugins/jekyll-tabs-lib/LICENCE
new file mode 100644
index 0000000000..43ae840e30
--- /dev/null
+++ b/_plugins/jekyll-tabs-lib/LICENCE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2022 Baptiste Bouchereau
+Copyright (c) 2022 LAMP/EPFL
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/_plugins/jekyll-tabs-lib/README.md b/_plugins/jekyll-tabs-lib/README.md
new file mode 100644
index 0000000000..4e84712723
--- /dev/null
+++ b/_plugins/jekyll-tabs-lib/README.md
@@ -0,0 +1,8 @@
+originally sourced from https://github.com/Ovski4/jekyll-tabs.
+
+changes:
+- template.erb adapted to match the pre-existing tab html structure for docs.scala-lang.org
+- `tabs` do not use secure random uuid as the id, the `tabs` name parameter is used instead.
+- for the `tabs` block, add an optional second `class='foo bar'` parameter to allow custom classes for the tabs.
+- for the `tab` block, reorder the parameters: the tab label comes first, followed by the name of the parent `tabs`.
+- addition of a third `defaultTab` attribute for `tab`, which defaults to the final tab if not set.
diff --git a/_plugins/jekyll-tabs-lib/jekyll-tabs-4scala.rb b/_plugins/jekyll-tabs-lib/jekyll-tabs-4scala.rb
new file mode 100644
index 0000000000..c9a829f07f
--- /dev/null
+++ b/_plugins/jekyll-tabs-lib/jekyll-tabs-4scala.rb
@@ -0,0 +1,97 @@
+require 'erb'
+
+module Jekyll
+ module Tabs
+
+ def self.unquote(string)
+ string.gsub(/^['"]|['"]$/, '')
+ end
+
+ def self.asAnchor(title)
+ title.gsub(/[^a-zA-Z0-9\-_]/, '-').gsub(/-{2,}/, '-').downcase
+ end
+
+ TabDetails = Struct.new(:label, :anchor, :defaultTab, :content, keyword_init: true)
+
+ class TabsBlock < Liquid::Block
+ SYNTAX = /^\s*(#{Liquid::QuotedFragment})(?=\s+class=(#{Liquid::QuotedFragment}))?/o
+ Syntax = SYNTAX
+
+ def initialize(block_name, markup, tokens)
+ super
+
+ if markup =~ SYNTAX
+ @name = Tabs::unquote($1)
+ @css_classes = ""
+ if $2
+ # append $2 to @css_classes
+ @css_classes = "#{@css_classes} #{Tabs::unquote($2)}"
+ end
+ else
+ raise SyntaxError.new("Block #{block_name} requires 1 attribute")
+ end
+ end
+
+ def render(context)
+ environment = context.environments.first
+ environment["tabs-#{@name}"] = [] # reset every time (so page translations can use the same name)
+ super
+
+ foundDefault = false
+
+ allTabs = environment["tabs-#{@name}"]
+
+ allTabs.each do | tab |
+ if tab.defaultTab
+ foundDefault = true
+ end
+ end
+
+ if !foundDefault and allTabs.length > 0
+ # set last tab to default
+ allTabs[-1].defaultTab = true
+ end
+
+ currentDirectory = File.dirname(__FILE__)
+ templateFile = File.read(currentDirectory + '/template.erb')
+ template = ERB.new(templateFile)
+ template.result(binding)
+ end
+ end
+
+ class TabBlock < Liquid::Block
+ alias_method :render_block, :render
+
+ SYNTAX = /^\s*(#{Liquid::QuotedFragment})\s+(?:for=(#{Liquid::QuotedFragment}))(?:\s+(defaultTab))?/o
+ Syntax = SYNTAX
+
+ def initialize(block_name, markup, tokens)
+ super
+
+ if markup =~ SYNTAX
+ @tab = Tabs::unquote($1)
+ @name = Tabs::unquote($2)
+ @anchor = Tabs::asAnchor(@tab)
+ if $3
+ @defaultTab = true
+ end
+ else
+ raise SyntaxError.new("Block #{block_name} requires at least 2 attributes")
+ end
+ end
+
+ def render(context)
+ site = context.registers[:site]
+ converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
+ content = converter.convert(render_block(context))
+ tabcontent = TabDetails.new(label: @tab, anchor: @anchor, defaultTab: @defaultTab, content: content)
+ environment = context.environments.first
+ environment["tabs-#{@name}"] ||= []
+ environment["tabs-#{@name}"] << tabcontent
+ end
+ end
+ end
+end
+
+Liquid::Template.register_tag('tab', Jekyll::Tabs::TabBlock)
+Liquid::Template.register_tag('tabs', Jekyll::Tabs::TabsBlock)
diff --git a/_plugins/jekyll-tabs-lib/jekyll-tabs/version.rb b/_plugins/jekyll-tabs-lib/jekyll-tabs/version.rb
new file mode 100644
index 0000000000..498949a13d
--- /dev/null
+++ b/_plugins/jekyll-tabs-lib/jekyll-tabs/version.rb
@@ -0,0 +1,5 @@
+module Jekyll
+ module Tabs
+ VERSION = "1.1.1"
+ end
+end
diff --git a/_plugins/jekyll-tabs-lib/template.erb b/_plugins/jekyll-tabs-lib/template.erb
new file mode 100644
index 0000000000..0d2e2ec147
--- /dev/null
+++ b/_plugins/jekyll-tabs-lib/template.erb
@@ -0,0 +1,29 @@
+
+
+ <% environment["tabs-#{@name}"].each do | tab | %>
+ >
+ <% end %>
+
+ <% environment["tabs-#{@name}"].each do | tab | %>
+
+
+
+ <% end %>
+
+
+ <% environment["tabs-#{@name}"].each do | tab | %>
+
+
+ <%= tab.content %>
+
+
+ <% end %>
+
+
+
diff --git a/_plugins/jekyll_tabs_4scala.rb b/_plugins/jekyll_tabs_4scala.rb
new file mode 100644
index 0000000000..7470d622a7
--- /dev/null
+++ b/_plugins/jekyll_tabs_4scala.rb
@@ -0,0 +1 @@
+require_relative "jekyll-tabs-lib/jekyll-tabs-4scala"
diff --git a/_sass/base/helper.scss b/_sass/base/helper.scss
index 7f13553247..d0f6281ea0 100755
--- a/_sass/base/helper.scss
+++ b/_sass/base/helper.scss
@@ -19,6 +19,12 @@
@include padding(20px 0);
}
+.wrap-tab {
+ @extend .wrap-narrow;
+ margin-top: 20px;
+ margin-bottom: 20px;
+}
+
.wrap-narrow {
@include outer-container;
@include padding(0 10px);
diff --git a/resources/js/functions.js b/resources/js/functions.js
index d6524a72f4..7bd39db251 100644
--- a/resources/js/functions.js
+++ b/resources/js/functions.js
@@ -386,7 +386,7 @@ $(document).ready(function() {
function getOS() {
var osname = "linux";
if (navigator.appVersion.indexOf("Win") != -1) osname = "windows";
- if (navigator.appVersion.indexOf("Mac") != -1) osname = "osx";
+ if (navigator.appVersion.indexOf("Mac") != -1) osname = "macos";
if (navigator.appVersion.indexOf("Linux") != -1) osname = "linux";
if (navigator.appVersion.indexOf("X11") != -1) osname = "unix";
return osname;
@@ -407,12 +407,13 @@ $(document).ready(function () {
$(document).ready(function () {
// click the get-started tab corresponding to the users OS.
- if ($(".main-download").length) {
+ var platformOSOptions = $(".tabsection.platform-os-options");
+ if (platformOSOptions.length) {
var os = getOS();
if (os === 'unix') {
os = 'linux';
}
- $("#install-cs-setup-tabs").find('input[data-target=' + os + ']').prop("checked", true);
+ platformOSOptions.find('input[data-target=' + os + ']').prop("checked", true);
}
});