MCPcopy Create free account
hub / github.com/daisy/MathCAT / gather_text

Function gather_text

src/interface.rs:507–519  ·  view source on GitHub ↗

gather up all the contents of the element and return them with a leading space

(html: Element)

Source from the content-addressed store, hash-verified

505
506 /// gather up all the contents of the element and return them with a leading space
507 fn gather_text(html: Element) -> String {
508 let mut text = "".to_string(); // since we are throwing out the element tag, add a space between the contents
509 for child in html.children() {
510 match child {
511 ChildOfElement::Element(child) => {
512 text = text + " " + gather_text(child).trim_matches(WHITESPACE);
513 },
514 ChildOfElement::Text(t) => text += t.text(),
515 _ => (),
516 }
517 }
518 return text;
519 }
520 }
521}
522

Callers 1

make_leaf_elementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected