use crate::{
ast::RcdataContentType,
entity::encode::encode_entities,
tag::{TAG_TEXTAREA_END, TAG_TITLE_END},
};
pub fn minify_rcdata(out: &mut Vec<u8>, typ: RcdataContentType, text: &[u8]) {
let html = encode_entities(text, false);
let html = match typ {
RcdataContentType::Textarea => &*TAG_TEXTAREA_END,
RcdataContentType::Title => &*TAG_TITLE_END,
}
.replace_all_bytes(
&html,
&[match typ {
RcdataContentType::Textarea => b"</textarea".as_slice(),
RcdataContentType::Title => b"</title".as_slice(),
}],
);
out.extend_from_slice(&html);
}