diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-29 10:26:39 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-29 10:26:39 +0200 |
commit | 7721f210c16e19b1c2af90f69130386b89bb5104 (patch) | |
tree | c47ff3d9c974ccd0c81a2c5b8ccbce9f7635975d /src/construct | |
parent | 7bb1008f508f61b51dd80086a91ada347be36c68 (diff) | |
download | markdown-rs-7721f210c16e19b1c2af90f69130386b89bb5104.tar.gz markdown-rs-7721f210c16e19b1c2af90f69130386b89bb5104.tar.bz2 markdown-rs-7721f210c16e19b1c2af90f69130386b89bb5104.zip |
Add support for sharing identifiers, references before definitions
Diffstat (limited to 'src/construct')
-rw-r--r-- | src/construct/label_end.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index 581e5e9..f43a740 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -413,13 +413,8 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// [a]: z /// ``` fn after(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { - // let label_start = tokenizer - // .label_start_stack - // .get_mut(info.label_start_index) - // .unwrap(); - // To do: figure out if defined or not. - let defined = false; - println!("to do: is `{:?}` defined?", info); + let defined = tokenizer.parse_state.definitions.contains(&info.media.id); + match code { // Resource (`[asd](fgh)`)? Code::Char('(') => tokenizer.attempt(resource, move |is_ok| { @@ -487,10 +482,6 @@ fn reference_not_full(tokenizer: &mut Tokenizer, code: Code, info: Info) -> Stat /// [a]: z /// ``` fn ok(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> StateFnResult { - println!( - "ok res, ref full, ref, collapsed, or ref shortcut: {:?}", - info.media - ); // Remove this one and everything after it. let mut left: Vec<LabelStart> = tokenizer .label_start_stack @@ -725,8 +716,8 @@ fn full_reference_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult }, false, )); - println!("to do: is `{:?}` defined?", id); - let defined = false; + let defined = tokenizer.parse_state.definitions.contains(&id); + // To do: set `id` on the media somehow? if defined { (State::Ok, Some(vec![code])) |