XXX Don't decode area styles because they should be in the Look XXX
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Dec 2025 23:49:22 +0000 (15:49 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Dec 2025 23:49:22 +0000 (15:49 -0800)
rust/doc/src/spv/structure.md
rust/pspp/src/spv/read/legacy_xml.rs

index a53d84a3f53608c307b1b5fe559609312fff0df6..b43f4d1ba8d5eb5e401b5a4f52b2246c4f0b8997 100644 (file)
@@ -830,8 +830,11 @@ only the following elements:
 
 * `p`  
   The document often contains a `p` element that contains the content.
-  [Inside `pageParagraph`](#the-text-element-inside-pageparagraph)
-  only, the document can contain multiple paragraphs.
+  [Inside `pageParagraph`](#the-text-element-inside-pageparagraph),
+  the document can contain multiple paragraphs.  On the other hand,
+  [inside `container`](#the-text-element-inside-container), if there
+  are multiple paragraphs, which is rare, `<p>` after the first are
+  simply treated as line breaks, as with `<br>`.
 
   The following attributes are observed:
 
@@ -849,6 +852,11 @@ only the following elements:
   Embedded HTML writes most tag names in lowercase but this one is
   usually in uppercase, as `<BR>`.
 
+  > At the beginning of an HTML body, a single `<BR>` element should
+  > be ignored, but only if capitalized; that is, `<br>` is not
+  > ignored, and neither is `<BR>` following any text or any other
+  > element.
+
 * `b`  
   `i`  
   `u`  
index 4ca93a0cf4da265a56705e489c441e6c8307b0d3..5171060bdda73dff5b233df5a8f6a397431f6809 100644 (file)
@@ -313,33 +313,12 @@ impl Visualization {
         }
         let footnotes = pivot::Footnotes::from_iter(footnotes);
 
-        for (purpose, area) in [
-            (Purpose::Title, Area::Title),
-            (Purpose::SubTitle, Area::Caption),
-            (Purpose::Layer, Area::Layers),
-            (Purpose::Footnote, Area::Footer),
-        ] {
-            for label in &labels[purpose] {
-                label.decode_style(&mut look.areas[area], &styles);
-            }
-        }
         let title = LabelFrame::decode_label(&labels[Purpose::Title], &footnotes);
         let mut caption_labels = &labels[Purpose::SubTitle];
         if caption_labels.is_empty() {
             caption_labels = &labels[Purpose::Footnote];
         }
         let caption = LabelFrame::decode_label(&caption_labels, &footnotes);
-        if let Some(style) = &graph.interval.labeling.style
-            && let Some(style) = styles.get(style.references.as_str())
-        {
-            Style::decode_area(
-                Some(*style),
-                graph.cell_style.get(&styles),
-                &mut look.areas[Area::Data(RowParity::Even)],
-            );
-            look.areas[Area::Data(RowParity::Odd)] =
-                look.areas[Area::Data(RowParity::Even)].clone();
-        }
 
         let _show_grid_lines = extension
             .as_ref()
@@ -419,15 +398,6 @@ impl Visualization {
             } else {
                 (false, None, None, None)
             };
-            if let Ok(a) = Axis2::try_from(a)
-                && let Some(axis) = axes.get(&(base_level + variables.len() - 1))
-            {
-                Style::decode_area(
-                    axis.major_ticks.style.get(&styles),
-                    axis.major_ticks.tick_frame_style.get(&styles),
-                    &mut look.areas[Area::Labels(a)],
-                );
-            }
 
             if a == Axis3::Y
                 && let Some(axis) = axes.get(&base_level)
@@ -826,7 +796,7 @@ impl Visualization {
                 }
             }
 
-            #[derive(Default)]
+            #[derive(Default, Debug)]
             struct Target<'a> {
                 graph: Option<&'a Style>,
                 labeling: Option<&'a Style>,
@@ -838,6 +808,7 @@ impl Visualization {
             impl<'a> Target<'a> {
                 fn decode(
                     &self,
+                    scp: &SetCellProperties,
                     intersect: &Intersect,
                     look: &mut Look,
                     series: &BTreeMap<&str, Series>,
@@ -859,21 +830,8 @@ impl Visualization {
                         }
                     }
 
+                    dbg!(&scp.id, self, intersect);
                     match self {
-                        Self {
-                            graph: Some(_),
-                            labeling: Some(_),
-                            interval: None,
-                            major_ticks: None,
-                            frame: None,
-                            format: None,
-                        } if alternating => {
-                            let mut style = AreaStyle::default_for_area(Area::Data(RowParity::Odd));
-                            Style::decode_area(self.labeling, self.graph, &mut style);
-                            let font_style = &mut look.areas[Area::Data(RowParity::Odd)].font_style;
-                            font_style.fg = style.font_style.fg;
-                            font_style.bg = style.font_style.bg;
-                        }
                         Self {
                             graph: Some(_),
                             labeling: None,
@@ -906,6 +864,7 @@ impl Visualization {
                             if !wheres.is_empty() =>
                         {
                             // Formatting for individual row or column labels.
+                            dbg!();
                             for w in &wheres {
                                 let Some(s) = series.get(w.variable.as_str()) else {
                                     continue;
@@ -949,6 +908,7 @@ impl Visualization {
                         } => {
                             // Formatting for individual cells or groups of them
                             // with some dimensions in common.
+                            dbg!(&scp.id);
                             let mut include = vec![HashSet::new(); dims.len()];
                             for w in &wheres {
                                 let Some(s) = series.get(w.variable.as_str()) else {
@@ -1000,6 +960,7 @@ impl Visualization {
                                     );
                                 }
                             }
+                            dbg!();
                         }
                         _ => (),
                     }
@@ -1024,6 +985,9 @@ impl Visualization {
                     }
                     Set::SetFormat(sf) => {
                         let target_type = TargetType::from_id(&sf.target, graph, &major_ticks);
+                        if target.format.is_some() {
+                            dbg!();
+                        }
                         target.format = Some((sf, target_type))
                     }
                     Set::SetMetaData(_) => (),
@@ -1037,6 +1001,7 @@ impl Visualization {
                 (Some(union_), false) => {
                     for intersect in &union_.intersects {
                         target.decode(
+                            scp,
                             intersect,
                             &mut look,
                             &series,
@@ -1972,9 +1937,10 @@ impl Style {
     ) {
         if let Some(sf) = sf {
             if let Some(child) = &sf.child
-                && let Some(format) = child.decode_format()
+                && let Some(format) = dbg!(child.decode_format())
                 && let Some(datum_value) = value.inner.as_datum_value_mut()
             {
+                dbg!(&datum_value);
                 match &datum_value.datum {
                     Datum::Number(_) => {
                         datum_value.format = format;