pub struct TocBuilder {
top_level: Toc,
/// The current hierarchy of parent headings, the levels are
- /// strictly increasing (i.e. chain[0].level < chain[1].level <
+ /// strictly increasing (i.e., chain[0].level < chain[1].level <
/// ...) with each entry being the most recent occurrence of a
/// heading with that level (it doesn't include the most recent
/// occurrences of every level, just, if it *is* in `chain` then
}
/// Collapse the chain until the first heading more important than
- /// `level` (i.e. lower level)
+ /// `level` (i.e., lower level)
///
/// Example:
///
/// ### H
/// ```
///
- /// If we are considering H (i.e. level 3), then A and B are in
+ /// If we are considering H (i.e., level 3), then A and B are in
/// self.top_level, D is in C.children, and C, E, F, G are in
/// self.chain.
///
///
/// This leaves us looking at E, which does have a smaller level,
/// and, by construction, it's the most recent thing with smaller
- /// level, i.e. it's the immediate parent of H.
+ /// level, i.e., it's the immediate parent of H.
fn fold_until(&mut self, level: u32) {
let mut this = None;
loop {
assert!(level >= 1);
// collapse all previous sections into their parents until we
- // get to relevant heading (i.e. the first one with a smaller
+ // get to relevant heading (i.e., the first one with a smaller
// level than us)
self.fold_until(level);
(entry.level, &entry.children)
}
};
- // fill in any missing zeros, e.g. for
+ // fill in any missing zeros, e.g., for
// # Foo (1)
// ### Bar (1.0.1)
for _ in toc_level..level - 1 {
sec_number.push_str("0.");
}
let number = toc.count_entries_with_level(level);
- sec_number.push_str(&format!("{}", number + 1))
+ sec_number.push_str(&(number + 1).to_string())
}
self.chain.push(TocEntry {