diff --git a/en_chapters/frontpage.html b/en_chapters/frontpage.html index 98e4e02..eb357b7 100644 --- a/en_chapters/frontpage.html +++ b/en_chapters/frontpage.html @@ -216,6 +216,7 @@ a {
The first open-source book to comprehensively cover machine learning systems
+ diff --git a/static/frontpage.html b/static/frontpage.html index 2db5ba9..53094ea 100644 --- a/static/frontpage.html +++ b/static/frontpage.html @@ -201,6 +201,7 @@ a {做世界上第一本全面讲述机器学习系统知识的开源书籍
+ @@ -477,4 +478,3 @@ for (i = 0; i < coll.length; i++) { - diff --git a/tests/test_prepare_mdbook.py b/tests/test_prepare_mdbook.py index cbdadcf..69973df 100644 --- a/tests/test_prepare_mdbook.py +++ b/tests/test_prepare_mdbook.py @@ -131,7 +131,7 @@ Reference :cite:`smith2024`. encoding="utf-8", ) (static_dir / "frontpage.html").write_text( - "STAR
\n\nSTAR
+
@@ -221,9 +223,14 @@ missing
self.assertIn("static/image/logo.png", rewritten)
self.assertIn("static/image/jinxuefeng.png", rewritten)
self.assertIn("console.log('frontpage')", rewritten)
+ self.assertIn('class="openmlsys-frontpage-switch-row"', rewritten)
self.assertIn('class="openmlsys-frontpage-switch"', rewritten)
self.assertIn('href="../"', rewritten)
self.assertIn(">English", rewritten)
+ self.assertLess(
+ rewritten.index('class="star-slot"'),
+ rewritten.index('class="openmlsys-frontpage-switch-row"'),
+ )
if __name__ == "__main__":
diff --git a/tools/prepare_mdbook.py b/tools/prepare_mdbook.py
index a90b4a7..894a4c3 100644
--- a/tools/prepare_mdbook.py
+++ b/tools/prepare_mdbook.py
@@ -21,36 +21,37 @@ TOC_PART_RE = re.compile(r"^#+\s+(.+?)\s*$")
HEAD_TAG_RE = re.compile(r"?head>", re.IGNORECASE)
STYLE_BLOCK_RE = re.compile(r"", re.IGNORECASE | re.DOTALL)
DEFAULT_BIBLIOGRAPHY_TITLE = "References"
+FRONTPAGE_SWITCH_PLACEHOLDER = ""
FRONTPAGE_LAYOUT_CSS = """