add name in law config
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m54s

This commit is contained in:
philipp 2024-02-17 10:40:00 +01:00
parent 3bc0a00517
commit b8de9e94af
12 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,6 @@
[law]
id = 10001622
name = "ABGB"
[[law.classifiers]]
name = "Theil"

View File

@ -1,5 +1,6 @@
[law]
id = 10001871
name = "Ehegesetz"
[[law.classifiers]]
name = "Abschnitt"

View File

@ -1,5 +1,6 @@
[law]
id = 10002462
name = "Konsumentenschutzgesetz"
[[law.classifiers]]
name = "Hauptstück"

View File

@ -1,5 +1,6 @@
[law]
id = 10002180
name = "Markenschutzgesetz"
[[law.classifiers]]
name = "Abschnitt"

View File

@ -1,5 +1,6 @@
[law]
id = 10012703
name = "Schifffahrtsgesetz"
[[law.classifiers]]
name = "Teil"

View File

@ -1,5 +1,6 @@
[law]
id = 10002296
name = "StGB"
[[law.classifiers]]
name = "Teil"

View File

@ -1,5 +1,6 @@
[law]
id = 10001905
name = "TEG"
[[law.classifiers]]
name = "Abschnitt"

View File

@ -1,5 +1,6 @@
[law]
id = 10001848
name = "Urhebergesetz"
[[law.classifiers]]
name = "Hauptstück"

View File

@ -1,5 +1,6 @@
[law]
id = 20001917
name = "Vereinsgesetz"
[[law.classifiers]]
name = "Abschnitt"

View File

@ -1,5 +1,6 @@
[law]
id = 20011654
name = "Verbrauchergewährleistungsgesetz"
[[law.classifiers]]
name = "Abschnitt"

View File

@ -85,7 +85,6 @@ impl Config {
if config.parser.move_para_headers_into_content {
parser.move_para_headers_into_content();
}
Ok((config.law.id, builder, parser))
}
}
@ -93,6 +92,7 @@ impl Config {
#[derive(Debug, Deserialize)]
struct Law {
id: usize,
name: String,
classifiers: Vec<Classifier>,
}

View File

@ -30,6 +30,7 @@ pub mod responsible;
/// That's our struct, holding all the information of the law text.
#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct Law {
pub name: String,
pub header: Vec<Heading>,
}
@ -84,7 +85,10 @@ impl From<LawBuilder> for Law {
});
}
Self { header: ret }
Self {
header: ret,
name: builder.name,
}
}
}
@ -133,6 +137,8 @@ impl From<ClassifierInstance> for HeadingContent {
/// Is used to generate a law struct. It's organized mainly by classifier.
#[derive(Debug)]
pub struct LawBuilder {
name: String,
/// Structure of the law text
classifiers: Vec<Classifier>,
@ -168,6 +174,7 @@ impl LawBuilder {
/// Creates a new law builder. Adds classifier for known law texts.
pub fn new() -> Self {
Self {
name: "".into(),
classifiers: Vec::new(),
header: Vec::new(),
next_para_header: None,