-
Notifications
You must be signed in to change notification settings - Fork 0
/
math.sh
executable file
·42 lines (33 loc) · 1.11 KB
/
math.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
#tags="$(cat ~/.node/lib64/node_modules/typescript/lib/lib.dom.d.ts | sed -n '/^interface MathMLElementTagNameMap {$/,/^}$/p' | tail -n+2 | head -n-1 | cut -d'"' -f2 | tr '\n' ' ' | sed -e 's/ $//')";
tags="annotation annotation-xml maction math merror mfrac mi mmultiscripts mn mo mover mpadded mphantom mprescripts mroot mrow ms mspace msqrt mstyle msub msubsup msup mtable mtd mtext mtr munder munderover semantics";
(
cat <<-HEREDOC
import {tags} from './dom.js';
/**
* The math module exports function for the creation of {@link https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement | MathMLElement)s.
*
* @module math
* @requires module:dom
*/
/** */
export const
/** This constant contains the XMLNamespace of MathMLElements. */
ns = "http://www.w3.org/1998/Math/MathML",
HEREDOC
echo -n "{";
declare first=true;
for tag in $tags; do
if $first; then
first=false;
else
echo -n ", ";
fi;
if [ "$tag" = "annotation-xml" ]; then
echo -n "\"$tag\": annotationXML";
else
echo -n "$tag";
fi;
done;
echo "} = tags(ns);";
) | tee lib.ts/math.ts > lib.js/math.js;