1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! This crate implements ECMA standards for coded characters in rust.
//!
//! Various constructions are provided to easily add control character and sequences inside text.
//!
//! This crate is compatible with ANSI terminals.
//!
//! ### Standards implemented
//! - [ecma-35](https://ecma-international.org/publications-and-standards/standards/ecma-35/) - Character Code Structure and Extension Techniques
//! - [ecma-43](https://ecma-international.org/publications-and-standards/standards/ecma-43/) - 8-Bit Coded Character Set Structure and Rules
//! - [ecma-48](https://ecma-international.org/publications-and-standards/standards/ecma-48/) - Control Functions for Coded Character Sets
//!
//! ### Example : format text in an ANSI terminal
//! ```
//! use coded_chars::control::rendition::{format_str, next_page, select_graphic};
//!
//! // Direct format
//! println!("Hello {}{}{} !", select_graphic().fg_red().bold().underline(), "World", select_graphic().default());
//!
//! // Clear screen
//! next_page(1);
//!
//! // Using format_str
//! let formatted = format_str(
//!     "World",
//!     select_graphic().fg_red().bold().underline()
//!  );
//! println!("Hello {} !", formatted);
//! ```

pub mod characters;
pub mod escape;
pub mod control;


#[cfg(test)]
mod tests {
    use crate::control::area::clear_screen;
    use crate::control::rendition::{format_str, select_graphic};

    #[test]
    fn test() {

        // Direct format
        println!("Hello {}{}{} !", select_graphic().fg_red().bold().underline(), "World", select_graphic().default());

        // Clear screen
        clear_screen();

        // Using format_str
        let formatted = format_str(
            "World",
            select_graphic().fg_red().bold().underline()
        );
        println!("Hello {} !", formatted);
    }

}