diff options
author | Jovansonlee Cesar <ivanceras@gmail.com> | 2021-08-14 14:46:41 +0800 |
---|---|---|
committer | Jovansonlee Cesar <ivanceras@gmail.com> | 2021-08-14 14:46:41 +0800 |
commit | 4dcb2554859fc0ae58abde7de9537bdaf644b9ea (patch) | |
tree | 3497af02b737ab80ba25b1f9449ab7421beeff8a | |
parent | cd700b6d0ad0279b3f12d449ceaa2b01130ed6f5 (diff) |
Add a compressed variant to the generated svg
-rw-r--r-- | svgbob/src/lib.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/svgbob/src/lib.rs b/svgbob/src/lib.rs index bd4fe48..2e3cbb3 100644 --- a/svgbob/src/lib.rs +++ b/svgbob/src/lib.rs @@ -15,8 +15,12 @@ pub use point::Point; pub use sauron; pub use sauron::{Node, Render}; -/// convert svgbob ascii art to svg pub fn to_svg(ascii: &str) -> String { + to_svg_string_pretty(ascii) +} + +/// convert svgbob ascii art to svg string with indentions +pub fn to_svg_string_pretty(ascii: &str) -> String { let cb = CellBuffer::from(ascii); let node: Node<()> = cb.get_node(); let mut buffer = String::new(); @@ -24,6 +28,13 @@ pub fn to_svg(ascii: &str) -> String { buffer } +/// convert svgbob ascii art to svg string +pub fn to_svg_string_compressed(ascii: &str) -> String { + let cb = CellBuffer::from(ascii); + let node: Node<()> = cb.get_node(); + node.render_to_string() +} + /// convert ascii art into an svg pub fn to_svg_with_settings(ascii: &str, settings: &Settings) -> String { let cb = CellBuffer::from(ascii); |