This commit is contained in:
philipp 2023-11-07 10:10:28 +01:00
parent b404432cfb
commit 947c75e4cc
2 changed files with 25 additions and 1 deletions

View File

@ -102,6 +102,13 @@ impl From<ClassifierInstance> for HeadingContent {
} }
} }
pub(crate) fn contains_without_unter(classifier_name: &str, instance_name: &str) -> bool {
instance_name
.to_lowercase()
.contains(&classifier_name.to_lowercase())
&& !instance_name.to_lowercase().contains("unter")
}
pub(crate) fn contains(classifier_name: &str, instance_name: &str) -> bool { pub(crate) fn contains(classifier_name: &str, instance_name: &str) -> bool {
instance_name instance_name
.to_lowercase() .to_lowercase()
@ -226,6 +233,23 @@ impl LawBuilder {
classifiers.push(Classifier::new("letter", Arc::new(&starts_with_letter))); classifiers.push(Classifier::new("letter", Arc::new(&starts_with_letter)));
classifiers.push(Classifier::new("num", Arc::new(&starts_with_number))); classifiers.push(Classifier::new("num", Arc::new(&starts_with_number)));
classifiers.push(Classifier::new("rom", Arc::new(&starts_with_roman_number))); classifiers.push(Classifier::new("rom", Arc::new(&starts_with_roman_number)));
} else if name == "FSG" {
law_id = Some(10003898);
classifiers.push(Classifier::new("Artikel", Arc::new(&contains)).root());
classifiers.push(Classifier::new(
"Abschnitt",
Arc::new(&contains_without_unter),
));
classifiers.push(Classifier::new("Hauptstück", Arc::new(&contains)));
classifiers.push(Classifier::new("Unterabschnitt", Arc::new(&contains)));
classifiers.push(Classifier::new(
"uppercase letter",
Arc::new(&starts_with_uppercaseletter),
));
classifiers.push(Classifier::new("num", Arc::new(&starts_with_number)));
} }
let mut builder = Self { let mut builder = Self {

View File

@ -42,7 +42,7 @@ impl From<roxmltree::Error> for Error {
fn main() { fn main() {
env_logger::init(); env_logger::init();
let law = LawBuilder::new("ABGB"); let law = LawBuilder::new("MSchG");
law.to_md(); law.to_md();
} }