1pub mod list_bullet_configuration_record;
2pub mod compilation_configuration_overlay;
3
4use std::{collections::HashMap, path::PathBuf};
5use getset::{CopyGetters, Getters, MutGetters, Setters};
6use crate::{bibliography::Bibliography, resource::text_reference::TextReferenceMap, theme::Theme};
7use self::list_bullet_configuration_record::ListBulletConfigurationRecord;
8
9
10
11#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)]
12pub enum CompilableResourceType {
13 Dossier,
14 File,
15
16 #[default]
17 Unknown
18}
19
20
21#[derive(Debug, Getters, CopyGetters, MutGetters, Setters, Clone)]
23pub struct CompilationConfiguration {
24
25 #[getset(get = "pub", set = "pub")]
26 input_location: PathBuf,
27
28 #[getset(get = "pub", set = "pub")]
29 output_location: PathBuf,
30
31 #[getset(get_copy = "pub", set = "pub")]
32 embed_local_image: bool,
33
34 #[getset(get_copy = "pub", set = "pub")]
35 embed_remote_image: bool,
36
37 #[getset(get_copy = "pub", set = "pub")]
38 compress_embed_image: bool,
39
40 #[getset(get_copy = "pub", set = "pub")]
41 strict_image_src_check: bool,
42
43 #[getset(get_copy = "pub", set = "pub")]
44 parallelization: bool,
45
46 #[getset(get = "pub", set = "pub")]
47 list_bullets_configuration: Vec<ListBulletConfigurationRecord>,
48
49 #[getset(get_copy = "pub", set = "pub")]
50 strict_list_check: bool,
51
52 #[getset(get_copy = "pub", set = "pub")]
53 strict_focus_block_check: bool,
54
55 #[getset(get = "pub", set = "pub")]
56 references: TextReferenceMap,
57
58 #[getset(get_copy = "pub", set = "pub")]
59 fast_draft: bool,
60
61 #[getset(get = "pub", set = "pub")]
62 bibliography: Option<Bibliography>,
63
64 #[getset(get = "pub", set = "pub")]
65 theme: Theme,
66
67 #[getset(get = "pub", set = "pub")]
68 resource_type: CompilableResourceType,
69
70 #[getset(get_copy = "pub", set = "pub")]
71 strict_greek_letters_check: bool,
72
73 #[getset(get_copy = "pub", set = "pub")]
74 strict_cite_check: bool,
75
76 #[getset(get_copy = "pub", set = "pub")]
77 strict_reference_check: bool,
78}
79
80impl CompilationConfiguration {
81
82 pub fn new(input_location: PathBuf, output_location: PathBuf, embed_local_image: bool, embed_remote_image: bool,
83 compress_embed_image: bool, strict_image_src_check: bool,
84 parallelization: bool, list_bullets_configuration: Vec<ListBulletConfigurationRecord>, strict_list_check: bool,
85 strict_focus_block_check: bool, references: TextReferenceMap, fast_draft: bool, bibliography: Option<Bibliography>,
86 theme: Theme, resource_type: CompilableResourceType, strict_greek_letters_check: bool, strict_cite_check: bool,
87 strict_reference_check: bool,) -> Self {
88
89 Self {
90 input_location,
91 output_location,
92 embed_local_image,
93 embed_remote_image,
94 compress_embed_image,
95 strict_image_src_check,
96 parallelization,
97 list_bullets_configuration,
98 strict_list_check,
99 strict_focus_block_check,
100 references,
101 fast_draft,
102 bibliography,
103 theme,
104 resource_type,
105 strict_cite_check,
106 strict_greek_letters_check,
107 strict_reference_check,
108 }
109 }
110}
111
112impl Default for CompilationConfiguration {
113 fn default() -> Self {
114 Self {
115 input_location: PathBuf::from("."),
116 output_location: PathBuf::from("."),
117 embed_local_image: true,
118 embed_remote_image: false,
119 compress_embed_image: false,
120 strict_image_src_check: false,
121 parallelization: false,
122 list_bullets_configuration: list_bullet_configuration_record::default_bullets_configuration(),
123 strict_list_check: false,
124 strict_focus_block_check: false,
125 references: HashMap::new(),
126 fast_draft: false,
127 bibliography: None,
128 theme: Theme::default(),
129 resource_type: CompilableResourceType::default(),
130 strict_cite_check: true,
131 strict_greek_letters_check: true,
132 strict_reference_check: true,
133 }
134 }
135}