Fix text minification
This commit is contained in:
parent
b88e96e97e
commit
3c4b71612e
|
@ -543,7 +543,6 @@ impl<'d> Processor<'d> {
|
|||
uep.state = UnintentionalEntityState::Ended;
|
||||
}
|
||||
pub fn suspend(&mut self, uep: &mut UnintentionalEntityPrevention) -> () {
|
||||
debug_assert!(uep.state != UnintentionalEntityState::Ended);
|
||||
if uep.state != UnintentionalEntityState::Suspended {
|
||||
self._after_write(uep, true);
|
||||
uep.state = UnintentionalEntityState::Suspended;
|
||||
|
|
|
@ -24,8 +24,9 @@ enum ContentType {
|
|||
|
||||
impl ContentType {
|
||||
fn is_tag_like(&self) -> bool {
|
||||
// Do not include Comment as comments are not written.
|
||||
match self {
|
||||
ContentType::Comment | ContentType::Bang | ContentType::Instruction | ContentType::Tag => true,
|
||||
ContentType::Bang | ContentType::Instruction | ContentType::Tag => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -159,9 +160,9 @@ pub fn process_content(proc: &mut Processor, parent: Option<ProcessorRange>) ->
|
|||
uep.expect_active();
|
||||
match entity {
|
||||
// TODO Comment: Explain why < is handled this way.
|
||||
Some(e @ EntityType::NonDecodableRightChevron(_)) => {
|
||||
Some(entity @ EntityType::NonDecodableRightChevron(_)) => {
|
||||
proc.suspend(uep);
|
||||
e.keep(proc);
|
||||
entity.keep(proc);
|
||||
proc.resume(uep);
|
||||
}
|
||||
Some(entity) => {
|
||||
|
@ -179,7 +180,10 @@ pub fn process_content(proc: &mut Processor, parent: Option<ProcessorRange>) ->
|
|||
}
|
||||
};
|
||||
|
||||
last_written = next_content_type;
|
||||
// Comments are discarded.
|
||||
if next_content_type != ContentType::Comment {
|
||||
last_written = next_content_type;
|
||||
};
|
||||
};
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -52,7 +52,7 @@ impl MaybeClosingTag {
|
|||
|
||||
pub fn write(&mut self, proc: &mut Processor) -> () {
|
||||
proc.write_slice(b"</");
|
||||
proc.write_range(self.0.unwrap());
|
||||
proc.write_range(self.0.take().unwrap());
|
||||
proc.write(b'>');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue