From 25c64cb80562eb540bff77544a692ec61e054872 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 15 Apr 2025 09:33:17 -0700 Subject: [PATCH] Change ascii art to unicode art --- rust/pspp/src/output/pivot/mod.rs | 54 +++++++++++----------- rust/pspp/src/output/pivot/output.rs | 68 ++++++++++++++-------------- 2 files changed, 60 insertions(+), 62 deletions(-) diff --git a/rust/pspp/src/output/pivot/mod.rs b/rust/pspp/src/output/pivot/mod.rs index 4f4f49ca00..65905cced5 100644 --- a/rust/pspp/src/output/pivot/mod.rs +++ b/rust/pspp/src/output/pivot/mod.rs @@ -713,18 +713,16 @@ pub enum LabelPosition { /// labels, group labels appear to the left of the categories. /// /// ```text - /// +---------+----------+ - /// | | columns | - /// +----+----+----+----+ +------+--+----------+ - /// | | nested | | |a1|...data...| - /// | +----+----+----+ |nested|a2|...data...| - /// | | a1 | a2 | a3 | | |a3|...data...| - /// +----+----+----+----+ +------+--+----------+ - /// | |data|data|data| - /// | | . | . | . | - /// |rows| . | . | . | - /// | | . | . | . | - /// +----+----+----+----+ + /// ┌────┬──────────────┐ ┌─────────┬──────────┐ + /// │ │ nested │ │ │ columns │ + /// │ ├────┬────┬────┤ ├──────┬──┼──────────┤ + /// │ │ a1 │ a2 │ a3 │ │ │a1│...data...│ + /// ├────┼────┼────┼────┤ │nested│a2│...data...│ + /// │ │data│data│data│ │ │a3│...data...│ + /// │ │ . │ . │ . │ └──────┴──┴──────────┘ + /// │rows│ . │ . │ . │ + /// │ │ . │ . │ . │ + /// └────┴────┴────┴────┘ /// ``` #[serde(rename = "nested")] Nested, @@ -732,13 +730,13 @@ pub enum LabelPosition { /// In the corner (row labels only). /// /// ```text - /// +------+----------+ - /// |corner| columns | - /// +------+----------+ - /// | a1|...data...| - /// | a2|...data...| - /// | a3|...data...| - /// +------+----------+ + /// ┌──────┬──────────┐ + /// │corner│ columns │ + /// ├──────┼──────────┤ + /// │ a1│...data...│ + /// │ a2│...data...│ + /// │ a3│...data...│ + /// └──────┴──────────┘ /// ``` #[default] #[serde(rename = "inCorner")] @@ -748,15 +746,15 @@ pub enum LabelPosition { /// The heading region of a rendered pivot table: /// /// ```text -/// +------------------+-------------------------------------------------+ -/// | | column headings | -/// | +-------------------------------------------------+ -/// | corner | | -/// | and | | -/// | row headings | data | -/// | | | -/// | | | -/// +------------------+-------------------------------------------------+ +/// ┌──────────────────┬─────────────────────────────────────────────────┐ +/// │ │ column headings │ +/// │ ├─────────────────────────────────────────────────┤ +/// │ corner │ │ +/// │ and │ │ +/// │ row headings │ data │ +/// │ │ │ +/// │ │ │ +/// └──────────────────┴─────────────────────────────────────────────────┘ /// ``` #[derive(Copy, Clone, Debug, PartialEq, Eq, Enum)] pub enum HeadingRegion { diff --git a/rust/pspp/src/output/pivot/output.rs b/rust/pspp/src/output/pivot/output.rs index 8c769eee5f..fd63bf8174 100644 --- a/rust/pspp/src/output/pivot/output.rs +++ b/rust/pspp/src/output/pivot/output.rs @@ -443,19 +443,19 @@ impl<'a> Heading<'a> { // than the far left and far right ones. Only the ones that // start in the last row of the heading are drawn with the // "category" style, the rest with the "dimension" style, - // e.g. only the # below are category style: + // e.g. only the `║` below are category style: // // ```text - // +-----------------------------------------------------+ - // | bbbb | - // +-----------------+-----------------+-----------------+ - // | bbbb1 | bbbb2 | bbbb3 | - // +-----------------+-----------------+-----------------+ - // | aaaa | aaaa | aaaa | - // +-----+-----+-----+-----+-----+-----+-----+-----+-----+ - // |aaaa1#aaaa2#aaaa3|aaaa1#aaaa2#aaaa3|aaaa1#aaaa2#aaaa3| - // +-----+-----+-----+-----+-----+-----+-----+-----+-----+ - // ``` + // ┌─────────────────────────────────────────────────────┐ + // │ bbbb │ + // ├─────────────────┬─────────────────┬─────────────────┤ + // │ bbbb1 │ bbbb2 │ bbbb3 │ + // ├─────────────────┼─────────────────┼─────────────────┤ + // │ aaaa │ aaaa │ aaaa │ + // ├─────╥─────╥─────┼─────╥─────╥─────┼─────╥─────╥─────┤ + // │aaaa1║aaaa2║aaaa3│aaaa1║aaaa2║aaaa3│aaaa1║aaaa2║aaaa3│ + // └─────╨─────╨─────┴─────╨─────╨─────┴─────╨─────╨─────┘ + //``` let row_col = RowColBorder(region, v); let border = if row == self.height - 1 && inner { Border::Category(row_col) @@ -469,22 +469,22 @@ impl<'a> Heading<'a> { } } - // Draws the horizontal lines within a dimension, that is, - // those that separate a category (or group) from its parent - // group or dimension's label. Our running example doesn't - // have groups but the `====` lines below show the - // separators between categories and their dimension label: + // Draws the horizontal lines within a dimension, that is, those + // that separate a category (or group) from its parent group or + // dimension's label. Our running example doesn't have groups + // but the `═════` lines below show the separators between + // categories and their dimension label: // // ```text - // +-----------------------------------------------------+ - // | bbbb | - // +=================+=================+=================+ - // | bbbb1 | bbbb2 | bbbb3 | - // +-----------------+-----------------+-----------------+ - // | aaaa | aaaa | aaaa | - // +=====+=====+=====+=====+=====+=====+=====+=====+=====+ - // |aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3| - // +-----+-----+-----+-----+-----+-----+-----+-----+-----+ + // ┌─────────────────────────────────────────────────────┐ + // │ bbbb │ + // ╞═════════════════╤═════════════════╤═════════════════╡ + // │ bbbb1 │ bbbb2 │ bbbb3 │ + // ├─────────────────┼─────────────────┼─────────────────┤ + // │ aaaa │ aaaa │ aaaa │ + // ╞═════╤═════╤═════╪═════╤═════╤═════╪═════╤═════╤═════╡ + // │aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│ + // └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ // ``` if row + 1 < self.height { table.draw_line(Border::Category(RowColBorder(region, h)), (h, y2), { @@ -608,15 +608,15 @@ impl<'a> Headings<'a> { // line here: // // ```text - // +-----------------------------------------------------+ __ - // | bbbb | | - // +-----------------+-----------------+-----------------+ |dim "bbbb" - // | bbbb1 | bbbb2 | bbbb3 | _| - // +=================+=================+=================+ __ - // | aaaa | aaaa | aaaa | | - // +-----+-----+-----+-----+-----+-----+-----+-----+-----+ |dim "aaaa" - // |aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3| _| - // +-----+-----+-----+-----+-----+-----+-----+-----+-----+ + // ┌─────────────────────────────────────────────────────┐ __ + // │ bbbb │ │ + // ├─────────────────┬─────────────────┬─────────────────┤ │dim "bbbb" + // │ bbbb1 │ bbbb2 │ bbbb3 │ _│ + // ╞═════════════════╪═════════════════╪═════════════════╡ __ + // │ aaaa │ aaaa │ aaaa │ │ + // ├─────┬─────┬─────┼─────┬─────┬─────┼─────┬─────┬─────┤ │dim "aaaa" + // │aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│ _│ + // └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ // ``` table.draw_line( Border::Dimension(RowColBorder(region, h)), -- 2.30.2