aboutsummaryrefslogtreecommitdiffstats
path: root/renderer/src/html.rs
diff options
context:
space:
mode:
authorKonsta Hölttä2020-10-25 17:35:52 +0200
committerGitHub2020-10-25 16:35:52 +0100
commitb0c55246570b9c04e732eee43e6c02d6f3a043a4 (patch)
treec48025d287d31506b356f5904094881245eaf6a2 /renderer/src/html.rs
parentbc3325285dacd3731893295e6ec2e8c502929c5b (diff)
downloadrust-rst-b0c55246570b9c04e732eee43e6c02d6f3a043a4.tar.bz2
Decrement renderer level after section recursion (#16)
The html renderer section level used for title numbering is incremented when entering a new section so that subsections get correct heading elements. Match the increment with a decrement after having rendered the section contents, so that multiple consecutive sections would stay consistent. Add a test to verify this behaviour.
Diffstat (limited to 'renderer/src/html.rs')
-rw-r--r--renderer/src/html.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/renderer/src/html.rs b/renderer/src/html.rs
index 0092315..bb7c42e 100644
--- a/renderer/src/html.rs
+++ b/renderer/src/html.rs
@@ -152,6 +152,7 @@ impl HTMLRender for e::Section {
writeln!(renderer.stream)?;
}
write!(renderer.stream, "</section>")?;
+ renderer.level -= 1;
Ok(())
}
}