Skip to main content

ratex_parser/functions/
htmlmathml.rs

1use std::collections::HashMap;
2
3use crate::error::ParseResult;
4use crate::functions::{define_function_full, FunctionContext, FunctionSpec};
5use crate::parse_node::ParseNode;
6
7pub fn register(map: &mut HashMap<&'static str, FunctionSpec>) {
8    define_function_full(
9        map,
10        &["\\html@mathml"],
11        "htmlmathml",
12        2, 0, None,
13        false, true, true, false, false,
14        handle_htmlmathml,
15    );
16}
17
18fn handle_htmlmathml(
19    ctx: &mut FunctionContext,
20    args: Vec<ParseNode>,
21    _opt_args: Vec<Option<ParseNode>>,
22) -> ParseResult<ParseNode> {
23    let html = ParseNode::ord_argument(args[0].clone());
24    let mathml = ParseNode::ord_argument(args[1].clone());
25
26    Ok(ParseNode::HtmlMathMl {
27        mode: ctx.parser.mode,
28        html,
29        mathml,
30        loc: None,
31    })
32}