This commit is contained in:
@ -14,6 +14,7 @@
|
||||
// See the Licence for the specific language governing permissions and
|
||||
// limitations under the Licence.
|
||||
|
||||
mod absatz;
|
||||
mod abschnitt;
|
||||
mod liste;
|
||||
mod table;
|
||||
@ -24,6 +25,7 @@ use roxmltree::Node;
|
||||
use crate::{
|
||||
law::{Content, LawBuilder},
|
||||
misc::Error,
|
||||
paragraph::parser::absatz::Absatz,
|
||||
};
|
||||
|
||||
struct Expect<'a> {
|
||||
@ -289,34 +291,6 @@ impl Leaf {
|
||||
n.text().unwrap().into()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct Absatz {
|
||||
content: String,
|
||||
typ: String,
|
||||
}
|
||||
impl Absatz {
|
||||
pub(crate) fn test_with_typ(n: &Node, typ: &str) -> bool {
|
||||
n.tag_name().name() == "absatz" && n.attribute("typ") == Some(typ)
|
||||
}
|
||||
|
||||
pub(crate) fn parse(n: Node) -> Self {
|
||||
Expect::from(&n).tag("absatz");
|
||||
|
||||
let typ = n.attribute("typ").unwrap().into();
|
||||
|
||||
let mut content = String::new();
|
||||
// Get text from this element + all direct childs
|
||||
for c in n.children() {
|
||||
if let Some(text) = c.text() {
|
||||
content.push_str(text);
|
||||
}
|
||||
}
|
||||
|
||||
Self { content, typ }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct Ueberschrift {
|
||||
typ: String,
|
||||
|
Reference in New Issue
Block a user