MCPcopy Create free account
hub / github.com/chatmail/core / dehtml_cleanup

Function dehtml_cleanup

src/dehtml.rs:106–126  ·  view source on GitHub ↗
(mut text: String)

Source from the content-addressed store, hash-verified

104}
105
106fn dehtml_cleanup(mut text: String) -> String {
107 text.retain(|c| c != '\r');
108 let lines = text.trim().split('\n');
109 let mut text = String::new();
110 let mut linebreak = false;
111 for line in lines {
112 if line.chars().all(char::is_whitespace) {
113 linebreak = true;
114 } else {
115 if !text.is_empty() {
116 text += "\n";
117 if linebreak {
118 text += "\n";
119 }
120 }
121 text += line.trim_end();
122 linebreak = false;
123 }
124 }
125 text
126}
127
128fn dehtml_quick_xml(buf: &str) -> (String, String) {
129 let buf = buf.trim().trim_start_matches("<!doctype html>");

Callers 1

dehtmlFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected