math-core-renderer-internal 0.7.0

Internal crate used by math-core
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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'),
        }
    }
}