chore: rename practice.rs to practice.course.rs

This commit is contained in:
sunfei
2024-01-24 16:46:52 +08:00
parent 38801fac38
commit 253042417a
9 changed files with 77 additions and 59 deletions

View File

@ -1 +1 @@
zh.practice.rs
practice-zh.course.rs

View File

@ -1,26 +0,0 @@
(function () {
var path = window.location.pathname;
var link = "https://practice.rs" + path;
var word = "English";
var lang = "zh-CN";
var changeLang = "切换到英语";
if (window.location.href.indexOf("zh.") == -1) {
link = "https://zh.practice.rs" + path;
word = "简体中文";
lang = "en";
changeLang = "Switch to Chinese"
}
var lang_node = '';
if (link != '') {
lang_node = '<a href="' + link + '" title="' + changeLang + '" aria-label="' + changeLang + '"><i id="change-language-button" class="fa fa-language"> ' + word + '</i></a>';
}
console.log(lang_node)
var insertNode = document.getElementsByClassName('right-buttons');
if (insertNode.length > 0) {
var html = insertNode[0].innerHTML;
insertNode[0].innerHTML = html + lang_node;
}
})()

35
zh-CN/assets/lang1.js Normal file
View File

@ -0,0 +1,35 @@
(function () {
var path = window.location.pathname;
var link = "https://practice.course.rs" + path;
var word = "English";
var lang = "zh-CN";
var changeLang = "切换到英语";
if (window.location.href.indexOf("zh.") == -1) {
link = "https://practice-zh.practice.rs" + path;
word = "简体中文";
lang = "en";
changeLang = "Switch to Chinese";
}
var lang_node = "";
if (link != "") {
lang_node =
'<a href="' +
link +
'" title="' +
changeLang +
'" aria-label="' +
changeLang +
'"><i id="change-language-button" class="fa fa-language"> ' +
word +
"</i></a>";
}
console.log(lang_node);
var insertNode = document.getElementsByClassName("right-buttons");
if (insertNode.length > 0) {
var html = insertNode[0].innerHTML;
insertNode[0].innerHTML = html + lang_node;
}
})();

View File

@ -14,9 +14,9 @@ level = 1
[output.html]
additional-css = ["theme/style1.css"]
additional-js = ["assets/custom3.js","assets/lang.js"]
additional-js = ["assets/custom3.js", "assets/lang1.js"]
git-repository-url = "https://github.com/sunface/rust-by-practice"
edit-url-template = "https://github.com/sunface/rust-by-practice/edit/master/zh-CN/{path}"
[rust]
edition = "2021"
edition = "2021"

View File

@ -149,7 +149,7 @@ fn main() {
### 容量
关于容量,我们在之前的 [Vector](https://zh.practice.rs/collections/vector.html#容量) 中有详细的介绍,而 `HashMap` 也可以调整容量: 你可以通过 `HashMap::with_capacity(uint)` 使用指定的容量来初始化,或者使用 `HashMap::new()` ,后者会提供一个默认的初始化容量。
关于容量,我们在之前的 [Vector](https://practice-zh.course.rs/collections/vector.html#容量) 中有详细的介绍,而 `HashMap` 也可以调整容量: 你可以通过 `HashMap::with_capacity(uint)` 使用指定的容量来初始化,或者使用 `HashMap::new()` ,后者会提供一个默认的初始化容量。
#### 示例