summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/tex/etc/stex-backend-rustex.cfg
blob: 3f48631e40631fe8fea51004897d1e8ccf11b680 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
\RequirePackage{rustex}

\rustex_add_Namespace:nn{stex}{http://kwarc.info/ns/sTeX}
\rustex_add_Namespace:nn{mmt}{http://uniformal.github.io/MMT}

\tl_const:Nx \c_stex_html_emptyarg_tl {
  \rustex_direct_HTML:n { \c_ampersand_str \c_hash_str 8205;  }
}

\cs_new_protected:Nn \stex_annotate:nnn {
    \_stex_html_checkempty:n { #3 }
    \rustex_annotate_HTML:nn {
        property="stex:#1" ~
        resource="#2"
    } {
        \mode_if_vertical:TF{
            \tl_use:N \l_stex_html_arg_tl\stex_par:
        }{
            \tl_use:N \l_stex_html_arg_tl
        }
    }
}

\cs_new_protected:Nn \stex_annotate_invisible:n {
    \_stex_html_checkempty:n { #1 }
    \rustex_annotate_HTML:nn {
        stex:visible="false" ~
        style:display="none"
    } {
        \ifmmode\tl_use:N \l_stex_html_arg_tl\else\hbox{\tl_use:N \l_stex_html_arg_tl}\fi
    }
}

\cs_new_protected:Nn \stex_annotate_invisible:nnn {
    \_stex_html_checkempty:n { #3 }
    \rustex_annotate_HTML:nn {
        property="stex:#1" ~
        resource="#2" ~
        stex:visible="false" ~
        style:display="none"
    } {
        \ifmmode\tl_use:N \l_stex_html_arg_tl\else\hbox{\tl_use:N \l_stex_html_arg_tl}\fi
    }
}

\NewDocumentEnvironment{stex_annotate_env} { m m } {
    \stex_par:
    \rustex_annotate_HTML_begin:n {
        property="stex:#1" ~
        resource="#2"
    }
}{
    \stex_par:
    \rustex_annotate_HTML_end:
}

\prg_new_conditional:Nnn \stex_html_backend: {p, T, F, TF} {
  \prg_return_true:
}