Skip to content

Commit

Permalink
Comments to make the code more understandable
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjay committed Feb 11, 2019
1 parent c8f3d49 commit 96fc91c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/parser/inlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,8 @@ impl<'a, 'r, 'o, 'd, 'i> Subject<'a, 'r, 'o, 'd, 'i> {
let is_image = self.brackets[brackets_len - 1].image;
let after_link_text_pos = self.pos;

// Try to find a link destination within parenthesis

let mut sps = 0;
let mut url: &[u8] = &[];
let mut n: usize = 0;
Expand Down Expand Up @@ -925,6 +927,8 @@ impl<'a, 'r, 'o, 'd, 'i> Subject<'a, 'r, 'o, 'd, 'i> {
}
}

// Try to see if this is a reference link

let (mut lab, mut found_label) = match self.link_label() {
Some(lab) => (lab.to_vec(), true),
None => (vec![], false),
Expand Down
3 changes: 3 additions & 0 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,10 +1355,12 @@ impl<'a, 'o> Parser<'a, 'o> {
let mut this_bracket = false;
loop {
match n.data.borrow_mut().value {
// Join adjacent text nodes together
NodeValue::Text(ref mut root) => {
let ns = match n.next_sibling() {
Some(ns) => ns,
_ => {
// Post-process once we are finished joining text nodes
self.postprocess_text_node(n, root);
break;
}
Expand All @@ -1370,6 +1372,7 @@ impl<'a, 'o> Parser<'a, 'o> {
ns.detach();
}
_ => {
// Post-process once we are finished joining text nodes
self.postprocess_text_node(n, root);
break;
}
Expand Down

0 comments on commit 96fc91c

Please sign in to comment.