From 96fc91c4c22e46676ef51d76c43fcb471e9e5c50 Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Mon, 11 Feb 2019 17:51:41 -0500 Subject: [PATCH] Comments to make the code more understandable --- src/parser/inlines.rs | 4 ++++ src/parser/mod.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/parser/inlines.rs b/src/parser/inlines.rs index e5a332e2..63421c5e 100644 --- a/src/parser/inlines.rs +++ b/src/parser/inlines.rs @@ -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; @@ -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), diff --git a/src/parser/mod.rs b/src/parser/mod.rs index e4d34627..0df0e4a9 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -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; } @@ -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; }