- | A.AttributedTerm (`Loc _, t) -> aux mathonly xref pos prec t
- | A.AttributedTerm (`Level (child_prec, child_assoc), t) ->
- let t' = aux mathonly xref pos child_prec t in
- add_parens child_prec child_assoc pos prec t'
- | A.AttributedTerm (`IdRef xref, t) -> aux mathonly (Some xref) pos prec t
- | A.Ident (literal, _) -> P.Mi (make_href xref, to_unicode literal)
- | A.Num (literal, _) -> P.Mn (make_href xref, to_unicode literal)
- | A.Symbol (literal, _) -> P.Mo (make_href xref,to_unicode literal)
- | A.Uri (literal, _) -> P.Mi (make_href xref, to_unicode literal)
- | A.Literal l -> aux_literal xref prec l
- | A.Layout l -> aux_layout mathonly xref pos prec l
+ | A.AttributedTerm _ ->
+ aux_attributes xmlattrs mathonly xref pos prec uris t
+ | A.Num (literal, _) ->
+ let attrs =
+ (RenderingAttrs.number_attributes `MathML)
+ @ make_href xmlattrs xref uris
+ in
+ P.Mn (attrs, literal)
+ | A.Symbol (literal, _) ->
+ let attrs =
+ (RenderingAttrs.symbol_attributes `MathML)
+ @ make_href xmlattrs xref uris
+ in
+ P.Mo (attrs, to_unicode literal)
+ | A.Ident (literal, subst)
+ | A.Uri (literal, subst) ->
+ let attrs =
+ (RenderingAttrs.ident_attributes `MathML)
+ @ make_href xmlattrs xref (ref [])
+ in
+ let name = P.Mi (attrs, to_unicode literal) in
+ (match subst with
+ | Some []
+ | None -> name
+ | Some substs ->
+ let substs' =
+ box_of mathonly (A.H, false, false) []
+ (open_brace
+ :: (CicNotationUtil.dress semicolon
+ (List.map
+ (fun (name, t) ->
+ box_of mathonly (A.H, false, false) [] [
+ P.Mi ([], name);
+ P.Mo ([], to_unicode "\\def");
+ aux [] mathonly xref pos prec uris t ])
+ substs))
+ @ [ closed_brace ])
+(* (CicNotationUtil.dress semicolon
+ (List.map
+ (fun (var, t) ->
+ let var_uri = UriManager.uri_of_string var in
+ let var_name = UriManager.name_of_uri var_uri in
+ let href_attr = Some "xlink", "href", var in
+ box_of mathonly (A.H, false, false) [] [
+ P.Mi ([href_attr], var_name);
+ P.Mo ([], to_unicode "\\def");
+ aux [] mathonly xref pos prec uris t ])
+ substs)) *)
+ in
+ let substs_maction = toggle_action [ hidden_substs; substs' ] in
+ box_of mathonly (A.H, false, false) [] [ name; substs_maction ])
+ | A.Literal l -> aux_literal xmlattrs xref prec uris l
+ | A.UserInput -> P.Mtext ([], "%")
+ | A.Layout l -> aux_layout mathonly xref pos prec uris l