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
use std::path::PathBuf;
use once_cell::sync::Lazy;
pub static CRATE_ROOT: Lazy<PathBuf> = Lazy::new(|| env!("CARGO_MANIFEST_DIR").into());
pub static HOME: Lazy<PathBuf> = Lazy::new(|| home::home_dir().unwrap());
pub const DATE_FORMAT: &str = "%Y-%m-%d-%H%M%S";
#[cfg(test)]
pub static EXAMPLE_TEMPLATES: Lazy<PathBuf> = Lazy::new(|| {
let mut path = CRATE_ROOT.to_owned();
path.push("templates");
path
});
#[cfg(test)]
pub static TEST_TEMPLATES: Lazy<PathBuf> = Lazy::new(|| {
let mut path = CRATE_ROOT.to_owned();
path.extend(["data", "templates"].iter());
path
});
pub static UNICODE_TO_ASCII_SYMBOLS: Lazy<Vec<(char, &str)>> = Lazy::new(|| {
[
('‘', "'"),
('’', "'"),
('“', "\""),
('”', "\""),
('»', "<<"),
('«', ">>"),
('…', "..."),
('–', "--"),
('—', "---"),
]
.into_iter()
.collect()
});