Skip to content

Commit

Permalink
Merge pull request #22 from tirix/fix-heading-comments
Browse files Browse the repository at this point in the history
Fix heading comments
  • Loading branch information
tirix authored Oct 30, 2023
2 parents 1581065 + 0861fe0 commit 8483900
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/toc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::ops::Bound;

use crate::statement::Renderer;
use crate::statement::TypesettingInfo;
use metamath_knife::outline::OutlineNodeRef;
Expand Down Expand Up @@ -108,13 +106,11 @@ impl Renderer {
}

fn get_comment(&self, node: &OutlineNodeRef) -> Option<String> {
let current_address = node.get_statement().address();
let next_statement = self
.db
.statements_range_address((Bound::Excluded(current_address), Bound::Unbounded))
.next()?;
let comment = next_statement.as_heading_comment()?;
Some(self.render_comment_new(&next_statement.segment().segment.buffer, comment.content))
let stmt = node.get_statement();
Some(self.render_comment_new(
&stmt.segment().segment.buffer,
stmt.as_heading_comment()?.content,
))
}

pub fn render_toc(&self, explorer: String, chapter_ref: usize) -> Option<String> {
Expand Down

0 comments on commit 8483900

Please sign in to comment.