From 0c2a21228bb825c1485a1e143b9f59ea48b541a5 Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 16 Jan 2023 02:42:00 -0800 Subject: parse_wiki_text: fix incorrect parsing of pages lacking a leading newline --- parse_wiki_text/src/parse.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parse_wiki_text/src/parse.rs b/parse_wiki_text/src/parse.rs index 33314bb..1849a24 100644 --- a/parse_wiki_text/src/parse.rs +++ b/parse_wiki_text/src/parse.rs @@ -106,7 +106,13 @@ pub fn parse<'a>(configuration: &crate::Configuration, wiki_text: &'a str) -> cr _ => crate::tag::parse_start_tag(&mut state, configuration), }, Some(b'=') => { - crate::template::parse_parameter_name_end(&mut state); + // hack + if state.get_byte(state.scan_position - 1) == Some(b'>') { + state.scan_position -= 1; + crate::line::parse_end_of_line(&mut state); + } else { + crate::template::parse_parameter_name_end(&mut state); + } } Some(b'[') => { if state.get_byte(state.scan_position + 1) == Some(b'[') { -- cgit v1.2.3-70-g09d2