From 65e23207e1fff99ae606c51937ba4130e064fcdd Mon Sep 17 00:00:00 2001 From: Amit Upadhyay Date: Wed, 30 Oct 2024 15:26:01 +0530 Subject: [PATCH] header_value_ender --- v0.5/fastn-p1/src/lib.rs | 4 ++-- v0.5/fastn-p1/src/wiggin.rs | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/v0.5/fastn-p1/src/lib.rs b/v0.5/fastn-p1/src/lib.rs index 48d12ccee..c3e3d1c14 100644 --- a/v0.5/fastn-p1/src/lib.rs +++ b/v0.5/fastn-p1/src/lib.rs @@ -176,9 +176,9 @@ pub enum SES { Expression { start: usize, end: usize, - content: Vec, + content: HeaderValue, }, - Section(Box
), + Section(Vec
), } #[derive(Default)] diff --git a/v0.5/fastn-p1/src/wiggin.rs b/v0.5/fastn-p1/src/wiggin.rs index 7d03493fa..9157f02d2 100644 --- a/v0.5/fastn-p1/src/wiggin.rs +++ b/v0.5/fastn-p1/src/wiggin.rs @@ -39,11 +39,26 @@ fn section_ender( } fn header_value_ender( - _source: &str, - _o: &mut fastn_p1::ParseOutput, - _header: fastn_p1::HeaderValue, + source: &str, + o: &mut fastn_p1::ParseOutput, + header: fastn_p1::HeaderValue, ) -> fastn_p1::HeaderValue { - todo!() + header + .into_iter() + .map(|ses| match ses { + fastn_p1::SES::String(span) => fastn_p1::SES::String(span), + fastn_p1::SES::Expression { + start, + end, + content, + } => fastn_p1::SES::Expression { + start, + end, + content: header_value_ender(source, o, content), + }, + fastn_p1::SES::Section(sections) => fastn_p1::SES::Section(ender(source, o, sections)), + }) + .collect() } /// converts a section list, with interleaved `-- end: `, into a nested section list