aboutsummaryrefslogtreecommitdiffstats
path: root/src/content/document.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-21 15:44:49 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-21 15:44:49 +0200
commitc43ad9bfb9467627df1b40266ac7b0d570a55a62 (patch)
tree27d7b01048a2e161f055388cecaa6bf84e1c01a4 /src/content/document.rs
parent2d0dfe66d423e707b7de60d9bde0cec7933580fe (diff)
downloadmarkdown-rs-c43ad9bfb9467627df1b40266ac7b0d570a55a62.tar.gz
markdown-rs-c43ad9bfb9467627df1b40266ac7b0d570a55a62.tar.bz2
markdown-rs-c43ad9bfb9467627df1b40266ac7b0d570a55a62.zip
Refactor to move `index` field to `point`
Diffstat (limited to '')
-rw-r--r--src/content/document.rs11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/content/document.rs b/src/content/document.rs
index 46da830..1a0ffee 100644
--- a/src/content/document.rs
+++ b/src/content/document.rs
@@ -77,8 +77,8 @@ struct DocumentInfo {
}
/// Turn `codes` as the document content type into events.
-pub fn document(parse_state: &mut ParseState, point: Point, index: usize) -> Vec<Event> {
- let mut tokenizer = Tokenizer::new(point, index, parse_state);
+pub fn document(parse_state: &mut ParseState, point: Point) -> Vec<Event> {
+ let mut tokenizer = Tokenizer::new(point, parse_state);
tokenizer.push(&parse_state.codes, Box::new(start), true);
@@ -464,7 +464,6 @@ fn exit_containers(
token_type: token_type.clone(),
// Note: positions are fixed later.
point: tokenizer.point.clone(),
- index: tokenizer.index,
link: None,
});
}
@@ -514,18 +513,12 @@ fn resolve(tokenizer: &mut Tokenizer, info: &mut DocumentInfo) {
} else {
&tokenizer.point
};
- let index_rel = if let Some(index) = first_line_ending_in_run {
- tokenizer.events[index].index
- } else {
- tokenizer.index
- };
let close_index = first_line_ending_in_run.unwrap_or(index);
let mut subevent_index = 0;
while subevent_index < after.len() {
after[subevent_index].point = point_rel.clone();
- after[subevent_index].index = index_rel;
subevent_index += 1;
}