From 6ade0b002d7ab59a1fa34e93e7805b7a87e8dbc7 Mon Sep 17 00:00:00 2001 From: Alexandre Senges Date: Tue, 15 Aug 2023 10:26:34 +0000 Subject: [PATCH] Create solution attribute for details --- speaker-notes.js | 15 +++++++++++---- src/exercises/day-2/binary-tree.md | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/speaker-notes.js b/speaker-notes.js index a3a7d210..22eb6dda 100644 --- a/speaker-notes.js +++ b/speaker-notes.js @@ -128,11 +128,18 @@ // Create headers on the print page. function setupPrintPage() { for (const notes of document.querySelectorAll("details")) { - notes.open = true; - let summary = document.createElement("summary"); + let summaryContent; + if (notes.getAttribute("solution") !== null) { + notes.open = false; + summaryContent = "Solution"; + } else { + notes.open = true; + summaryContent = "Speaker Notes"; + } + const summary = document.createElement("summary"); notes.insertBefore(summary, notes.firstChild); - let h4 = document.createElement("h4"); - h4.append("Speaker Notes"); + const h4 = document.createElement("h4"); + h4.append(summaryContent); summary.append(h4); } } diff --git a/src/exercises/day-2/binary-tree.md b/src/exercises/day-2/binary-tree.md index 85f9cbba..88f26524 100644 --- a/src/exercises/day-2/binary-tree.md +++ b/src/exercises/day-2/binary-tree.md @@ -15,7 +15,7 @@ enum Side { Using the data structures in the standard library, how can we represent such a Binary Tree in Rust? -
+
```rust #[derive(Debug)] @@ -30,7 +30,7 @@ struct BinaryTree { Let's now write a method to to create a BinaryTree with arbitrary depth: -
+
```rust use Side::*; @@ -57,7 +57,7 @@ Let's now write a method to invert the tree. To make sure that the tree is inver left nodes values should now be `Right` and right nodes values should now be `Left`. -
+
```rust use Side::*;