Skip to content

Commit

Permalink
Fix typos across the project
Browse files Browse the repository at this point in the history
  • Loading branch information
Elric Milon authored and zhiburt committed Dec 13, 2022
1 parent 000b4be commit 64d6808
Show file tree
Hide file tree
Showing 40 changed files with 183 additions and 183 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `ByColumnName` locator to target columns via name and use it as `Object`.
- Added `VerticalLine` to set custom vertical lines.
- Added `Height` structure to control table/cell height.
- Added `BorderChar` to set a char by an arbitraty offest on a split horizonta/vertical lines.
- Added `BorderChar` to set a char by an arbitrary offset on a split horizonta/vertical lines.
- Added support for `fmt::*` settings when called with `format`/`println`.
- Created `json_to_table` crate to convert json into table.
- `papergrid` has got a few new functions.
Expand Down Expand Up @@ -229,7 +229,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- `MaxWidth` interface changed in regard to support `wrapping`. Now old `MaxWidth` logic can be called by `MaxWidth::trucating`.
- `MaxWidth` interface changed in regard to support `wrapping`. Now old `MaxWidth` logic can be called by `MaxWidth::truncating`.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This file contains an overview of examples.
- `derive` folder contains a list of examples which uses different `#[derive(Tabled)]` attributes.
- `show` folder contains a program which uses different styles and prints the resulting table.
- `terminal_size` folder contains a program which spreads the table to the max terminal width and max terminal height.
You can use wich dimension to use via args `--width`, `--height` by default 2 are used.
You can use which dimension to use via args `--width`, `--height` by default 2 are used.

Bellow there's a list of results of running some examples.

Expand Down
6 changes: 3 additions & 3 deletions examples/nested_table_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Contribution {
}

fn main() {
let commiters = [
let committers = [
Contribution::new("kozmod", "https:/github.com/kozmod"),
Contribution::new("IsaacCloos", "https:/github.com/IsaacCloos"),
];
Expand All @@ -29,7 +29,7 @@ fn main() {
"https:/github.com/aharpervc",
)];

let commiters_table = commiters
let committers_table = committers
.table()
.with(Panel::header("Contributors"))
.with(Modify::new(Segment::all()).with(Alignment::center()))
Expand All @@ -41,7 +41,7 @@ fn main() {
.with(Modify::new(Segment::all()).with(Alignment::center()))
.to_string();

let mut a_welcome_table = [String::from("Thank You"), commiters_table, issues_table].table();
let mut a_welcome_table = [String::from("Thank You"), committers_table, issues_table].table();
a_welcome_table
.with(Extract::rows(1..))
.with(Style::ascii().off_horizontal())
Expand Down
2 changes: 1 addition & 1 deletion examples/shadow.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The example relayes on STDIN to read the message which will be outputed.
//! The example relayes on STDIN to read the message which will be outputted.
//!
//! The table is inspired by <https://en.wikipedia.org/wiki/Box-drawing_character>
//!
Expand Down
2 changes: 1 addition & 1 deletion examples/table_width.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! The example can be run by this command
//! `cargo run --example table_width`

use tabled::{measurment::Percent, object::Segment, Alignment, Modify, Style, Table, Width};
use tabled::{measurement::Percent, object::Segment, Alignment, Modify, Style, Table, Width};

fn main() {
let data = [
Expand Down
2 changes: 1 addition & 1 deletion json_to_table/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
keywords = ["table", "print", "pretty-table", "format", "json"]
categories = ["text-processing", "visualization"]
readme = "README.md"
description = "A libary for pretty print JSON as a table"
description = "A library for pretty print JSON as a table"

[features]
color = ["tabled/color"]
Expand Down
6 changes: 3 additions & 3 deletions papergrid/src/config/borders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ pub struct Borders<T = char> {
/// A vertical split on the right frame line.
pub vertical_right: Option<T>,

/// A top left charcter on the frame.
/// A top left character on the frame.
pub intersection: Option<T>,
}

Expand Down Expand Up @@ -439,7 +439,7 @@ pub(crate) struct BordersLayout {
verticals: HashSet<usize>,
}

/// A structre for a custom horizontal line.
/// A structure for a custom horizontal line.
#[derive(Debug, Clone, Copy, Default)]
pub struct HorizontalLine<T> {
/// Line character.
Expand All @@ -462,7 +462,7 @@ impl<T> HorizontalLine<T> {
}
}

/// A structre for a vertical line.
/// A structure for a vertical line.
#[derive(Debug, Clone, Copy, Default)]
pub struct VerticalLine<T> {
/// Line character.
Expand Down
6 changes: 3 additions & 3 deletions papergrid/src/config/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ pub struct Formatting {
/// An setting to allow vertical trim.
pub vertical_trim: bool,
/// An setting to allow alignment per line.
pub allow_lines_alignement: bool,
pub allow_lines_alignment: bool,
}

impl Formatting {
/// Creates a new [`Formatting`] structure.
pub fn new(horizontal_trim: bool, vertical_trim: bool, allow_lines_alignement: bool) -> Self {
pub fn new(horizontal_trim: bool, vertical_trim: bool, allow_lines_alignment: bool) -> Self {
Self {
horizontal_trim,
vertical_trim,
allow_lines_alignement,
allow_lines_alignment,
}
}
}
40 changes: 20 additions & 20 deletions papergrid/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl GridConfig {
self.borders.remove_horizontal_line(row);
}

/// Gets a overriden vertical line.
/// Gets a overridden vertical line.
///
/// Row `0` means the top row.
/// Row `grid.count_rows()` means the bottom row.
Expand All @@ -243,7 +243,7 @@ impl GridConfig {
self.borders.remove_vertical_line(row);
}

/// Gets a overriden line.
/// Gets a overridden line.
///
/// Row `0` means the top row.
/// Row `grid.count_rows()` means the bottom row.
Expand Down Expand Up @@ -291,8 +291,8 @@ impl GridConfig {
chars.insert(offset, c);
}

/// Get a list of overriden chars in a horizontal border.
pub fn lookup_overidden_horizontal(
/// Get a list of overridden chars in a horizontal border.
pub fn lookup_overridden_horizontal(
&self,
pos: Position,
offset: usize,
Expand All @@ -316,13 +316,13 @@ impl GridConfig {
.copied()
}

/// Checks if there any char in a horizontal border being overriden.
pub fn is_overidden_horizontal(&self, pos: Position) -> bool {
/// Checks if there any char in a horizontal border being overridden.
pub fn is_overridden_horizontal(&self, pos: Position) -> bool {
self.override_horizontal_borders.get(&pos).is_some()
}

/// Removes a list of overriden chars in a horizontal border.
pub fn remove_overidden_horizontal(&mut self, pos: Position) {
/// Removes a list of overridden chars in a horizontal border.
pub fn remove_overridden_horizontal(&mut self, pos: Position) {
self.override_horizontal_borders.remove(&pos);
}

Expand All @@ -338,8 +338,8 @@ impl GridConfig {
chars.insert(offset, c);
}

/// Get a list of overriden chars in a horizontal border.
pub fn lookup_overidden_vertical(
/// Get a list of overridden chars in a horizontal border.
pub fn lookup_overridden_vertical(
&self,
pos: Position,
offset: usize,
Expand All @@ -363,13 +363,13 @@ impl GridConfig {
.copied()
}

/// Checks if there any char in a horizontal border being overriden.
pub fn is_overidden_vertical(&self, pos: Position) -> bool {
/// Checks if there any char in a horizontal border being overridden.
pub fn is_overridden_vertical(&self, pos: Position) -> bool {
self.override_vertical_borders.get(&pos).is_some()
}

/// Removes a list of overriden chars in a horizontal border.
pub fn remove_overidden_vertical(&mut self, pos: Position) {
/// Removes a list of overridden chars in a horizontal border.
pub fn remove_overridden_vertical(&mut self, pos: Position) {
self.override_vertical_borders.remove(&pos);
}

Expand Down Expand Up @@ -458,12 +458,12 @@ impl GridConfig {

/// Sets off all borders possible on the [`Entity`].
///
/// It doesn't changes globaly set borders through [`GridConfig::set_borders`].
/// It doesn't changes globally set borders through [`GridConfig::set_borders`].
pub fn remove_border(&mut self, pos: Position, shape: (usize, usize)) {
self.borders.remove_border(pos, shape);
}

/// Set a character wich will be used in case any missconfiguration of borders.
/// Set a character which will be used in case any misconfiguration of borders.
///
/// It will be usde for example when you set a left char for border frame and top but didn't set a top left corner.
pub fn set_borders_missing(&mut self, c: char) {
Expand Down Expand Up @@ -767,18 +767,18 @@ fn is_column_span_valid(
span: usize,
(count_rows, count_cols): (usize, usize),
) -> bool {
// ignore spans which are invlid
// ignore spans which are invalid
let pos_correct = pos.1 < count_cols && pos.0 < count_rows;
// ignore a span range wich begger then count rows
// ignore a span range which begger then count rows
let span_correct = span + pos.1 <= count_cols;

pos_correct && span_correct
}

fn is_row_span_valid(pos: Position, span: usize, (count_rows, count_cols): (usize, usize)) -> bool {
// ignore spans which are invlid
// ignore spans which are invalid
let pos_correct = pos.1 < count_cols && pos.0 < count_rows;
// ignore a span range wich begger then count columns
// ignore a span range which begger then count columns
let span_correct = span + pos.0 <= count_rows;

pos_correct && span_correct
Expand Down
22 changes: 11 additions & 11 deletions papergrid/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ fn print_horizontal_border(
width: usize,
c: char,
) -> fmt::Result {
if cfg.is_overidden_horizontal(pos) {
if cfg.is_overridden_horizontal(pos) {
for i in 0..width {
let c = cfg.lookup_overidden_horizontal(pos, i, width).unwrap_or(c);
let c = cfg.lookup_overridden_horizontal(pos, i, width).unwrap_or(c);

f.write_char(c)?;
}
Expand Down Expand Up @@ -805,9 +805,9 @@ where
(line, width)
};

if formatting.allow_lines_alignement {
if formatting.allow_lines_alignment {
let (left, right) = calculate_indent(alignment, line_width, available_width);
return print_text_formated(f, records, pos, &line, tab_width, left, right);
return print_text_formatted(f, records, pos, &line, tab_width, left, right);
}

let cell_width = if formatting.horizontal_trim {
Expand All @@ -821,7 +821,7 @@ where
};

let (left, right) = calculate_indent(alignment, cell_width, available_width);
print_text_formated(f, records, pos, &line, tab_width, left, right)?;
print_text_formatted(f, records, pos, &line, tab_width, left, right)?;

let rest_width = cell_width - line_width;
repeat_char(f, DEFAULT_SPACE_CHAR, rest_width)?;
Expand All @@ -830,7 +830,7 @@ where
}

#[allow(unused)]
fn print_text_formated<R>(
fn print_text_formatted<R>(
f: &mut fmt::Formatter<'_>,
records: &R,
pos: Position,
Expand Down Expand Up @@ -1003,8 +1003,8 @@ where
{
let left = get_vertical(cfg, records, pos);
if let Some(c) = left {
let c = if cfg.is_overidden_vertical(pos) {
cfg.lookup_overidden_vertical(pos, line_index, count_lines)
let c = if cfg.is_overridden_vertical(pos) {
cfg.lookup_overridden_vertical(pos, line_index, count_lines)
.unwrap_or(*c)
} else {
*c
Expand Down Expand Up @@ -1359,15 +1359,15 @@ mod tests {
use super::*;

#[test]
fn horizontal_aligment_test() {
fn horizontal_alignment_test() {
use std::fmt;

struct F<'a>(&'a str, AlignmentHorizontal, usize);

impl fmt::Display for F<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (left, right) = calculate_indent(self.1, string_width(self.0), self.2);
print_text_formated(f, &EmptyRecords::default(), (0, 0), self.0, 4, left, right)
print_text_formatted(f, &EmptyRecords::default(), (0, 0), self.0, 4, left, right)
}
}

Expand All @@ -1389,7 +1389,7 @@ mod tests {
}

#[test]
fn vertical_aligment_test() {
fn vertical_alignment_test() {
use AlignmentVertical::*;

assert_eq!(indent_from_top(Bottom, 1, 1), 0);
Expand Down
4 changes: 2 additions & 2 deletions papergrid/src/records/cell_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl Clone for CellInfo<'_> {
// # Safety
//
// It must be safe because the referenced string and the references are dropped at the same time.
// And the referenced String is guaranted to not be changed.
// And the referenced String is guaranteed to not be changed.
let text = unsafe {
let text_ptr = self.text.as_ptr();
let line_ptr = s.as_ptr();
Expand Down Expand Up @@ -175,7 +175,7 @@ where
// # Safety
//
// It must be safe because the referenced string and the references are dropped at the same time.
// And the referenced String is guaranted to not be changed.
// And the referenced String is guaranteed to not be changed.
let text = unsafe {
std::str::from_utf8_unchecked(std::slice::from_raw_parts(
info.text.as_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion papergrid/src/records/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct EmptyRecords {
}

impl EmptyRecords {
/// Constracts an empty representation of [`Records`] with a given shape.
/// Constructs an empty representation of [`Records`] with a given shape.
pub fn new(rows: usize, cols: usize) -> Self {
Self { rows, cols }
}
Expand Down
4 changes: 2 additions & 2 deletions papergrid/src/records/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The module contains a [Records] abstraction of a [`Grid`] trait and its implementators.
//! The module contains a [Records] abstraction of a [`Grid`] trait and its implementers.
//!
//! [`Grid`]: crate::Grid

Expand All @@ -11,7 +11,7 @@ pub mod vec_records;
#[cfg(feature = "color")]
pub mod tcell;

/// The representaion of data, rows and columns of a [`Grid`].
/// The representation of data, rows and columns of a [`Grid`].
///
/// [`Grid`]: crate::Grid
pub trait Records {
Expand Down
4 changes: 2 additions & 2 deletions papergrid/src/records/vec_records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ where
cells
}

/// Cell imlementation which can be used with [`VecRecords`].
/// Cell implementation which can be used with [`VecRecords`].
pub trait Cell: AsRef<str> {
/// Gets a line by index.
fn get_line(&self, i: usize) -> &str;
Expand Down Expand Up @@ -348,7 +348,7 @@ pub trait CellMut<T> {
where
W: WidthFunc;

/// Trigers an update a cell.
/// Triggers an update a cell.
///
/// It may be caused if width function was changed.
fn update<W>(&mut self, width_ctrl: W)
Expand Down
2 changes: 1 addition & 1 deletion papergrid/tests/styling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ test_table!(
);

test_table!(
when_border_is_not_complet_default_char_is_used_test,
when_border_is_not_complete_default_char_is_used_test,
grid(2, 2)
.config(|cfg| {
cfg.set_borders(Borders {
Expand Down
2 changes: 1 addition & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ fn build_index(mut b: IndexBuilder<'_>) -> Builder<'_> {

let records = &mut b.b.records;

// it's guaranted to be set
// it's guaranteed to be set
let columns = b.b.columns.take().unwrap();

records.insert(0, columns);
Expand Down
Loading

0 comments on commit 64d6808

Please sign in to comment.