enable 'horizontal stack' of elements
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m55s

This commit is contained in:
2024-02-17 20:02:40 +01:00
parent 91b5ac9c09
commit 6731f4f0d0
13 changed files with 1191 additions and 1191 deletions

View File

@ -458,28 +458,18 @@ impl std::fmt::Debug for Classifier {
}
}
#[derive(Clone, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum Content {
Text(String), //This is my direct law text
Item(Vec<Content>), //(1) This is general law. (2) This is more specific law
List(Vec<Content>),
}
impl std::fmt::Debug for Content {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Text(arg0) => f.debug_tuple("Text").field(arg0).finish(),
Self::Item(arg0) => f.debug_tuple("Item").field(arg0).finish(),
Self::List(arg0) => f.debug_tuple("List").field(arg0).finish(),
}
}
List(Vec<Content>), //(1) This is general law. (2) This is more specific law
Multi(Vec<Content>),
}
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) | Self::List(a) => {
Self::List(a) | Self::Multi(a) => {
let mut ret = String::new();
for aa in a {
ret.push_str(&format!("{aa}"));
@ -489,3 +479,13 @@ impl Display for Content {
}
}
}
// Content::Item([
// ContentPart::Multiple([
// ContentPart::Text("(1) Behörden im Sinne...sind:")
// ContentPart::List([
// ContentPart::Text("1.")
// ContentPart::Text("2.")
// ])
// ])
// ])

View File

@ -66,7 +66,7 @@ impl Absatz {
if content.len() == 1 {
(par_id, content[0].clone())
} else {
(par_id, Content::List(content))
(par_id, Content::Multi(content))
}
}

View File

@ -69,7 +69,7 @@ impl Abschnitt {
} else {
let mut contents = Vec::new();
contents.extend(absatze.iter().cloned());
builder.new_par(par_id, Content::Item(contents));
builder.new_par(par_id, Content::List(contents));
}
ret.handle_metadata(&mut c, builder);