From: Ben Pfaff Date: Thu, 9 Oct 2025 16:10:54 +0000 (-0700) Subject: work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1745cd26d454231f21c67e912131a0fc1e485403;p=pspp work --- diff --git a/rust/pspp/src/output/drivers/cairo/pager.rs b/rust/pspp/src/output/drivers/cairo/pager.rs index ab131375cf..bb22b455a2 100644 --- a/rust/pspp/src/output/drivers/cairo/pager.rs +++ b/rust/pspp/src/output/drivers/cairo/pager.rs @@ -222,7 +222,7 @@ fn render_heading( let mut y = 0; for paragraph in &heading.0 { // XXX substitute heading variables - layout.set_markup(¶graph.markup); + layout.set_markup(¶graph.text); layout.set_alignment(horz_align_to_pango(paragraph.align)); layout.set_width(width as i32); diff --git a/rust/pspp/src/output/drivers/spv.rs b/rust/pspp/src/output/drivers/spv.rs index ce6ee465fa..3a465420df 100644 --- a/rust/pspp/src/output/drivers/spv.rs +++ b/rust/pspp/src/output/drivers/spv.rs @@ -666,7 +666,7 @@ where for paragraph in &heading.0 { w.create_element("vtx:text") .with_attribute(("text", "title")) - .write_text_content(BytesText::new(¶graph.markup))?; + .write_text_content(BytesText::new(¶graph.text))?; } Ok(()) })?; diff --git a/rust/pspp/src/output/page.rs b/rust/pspp/src/output/page.rs index 9aeeb29d93..f3eba60394 100644 --- a/rust/pspp/src/output/page.rs +++ b/rust/pspp/src/output/page.rs @@ -52,7 +52,7 @@ pub enum ChartSize { #[derive(Clone, Debug, PartialEq)] pub struct Paragraph { - pub markup: String, + pub text: String, pub align: HorzAlign, pub font_style: FontStyle, } @@ -60,7 +60,7 @@ pub struct Paragraph { impl Default for Paragraph { fn default() -> Self { Self { - markup: Default::default(), + text: Default::default(), align: HorzAlign::Left, font_style: FontStyle::default().with_size(10), } diff --git a/rust/pspp/src/output/spv/html.rs b/rust/pspp/src/output/spv/html.rs index ad95996dcd..e0aed0701f 100644 --- a/rust/pspp/src/output/spv/html.rs +++ b/rust/pspp/src/output/spv/html.rs @@ -301,7 +301,7 @@ pub fn parse_paragraphs(input: &str) -> Vec { impl HtmlOutput for Paragraphs { fn start_paragraph(&mut self, align: HorzAlign) { - if !self.current.markup.is_empty() { + if !self.current.text.is_empty() { self.end_paragraph(); } self.current.align = align; @@ -312,19 +312,19 @@ pub fn parse_paragraphs(input: &str) -> Vec { } fn text(&mut self) -> &mut String { - &mut self.current.markup + &mut self.current.text } } let mut output = Paragraphs::default(); if parse2(input, &mut output, &mut font_style).is_ok() { - if !output.current.markup.is_empty() { + if !output.current.text.is_empty() { output.end_paragraph(); } output.finished } else if !input.is_empty() { vec![Paragraph { - markup: input.into(), + text: input.into(), ..Paragraph::default() }] } else { @@ -403,6 +403,7 @@ mod tests { r#"

bold
italic
bold italic
red serif
big

not in a paragraph

right justified

centered

trailing"#, ); dbg!(¶graphs); + assert_eq!(paragraphs.len(), 5); /* assert_eq!( paragraph,