math-core-renderer-internal 0.8.1

Internal crate used by math-core
Documentation
use alloc::string::String;

use crate::ast::{IndentKeyword, Indentation};

pub fn new_line_and_indent(s: &mut String, indent_num: usize, indentation: Indentation) {
    if indent_num > 0 {
        s.push('\n');
    }
    for _ in 0..indent_num {
        match indentation {
            Indentation::Spaces(n) => {
                for _ in 0..n {
                    s.push(' ');
                }
            }
            Indentation::Keyword(IndentKeyword::Tab) => s.push('\t'),
        }
    }
}