--- - # vertical bars around a capital letter name: determinant-scalar tag: mrow match: - "IsBracketed(., '|', '|') and " - "($SpeechStyle = 'SimpleSpeak' or ($SpeechStyle = 'ClearSpeak' and $ClearSpeak_AbsoluteValue != 'Cardinality')) and " - "*[2][self::m:mi and translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '') = '']" replace: - intent: name: "determinant" attrs: "id='*[2]/@id'" children: [x: "*[2]"] - name: norm tag: mrow match: - "IsBracketed(., '∥', '∥')" replace: - intent: name: "norm" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: [x: "*[2]"] - name: norm tag: msub match: - "*[1][IsBracketed(., '∥', '∥')]" replace: - intent: name: "subscripted-norm" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: - x: "*[1]/*[2]" # grab the contents of the bracketed expr - x: "*[2]" - name: vector-magnitude tag: mrow match: "IsBracketed(., '‖', '‖')" replace: - intent: name: "magnitude" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: [x: "*[2]"] - name: transpose tag: msup match: - "*[2][.='T']" replace: - intent: name: "transpose" attrs: "data-intent-property='concat(data-intent-property, \":postfix:\")'" children: [x: "*[1]"] - name: trace tag: mrow match: - "count(*)=3 and (*[1][.='tr' or .='Tr']) and *[2][.='\u2061']" replace: - intent: name: "trace" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: [x: "*[3]"] - name: dimension tag: mrow match: - "count(*)=3 and (*[1][.='dim' or .='Dim']) and *[2][.='\u2061']" replace: - intent: name: "dimension" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: [x: "*[3]"] - name: homomorphism tag: mrow match: - "count(*)=3 and (*[1][.='hom' or .='Hom']) and *[2][.='\u2061']" replace: - intent: name: "homomorphism" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: [x: "*[3]"] - name: kernel tag: mrow match: - "count(*)=3 and (*[1][.='ker' or .='Ker']) and *[2][.='\u2061']" replace: - intent: name: "kernel" attrs: "data-intent-property='concat(data-intent-property, \":function:\")'" children: [x: "*[3]"] - name: dot-product tag: mo # mathvariant='bold' is canonicalized to the math alphanumeric equivalent # I tried using the range '𝐀'<=. and .<='𝐳', but that doesn't work (Rust's xpath has bugs with 32 bit Unicode chars) # ∇ can also signal a vector operation match: - "(.='⋅' or .='·') and preceding-sibling::*[1][ self::m:mover[*[2][.='→' or .='⇀' or .='^']] or BaseNode(.)[.='∇' or .='𝛁'] or descendant-or-self::*[string-length(.)=1 and translate(., '∇𝛁𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳','')=''] ] and following-sibling::*[1][ self::m:mover[*[2][.='→' or .='⇀' or .='^']] or descendant-or-self::*[string-length(.)=1 and translate(., '∇𝛁𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳','')=''] ]" replace: - intent: name: "dot-product" attrs: "id='@id'" children: [] - name: cross-product tag: mo match: - ".='×' and preceding-sibling::*[1][ self::m:mover[*[2]='→' or *[2]='⇀' or *[2]='^'] or BaseNode(.)[.='∇' or .='𝛁'] or descendant-or-self::*[string-length(.)=1 and translate(., '∇𝛁𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳','')=''] ] and following-sibling::*[1][ self::m:mover[*[2]='→' or *[2]='⇀' or *[2]='^'] or descendant-or-self::*[string-length(.)=1 and translate(., '∇𝛁𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳','')=''] ]" replace: - intent: name: "cross-product" attrs: "id='@id'" children: []