Skip to content

Commit 2edfe08

Browse files
author
bors-servo
authored
Auto merge of #359 - vvilhonen:vvilhonen/expose-htmlserializer-for-customizing-output, r=jdm
Expose HtmlSerializer for customizing output This allows 3rd party crates to customize the output without duplicating all the serialization logic. I'm using it myself to pretty print transformed html, where I don't care that the added whitespace changes the meaning of the document.
2 parents 45b2fca + 3b7ac03 commit 2edfe08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

html5ever/src/serialize/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ struct ElemInfo {
5555
processed_first_child: bool,
5656
}
5757

58-
struct HtmlSerializer<Wr: Write> {
59-
writer: Wr,
58+
pub struct HtmlSerializer<Wr: Write> {
59+
pub writer: Wr,
6060
opts: SerializeOpts,
6161
stack: Vec<ElemInfo>,
6262
}
@@ -74,7 +74,7 @@ fn tagname(name: &QualName) -> LocalName {
7474
}
7575

7676
impl<Wr: Write> HtmlSerializer<Wr> {
77-
fn new(writer: Wr, opts: SerializeOpts) -> Self {
77+
pub fn new(writer: Wr, opts: SerializeOpts) -> Self {
7878
let html_name = match opts.traversal_scope {
7979
TraversalScope::IncludeNode | TraversalScope::ChildrenOnly(None) => None,
8080
TraversalScope::ChildrenOnly(Some(ref n)) => Some(tagname(n)),

0 commit comments

Comments
 (0)