feat: add __term/tui-markup-demo/
This commit is contained in:
@@ -247,7 +247,8 @@ Project or files:
|
|||||||
│ ├── rustyline
|
│ ├── rustyline
|
||||||
│ ├── structopt
|
│ ├── structopt
|
||||||
│ ├── tabled
|
│ ├── tabled
|
||||||
│ └── term
|
│ ├── term
|
||||||
|
│ └── tui-markup-demo
|
||||||
├── __time
|
├── __time
|
||||||
│ ├── chrono
|
│ ├── chrono
|
||||||
│ ├── humantime-demo
|
│ ├── humantime-demo
|
||||||
@@ -308,6 +309,6 @@ Project or files:
|
|||||||
├── vec.rs
|
├── vec.rs
|
||||||
└── while.rs
|
└── while.rs
|
||||||
|
|
||||||
280 directories, 38 files
|
281 directories, 38 files
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
92
__term/tui-markup-demo/Cargo.lock
generated
Normal file
92
__term/tui-markup-demo/Cargo.lock
generated
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytecount"
|
||||||
|
version = "0.6.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "minimal-lexical"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom"
|
||||||
|
version = "7.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"minimal-lexical",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom_locate"
|
||||||
|
version = "4.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3"
|
||||||
|
dependencies = [
|
||||||
|
"bytecount",
|
||||||
|
"memchr",
|
||||||
|
"nom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tui-markup"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5437c754f57a2aa554adc76c607d45c4a1a8a3f86f7e261811b361872eec0b69"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
|
"nom",
|
||||||
|
"nom_locate",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tui-markup-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
|
"tui-markup",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu",
|
||||||
|
"winapi-x86_64-pc-windows-gnu",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
8
__term/tui-markup-demo/Cargo.toml
Normal file
8
__term/tui-markup-demo/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "tui-markup-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
ansi_term = "0.12.1"
|
||||||
|
tui-markup = { version = "0.5.0",features = ["ansi"] }
|
||||||
20
__term/tui-markup-demo/src/main.rs
Normal file
20
__term/tui-markup-demo/src/main.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
use ansi_term::{ANSIStrings, Color, Style};
|
||||||
|
use tui_markup::generator::ANSIStringsGenerator;
|
||||||
|
use tui_markup::{compile, compile_with};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Parse markup into some final result for showing
|
||||||
|
let result = compile::<ANSIStringsGenerator>("You got a <yellow Coin>").unwrap();
|
||||||
|
// Show it
|
||||||
|
println!("{}", ANSIStrings(&result));
|
||||||
|
|
||||||
|
// With custom tag
|
||||||
|
let generator = ANSIStringsGenerator::new(|tag: &str| match tag {
|
||||||
|
"keyboard" => Some(Style::default().fg(Color::Blue).on(Color::Black).bold()),
|
||||||
|
"bold" => Some(Style::default().bold()),
|
||||||
|
"under" => Some(Style::default().underline()),
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
let result = compile_with("Press <keyboard Space> to <bold <under jump>>", generator).unwrap();
|
||||||
|
println!("{}", ANSIStrings(&result));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user