Skip to content

Commit

Permalink
Add some comments about the node split method
Browse files Browse the repository at this point in the history
  • Loading branch information
vidy committed Dec 20, 2024
1 parent 0daa403 commit cc0c227
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ fn main() {
for line in run.lines {
for word in line.words {
println!("{}", word.text.as_str());
for char in word.chars {
println!("{:?}", char);
}
// for char in word.chars {
// println!("{:?}", char);
// }
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ fn split<E: Encoder>(boxes: &mut [(RectF, usize)], spans: &[TextSpan<E>], lines:
}

let tag = match (y_gaps.is_empty(), x_gaps.is_empty()) {
// N y gaps, whatever x_gap is, if cells are all lines, then it is a line
(true, _) if cells.iter().all(|n| n.tag() <= NodeTag::Line) => NodeTag::Line,
// N x gaps, whatever y_gap is, if cells are all lines, then it is a paragraph
(_, true) if cells.iter().all(|n| n.tag() <= NodeTag::Line) => NodeTag::Paragraph,
// Otherwise it is a complex node
_ => NodeTag::Complex
};

Expand Down

0 comments on commit cc0c227

Please sign in to comment.