html: skip href attr when url empty
This commit is contained in:
parent
d3a98e6626
commit
a4511db0a8
1 changed files with 7 additions and 1 deletions
|
@ -91,7 +91,13 @@ impl<'s, I: Iterator<Item = Event<'s>>, W: std::fmt::Write> Writer<I, W> {
|
||||||
Container::DescriptionTerm => self.out.write_str("<dt")?,
|
Container::DescriptionTerm => self.out.write_str("<dt")?,
|
||||||
Container::CodeBlock { .. } => self.out.write_str("<pre")?,
|
Container::CodeBlock { .. } => self.out.write_str("<pre")?,
|
||||||
Container::Span | Container::Math { .. } => self.out.write_str("<span")?,
|
Container::Span | Container::Math { .. } => self.out.write_str("<span")?,
|
||||||
Container::Link(dst, ..) => write!(self.out, r#"<a href="{}""#, dst)?,
|
Container::Link(dst, ..) => {
|
||||||
|
if dst.is_empty() {
|
||||||
|
self.out.write_str("<a")?;
|
||||||
|
} else {
|
||||||
|
write!(self.out, r#"<a href="{}""#, dst)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
Container::Image(..) => {
|
Container::Image(..) => {
|
||||||
self.text_only = true;
|
self.text_only = true;
|
||||||
self.out.write_str("<img")?;
|
self.out.write_str("<img")?;
|
||||||
|
|
Loading…
Reference in a new issue