Extract content parser state to its own module
This commit is contained in:
parent
3571e8d355
commit
de5b3dd377
8 changed files with 112 additions and 99 deletions
|
|
@ -45,12 +45,14 @@ impl std::fmt::Display for Anchor {
|
|||
use crate::dev::wrap;
|
||||
|
||||
let display_destination = match self.destination {
|
||||
Some(ref destination) => { if destination.is_empty() {
|
||||
"<empty>"
|
||||
} else {
|
||||
destination
|
||||
}},
|
||||
None => "<unknown>"
|
||||
Some(ref destination) => {
|
||||
if destination.is_empty() {
|
||||
"<empty>"
|
||||
} else {
|
||||
destination
|
||||
}
|
||||
},
|
||||
None => "<unknown>",
|
||||
};
|
||||
|
||||
let mut tail = String::new();
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ impl std::fmt::Display for Header {
|
|||
|
||||
let display_dom_id = match self.dom_id {
|
||||
Some(ref dom_id) => format!(" DOM ID {dom_id}"),
|
||||
None => String::new()
|
||||
None => String::new(),
|
||||
};
|
||||
|
||||
write!(
|
||||
|
|
|
|||
|
|
@ -43,8 +43,14 @@ impl Parseable for Paragraph {
|
|||
impl std::fmt::Display for Paragraph {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
let display_open_state = match self.open {
|
||||
Some(open_state) => { if open_state { "open" } else { "closed" } },
|
||||
None => "unknown"
|
||||
Some(open_state) => {
|
||||
if open_state {
|
||||
"open"
|
||||
} else {
|
||||
"closed"
|
||||
}
|
||||
},
|
||||
None => "unknown",
|
||||
};
|
||||
write!(f, "Paragraph [{display_open_state}]")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,13 @@ impl std::fmt::Display for Span {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
let display_open_state = match self.open {
|
||||
Some(ref open_state) => {
|
||||
if *open_state { "open" } else { "closed" }},
|
||||
None => "unknown"
|
||||
if *open_state {
|
||||
"open"
|
||||
} else {
|
||||
"closed"
|
||||
}
|
||||
},
|
||||
None => "unknown",
|
||||
};
|
||||
write!(f, "Span [{display_open_state}]")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue