This commit is contained in:
@ -334,7 +334,7 @@ pub struct Section {
|
||||
impl fmt::Debug for Section {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let par_header = self.par_header.as_deref().unwrap_or("");
|
||||
write!(f, "{} ({})", self.symb, par_header)
|
||||
write!(f, "{} ({})\n{:#?}", self.symb, par_header, self.content)
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,13 +458,23 @@ impl std::fmt::Debug for Classifier {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Content {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
|
@ -57,7 +57,7 @@ fn main() {
|
||||
builder.new_header("initial");
|
||||
parser.parse(par_url, &mut builder).unwrap();
|
||||
let law: Law = builder.into();
|
||||
law.to_md();
|
||||
println!("{law:?}");
|
||||
} else {
|
||||
let law = Law::from_config(&args.config).unwrap();
|
||||
law.to_md();
|
||||
|
@ -63,6 +63,10 @@ impl Liste {
|
||||
}
|
||||
|
||||
pub(crate) fn get_content(&self) -> Content {
|
||||
Content::List(self.content.clone())
|
||||
if self.content.len() == 1 {
|
||||
self.content[0].clone()
|
||||
} else {
|
||||
Content::List(self.content.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user