diff --git a/exerciser/src/main.rs b/exerciser/src/main.rs index ecd0b7a5..2f1cfb68 100644 --- a/exerciser/src/main.rs +++ b/exerciser/src/main.rs @@ -25,6 +25,8 @@ use std::{ const INCLUDE_START: &str = "{{#include "; const INCLUDE_END: &str = "}}"; +const FILENAME_START: &str = ""; fn main() -> anyhow::Result<()> { pretty_env_logger::init(); @@ -59,9 +61,15 @@ fn main() -> anyhow::Result<()> { for event in parser { trace!("{:?}", event); match event { - Event::Code(x) => { - info!("{}:", x); - next_filename = Some(x.into_string()); + Event::Html(html) => { + let html = html.trim(); + if html.starts_with(FILENAME_START) && html.ends_with(FILENAME_END) { + next_filename = Some( + html[FILENAME_START.len()..html.len() - FILENAME_END.len()] + .to_string(), + ); + info!("Next file: {:?}:", next_filename); + } } Event::Start(Tag::CodeBlock(x)) => { info!("Start {:?}", x); diff --git a/src/exercises/bare-metal/compass.md b/src/exercises/bare-metal/compass.md index a4d71a18..c7f8b9a4 100644 --- a/src/exercises/bare-metal/compass.md +++ b/src/exercises/bare-metal/compass.md @@ -25,6 +25,8 @@ following files. `src/main.rs`: + + ```rust,compile_fail {{#include compass/src/main.rs:top}} use microbit::{hal::uarte::{Baudrate, Parity, Uarte}, Board}; @@ -40,18 +42,24 @@ use microbit::{hal::uarte::{Baudrate, Parity, Uarte}, Board}; `Cargo.toml` (you shouldn't need to change this): + + ```toml {{#include compass/Cargo.toml}} ``` `Embed.toml` (you shouldn't need to change this): + + ```toml {{#include compass/Embed.toml}} ``` `.cargo/config.toml` (you shouldn't need to change this): + + ```toml {{#include compass/.cargo/config.toml}} ``` diff --git a/src/exercises/bare-metal/rtc.md b/src/exercises/bare-metal/rtc.md index bd06387c..dceaa955 100644 --- a/src/exercises/bare-metal/rtc.md +++ b/src/exercises/bare-metal/rtc.md @@ -8,6 +8,9 @@ Download the [exercise template](../../exercises.zip) and look in the `rtc` dire following files. `src/main.rs`: + + + ```rust,compile_fail {{#include rtc/src/main.rs:top}} @@ -21,56 +24,89 @@ following files. ``` `src/exceptions.rs` (you shouldn't need to change this): + + + ```rust,compile_fail {{#include rtc/src/exceptions.rs}} ``` `src/logger.rs` (you shouldn't need to change this): + + + ```rust,compile_fail {{#include rtc/src/logger.rs}} ``` `src/pl011.rs` (you shouldn't need to change this): + + + ```rust,compile_fail {{#include rtc/src/pl011.rs}} ``` `Cargo.toml` (you shouldn't need to change this): + + + ```toml {{#include rtc/Cargo.toml}} ``` `build.rs` (you shouldn't need to change this): + + + ```rust,compile_fail {{#include rtc/build.rs}} ``` `entry.S` (you shouldn't need to change this): + + + ```armasm {{#include rtc/entry.S}} ``` `exceptions.S` (you shouldn't need to change this): + + + ```armasm {{#include rtc/exceptions.S}} ``` `idmap.S` (you shouldn't need to change this): + + + ```armasm {{#include rtc/idmap.S}} ``` `image.ld` (you shouldn't need to change this): + + + ```ld {{#include rtc/image.ld}} ``` `Makefile` (you shouldn't need to change this): + + + ```makefile {{#include rtc/Makefile}} ``` `.cargo/config.toml` (you shouldn't need to change this): + + + ```toml {{#include rtc/.cargo/config.toml}} ```