work
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 9 Oct 2025 16:10:54 +0000 (09:10 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 9 Oct 2025 16:10:54 +0000 (09:10 -0700)
rust/pspp/src/output/drivers/cairo/pager.rs
rust/pspp/src/output/drivers/spv.rs
rust/pspp/src/output/page.rs
rust/pspp/src/output/spv/html.rs

index ab131375cf618570e7acc8b51e78623dfb01cca0..bb22b455a23a22c3d866c80dbefdb364538a5e9f 100644 (file)
@@ -222,7 +222,7 @@ fn render_heading(
     let mut y = 0;
     for paragraph in &heading.0 {
         // XXX substitute heading variables
-        layout.set_markup(&paragraph.markup);
+        layout.set_markup(&paragraph.text);
 
         layout.set_alignment(horz_align_to_pango(paragraph.align));
         layout.set_width(width as i32);
index ce6ee465fac28d9bddddfbf32fecb55683aaa961..3a465420dfd1f462039e28b2ca2f4465171a7f76 100644 (file)
@@ -666,7 +666,7 @@ where
                     for paragraph in &heading.0 {
                         w.create_element("vtx:text")
                             .with_attribute(("text", "title"))
-                            .write_text_content(BytesText::new(&paragraph.markup))?;
+                            .write_text_content(BytesText::new(&paragraph.text))?;
                     }
                     Ok(())
                 })?;
index 9aeeb29d93af435abb311a458bfa05d79f1c3f5b..f3eba60394d1cc71c02450158203b1bd9f7b6077 100644 (file)
@@ -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),
         }
index ad95996dcddffb1a872760b4c4fd84ddd6a82dce..e0aed0701f14963ffc1275115853c8590517910e 100644 (file)
@@ -301,7 +301,7 @@ pub fn parse_paragraphs(input: &str) -> Vec<Paragraph> {
 
     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<Paragraph> {
         }
 
         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#"<p align="left"><b>bold</b><br><i>italic</i><BR><b><i>bold italic</i></b><br><font color="red" face="Serif">red serif</font><br><font size="7">big</font><br></p>not in a paragraph<p align="right">right justified</p><p align="center">centered</p>trailing"#,
         );
         dbg!(&paragraphs);
+        assert_eq!(paragraphs.len(), 5);
         /*
         assert_eq!(
             paragraph,