more clean up w/ pedclippy
All checks were successful
CI/CD Pipeline / test (push) Successful in 36s
All checks were successful
CI/CD Pipeline / test (push) Successful in 36s
This commit is contained in:
parent
32533a2d17
commit
443807d2b8
@ -58,7 +58,7 @@ impl From<LawBuilder> for Law {
|
||||
name: header.borrow().name.clone(),
|
||||
desc: header.borrow().desc.clone(),
|
||||
content: header.borrow().clone().into(),
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Self {
|
||||
@ -100,7 +100,7 @@ impl From<ClassifierInstance> for HeadingContent {
|
||||
name: child.borrow().name.clone(),
|
||||
desc: child.borrow().desc.clone(),
|
||||
content: child.borrow().clone().into(),
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Self::Heading(ret)
|
||||
@ -173,18 +173,18 @@ impl LawBuilder {
|
||||
|
||||
let mut law_id = None;
|
||||
if name == "UrhG" {
|
||||
law_id = Some(10001848);
|
||||
law_id = Some(10_001_848);
|
||||
|
||||
classifiers.push(Classifier::new("Hauptstück", Arc::new(&contains)).root());
|
||||
classifiers.push(Classifier::new("Abschnitt", Arc::new(&contains)));
|
||||
classifiers.push(Classifier::new("Number", Arc::new(&starts_with_number)));
|
||||
} else if name == "MSchG" {
|
||||
law_id = Some(10002180);
|
||||
law_id = Some(10_002_180);
|
||||
|
||||
classifiers.push(Classifier::new("Abschnitt", Arc::new(&contains)).root());
|
||||
classifiers.push(Classifier::new("Number", Arc::new(&starts_with_number)));
|
||||
} else if name == "ABGB" {
|
||||
law_id = Some(10001622);
|
||||
law_id = Some(10_001_622);
|
||||
|
||||
classifiers.push(Classifier::new("Einleitung", Arc::new(&contains)).root());
|
||||
classifiers.push(Classifier::new("Theil", Arc::new(&contains)).root());
|
||||
@ -198,7 +198,7 @@ impl LawBuilder {
|
||||
classifiers.push(Classifier::new("num", Arc::new(&starts_with_number)));
|
||||
classifiers.push(Classifier::new("rom", Arc::new(&starts_with_roman_number)));
|
||||
} else if name == "FSG" {
|
||||
law_id = Some(10003898);
|
||||
law_id = Some(10_003_898);
|
||||
|
||||
classifiers.push(Classifier::new("Artikel", Arc::new(&contains)).root());
|
||||
|
||||
@ -215,16 +215,16 @@ impl LawBuilder {
|
||||
));
|
||||
classifiers.push(Classifier::new("num", Arc::new(&starts_with_number)));
|
||||
} else if name == "VVG" {
|
||||
law_id = Some(20004425);
|
||||
law_id = Some(20_004_425);
|
||||
|
||||
classifiers.push(Classifier::new("Abschnitt", Arc::new(&contains)).root());
|
||||
} else if name == "KSchG" {
|
||||
law_id = Some(10002462);
|
||||
law_id = Some(10_002_462);
|
||||
|
||||
classifiers.push(Classifier::new("Hauptstück", Arc::new(&contains)).root());
|
||||
classifiers.push(Classifier::new("Abschnitt", Arc::new(&contains)));
|
||||
} else if name == "StGB" {
|
||||
law_id = Some(10002296);
|
||||
law_id = Some(10_002_296);
|
||||
|
||||
classifiers.push(Classifier::new("Teil", Arc::new(&contains)).root());
|
||||
classifiers.push(Classifier::new("Abschnitt", Arc::new(&contains)));
|
||||
@ -249,7 +249,7 @@ impl LawBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
builder.into()
|
||||
builder
|
||||
}
|
||||
|
||||
fn responsible_classifier(&self, name: &str) -> Option<&Classifier> {
|
||||
@ -358,7 +358,7 @@ impl LawBuilder {
|
||||
symb: par,
|
||||
par_header,
|
||||
content,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/// Next paragraph has a header, store its name.
|
||||
@ -447,7 +447,7 @@ impl std::fmt::Debug for ClassifierInstance {
|
||||
.field("desc", &self.desc)
|
||||
.field("sections", &self.sections)
|
||||
.field("children", &self.children)
|
||||
.finish()
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ impl std::fmt::Debug for Classifier {
|
||||
.field("name", &self.name)
|
||||
.field("instances", &self.instances)
|
||||
.field("child", &self.child)
|
||||
.finish()
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,14 +515,7 @@ impl Display for Content {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Text(a) => f.write_str(&format!("{a}\n")),
|
||||
Self::Item(a) => {
|
||||
let mut ret = String::new();
|
||||
for aa in a {
|
||||
ret.push_str(&format!("{aa}"));
|
||||
}
|
||||
f.write_str(&ret)
|
||||
}
|
||||
Self::List(a) => {
|
||||
Self::Item(a) | Self::List(a) => {
|
||||
let mut ret = String::new();
|
||||
for aa in a {
|
||||
ret.push_str(&format!("{aa}"));
|
||||
|
@ -39,7 +39,7 @@ pub(crate) fn parse_from_str(xml: &str, builder: &mut LawBuilder) -> Result<bool
|
||||
r#"<ueberschrift typ="g1" ct="text" halign="c">Erster Abschnitt</ueberschrift>"#,
|
||||
); // StGB
|
||||
|
||||
let xml = xml.replace(r#"<abstand ct="text" halign="l" />"#, r#""#); // StGB...
|
||||
let xml = xml.replace(r#"<abstand ct="text" halign="l" />"#, r""); // StGB...
|
||||
|
||||
let xml = xml.replace(
|
||||
r#"<ueberschrift typ="g1min" ct="text" halign="c">Strafbare Handlungen gegen Leib und Leben</ueberschrift>"#,
|
||||
@ -113,14 +113,14 @@ pub(crate) fn parse_from_str(xml: &str, builder: &mut LawBuilder) -> Result<bool
|
||||
let xml = xml.replace("<tab />", "");
|
||||
|
||||
let xml = xml.replace(
|
||||
r#"(Anm.: § 69 aufgehoben durch Art. 1 Z 12, BGBl. I Nr. 124/2017)"#,
|
||||
r#"<gldsym>§ 69.</gldsym>(Anm.: § 69 aufgehoben durch Art. 1 Z 12, BGBl. I Nr. 124/2017)"#,
|
||||
r"(Anm.: § 69 aufgehoben durch Art. 1 Z 12, BGBl. I Nr. 124/2017)",
|
||||
r"<gldsym>§ 69.</gldsym>(Anm.: § 69 aufgehoben durch Art. 1 Z 12, BGBl. I Nr. 124/2017)",
|
||||
);
|
||||
|
||||
// § 49d FSG
|
||||
let xml = xml.replace(
|
||||
r#"</absatz><liste><schlussteil ebene="0" art="normal" ct="text">Die Finanzordnungswidrigkeit wird mit einer Geldstrafe bis zu 50 000 Euro geahndet.</schlussteil></liste>"#,
|
||||
r#"Die Finanzordnungswidrigkeit wird mit einer Geldstrafe bis zu 50 000 Euro geahndet.</absatz>"#,
|
||||
r"Die Finanzordnungswidrigkeit wird mit einer Geldstrafe bis zu 50 000 Euro geahndet.</absatz>",
|
||||
);
|
||||
|
||||
// § 127 FSG
|
||||
|
@ -118,8 +118,6 @@ impl Abschnitt {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Continue here: We want to create a `Section`.
|
||||
//
|
||||
// We have 2 tasks
|
||||
// 1) Get paragraph id
|
||||
// 2) Get content
|
||||
@ -149,7 +147,7 @@ impl Abschnitt {
|
||||
Content::Text(absatz.content.replace('\u{a0}', " ")),
|
||||
Content::List(table.get_list()),
|
||||
Content::Text(after_absatz.content),
|
||||
]))
|
||||
]));
|
||||
} else {
|
||||
absatze.push(Content::List(vec![
|
||||
Content::Text(absatz.content.replace('\u{a0}', " ")),
|
||||
@ -441,8 +439,8 @@ impl AbsatzAbs {
|
||||
|
||||
let gldsym = match c.peek() {
|
||||
Some(child) => {
|
||||
if Leaf::test(child, "gldsym".into()) {
|
||||
Some(Leaf::parse(c.next().unwrap(), "gldsym".into()).replace('\u{a0}', " "))
|
||||
if Leaf::test(child, "gldsym") {
|
||||
Some(Leaf::parse(c.next().unwrap(), "gldsym").replace('\u{a0}', " "))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -466,10 +464,10 @@ pub(crate) struct Leaf {
|
||||
content: String,
|
||||
}
|
||||
impl Leaf {
|
||||
pub(crate) fn test(n: &Node, name: String) -> bool {
|
||||
pub(crate) fn test(n: &Node, name: &str) -> bool {
|
||||
n.tag_name().name() == name && n.children().count() == 1
|
||||
}
|
||||
pub(crate) fn parse(n: Node, name: String) -> String {
|
||||
pub(crate) fn parse(n: Node, name: &str) -> String {
|
||||
assert!(n.tag_name().name() == name);
|
||||
|
||||
assert_eq!(n.children().count(), 1);
|
||||
@ -498,7 +496,9 @@ impl Absatz {
|
||||
content: text.into(),
|
||||
}
|
||||
} else {
|
||||
Self { content: "".into() }
|
||||
Self {
|
||||
content: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ fn fetch_page(overview_id: usize, page: usize) -> Result<String, Error> {
|
||||
ureq::post("https://data.bka.gv.at/ris/api/v2.6/Bundesrecht")
|
||||
.send_form(&[
|
||||
("Applikation", "BrKons"),
|
||||
("Gesetzesnummer", &format!("{}", overview_id)),
|
||||
("Gesetzesnummer", &format!("{overview_id}")),
|
||||
("DokumenteProSeite", "OneHundred"),
|
||||
("Seitennummer", &format!("{}", page)),
|
||||
("Seitennummer", &format!("{page}")),
|
||||
("Fassung.FassungVom", ¤t_date()),
|
||||
])?
|
||||
.into_string()?,
|
||||
|
Loading…
Reference in New Issue
Block a user