1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-16 14:17:34 +02:00

Update to new version

This commit is contained in:
sakex
2023-11-03 19:13:08 +01:00
parent 4cd4269b8d
commit 41a6f35fa3
5 changed files with 13 additions and 24 deletions

View File

@ -95,7 +95,4 @@ optional = true
"pt-BR" = "Brazilian Portuguese (Português do Brasil)" "pt-BR" = "Brazilian Portuguese (Português do Brasil)"
[output.tera-backend] [output.tera-backend]
html_components = [ template_dir = "src/components"
"src/components/LanguagePicker.html",
]
templates_dir = "src/components"

View File

@ -1,20 +1,20 @@
{% import "macros.html" as macros %} {% import "macros.html" as macros %}
{% set current_language = ctx | get(key="config") | get(key="book") | get(key="language", default="en") %} {% set current_language = ctx.config.book.language %}
<button id="language-toggle{{ counter }}" class="icon-button" type="button" <button id="language-toggle" class="icon-button" type="button"
title="Change language" aria-label="Change language" title="Change language" aria-label="Change language"
aria-haspopup="true" aria-expanded="false" aria-haspopup="true" aria-expanded="false"
aria-controls="language-list{{ counter }}" style="{{ attributes | get(key="style", default="") }}"> aria-controls="language-list">
<i class="fa fa-globe"></i> <i class="fa fa-globe"></i>
</button> </button>
<ul id="language-list{{ counter }}" class="theme-popup" aria-label="Languages" <ul id="language-list" class="theme-popup" aria-label="Languages"
role="menu" style="left: auto; right: 10px;"> role="menu" style="left: auto; right: 10px; display: none;">
{% for identifier, language_name in get_context(key="output.i18n.languages") %} {% for identifier, language_name in ctx.config.output.i18n.languages %}
<li role="none"> <li role="none">
<a id="{{ identifier }}" <a id="{{ identifier }}"
href="{{ macros::get_rendered_path(identifier=identifier) }}" href="{{ macros::get_rendered_path(identifier=identifier) }}"
style="color: inherit;"> style="color: inherit;">
<button role="menuitem" class="theme {% if identifier == current_language %} theme-selected {% endif %}"> <button role="menuitem" class="theme {% if identifier == current_language %} theme-selected {% endif %}">
{% include "include_language_picker.html" %} {{ language_name }} {{ language_name }}
</button> </button>
</a> </a>
</li> </li>
@ -22,8 +22,8 @@
</ul> </ul>
<script> <script>
let langToggle = document.getElementById("language-toggle{{ counter }}"); let langToggle = document.getElementById("language-toggle");
let langList = document.getElementById("language-list{{ counter }}"); let langList = document.getElementById("language-list");
{% raw %} {% raw %}
langToggle.addEventListener("click", (event) => { langToggle.addEventListener("click", (event) => {
langList.style.display = langList.style.display == "block" ? "none" : "block"; langList.style.display = langList.style.display == "block" ? "none" : "block";
@ -33,7 +33,7 @@
<style> <style>
[dir=rtl] #language-list{{ counter }} {% raw %} { [dir=rtl] #language-list {% raw %} {
left: 10px; left: 10px;
right: auto; right: auto;
} }

View File

@ -4,13 +4,6 @@
[![GitHub contributors](https://img.shields.io/github/contributors/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/contributors) [![GitHub contributors](https://img.shields.io/github/contributors/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/contributors)
[![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/stargazers) [![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/stargazers)
<LanguagePicker>
</LanguagePicker>
<LanguagePicker style="color: red;">
</LanguagePicker>
<LanguagePicker style="color: yellow;">
</LanguagePicker>
This is a free Rust course developed by the Android team at Google. The course covers This is a free Rust course developed by the Android team at Google. The course covers
the full spectrum of Rust, from basic syntax to advanced topics like generics the full spectrum of Rust, from basic syntax to advanced topics like generics
and error handling. and error handling.

View File

@ -8,6 +8,7 @@
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'G-ZN78TEJMRW'); gtag('config', 'G-ZN78TEJMRW');
</script> </script>
{{! Move to template code after fixing this issue: {{! Move to template code after fixing this issue:
https://github.com/google/mdbook-i18n-helpers/issues/70 }} https://github.com/google/mdbook-i18n-helpers/issues/70 }}
<script> <script>

View File

@ -168,10 +168,8 @@
<div class="right-buttons"> <div class="right-buttons">
{{{{raw}}}} {{{{raw}}}}
{% set current_language = ctx | get(key="config") | get(key="book") | get(key="language", default="en") %} {% set current_language = ctx | get(key="config") | get(key="book") | get(key="language", default="en") %}
CURRENT LANGUAGE: {{ current_language }} {% include "LanguagePicker.html" %}
{{{{/raw}}}} {{{{/raw}}}}
<LanguagePicker style="color: red;">
</LanguagePicker>
{{#if print_enable}} {{#if print_enable}}
<a href="{{ path_to_root }}print.html" title="Print this book" aria-label="Print this book"> <a href="{{ path_to_root }}print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i> <i id="print-button" class="fa fa-print"></i>