diff options
author | hcpl <hcpl.prog@gmail.com> | 2017-05-29 11:08:08 +0300 |
---|---|---|
committer | hcpl <hcpl.prog@gmail.com> | 2017-05-29 11:08:08 +0300 |
commit | 2575cc6f74c17fc73197b7f6003772ed316b4751 (patch) | |
tree | 3775b6ba09b627fa8342718e295355909e3bf7b8 | |
parent | 3619959fb1f1e10a80e4630c772d5670b4f3dacb (diff) |
Revert and apply table format changes
* FORMAT_NO_LINESEP_WITH_TITLE:
Because of how everywhere else the render has thin title separator:
- code now behaves like the old version;
- changed its rustdoc description.
* FORMAT_NO_LINESEP:
This format has no line separators, but this fact doesn't apply to
borders.
- add top and bottom separators;
- update the corresponding example.
* FORMAT_BORDERS_ONLY:
- remove delimiter lines between non-titles.
-rw-r--r-- | examples/formatting.rs | 1 | ||||
-rw-r--r-- | src/format.rs | 5 | ||||
-rw-r--r-- | src/lib.rs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/formatting.rs b/examples/formatting.rs index 1ea0e18..d994796 100644 --- a/examples/formatting.rs +++ b/examples/formatting.rs @@ -35,7 +35,6 @@ fn main() { // | Title 1 Title 2 |
// +=========================+
// | Value 1 Value 2 |
- // +-------------------------+
// | Value three Value four |
// +-------------------------+
println!("FORMAT_BORDERS_ONLY :");
diff --git a/src/format.rs b/src/format.rs index d516895..bc093ac 100644 --- a/src/format.rs +++ b/src/format.rs @@ -310,7 +310,7 @@ pub mod consts { /// ```text
/// +----+----+
/// | T1 | T2 |
- /// +====+====+
+ /// +----+----+
/// | a | b |
/// | c | d |
/// +----+----+
@@ -318,7 +318,7 @@ pub mod consts { pub static ref FORMAT_NO_LINESEP_WITH_TITLE: TableFormat = FormatBuilder::new()
.column_separator('|')
.borders('|')
- .separator(LinePosition::Title, *EQU_PLUS_SEP)
+ .separator(LinePosition::Title, *MINUS_PLUS_SEP)
.separator(LinePosition::Bottom, *MINUS_PLUS_SEP)
.separator(LinePosition::Top, *MINUS_PLUS_SEP)
.padding(1, 1)
@@ -387,7 +387,6 @@ pub mod consts { /// ```
pub static ref FORMAT_BORDERS_ONLY: TableFormat = FormatBuilder::new()
.padding(1, 1)
- .separator(LinePosition::Intern, *MINUS_PLUS_SEP)
.separator(LinePosition::Title, *EQU_PLUS_SEP)
.separator(LinePosition::Bottom, *MINUS_PLUS_SEP)
.separator(LinePosition::Top, *MINUS_PLUS_SEP)
@@ -634,9 +634,11 @@ mod tests { assert_eq!(table[1][1].get_content(), "newval");
let out = "\
++-----+--------+-----+
| t1 | t2 | t3 |
| a | bc | def |
| def | newval | a |
++-----+--------+-----+
";
assert_eq!(table.to_string().replace("\r\n", "\n"), out);
}
|