lift the children up to LITERAL_NAME
(doc: Document<'m>, function_name: Element<'m>, children: Vec<Element<'m>>)
| 352 | |
| 353 | /// lift the children up to LITERAL_NAME |
| 354 | fn lift_function_name<'m>(doc: Document<'m>, function_name: Element<'m>, children: Vec<Element<'m>>) -> Element<'m> { |
| 355 | // debug!(" lift_function_name: {}", name(&function_name)); |
| 356 | // debug!(" lift_function_name: {}", mml_to_string(&function_name)); |
| 357 | if is_leaf(function_name) { |
| 358 | // simple/normal case of f(x,y) |
| 359 | set_mathml_name(function_name, as_text(function_name)); |
| 360 | function_name.set_text(""); |
| 361 | function_name.replace_children(children); |
| 362 | if name(&function_name).find(|ch| ch!='_' && ch!='-').is_none() { |
| 363 | let properties = function_name.attribute_value(INTENT_PROPERTY).unwrap_or(":").to_owned(); |
| 364 | function_name.set_attribute_value(INTENT_PROPERTY, &(properties + "silent:")); |
| 365 | } |
| 366 | return function_name; |
| 367 | } else if function_name.children().is_empty() { |
| 368 | // "... :property(...)" -- no function name |
| 369 | function_name.replace_children(children); |
| 370 | return function_name; |
| 371 | } else { |
| 372 | // more complicated case of nested name: f(x)(y,z) |
| 373 | // create an apply_function(f(x), y, z) |
| 374 | let result = create_mathml_element(&doc, IMPLICIT_FUNCTION_NAME); |
| 375 | result.append_child(function_name); |
| 376 | result.append_children(children); |
| 377 | return result; |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | |
| 382 | /// look for @arg=name in mathml |
no test coverage detected