summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpdf/tagpdf-user.sty
blob: 5bce390e4f4f1d9ab3f1c647761463932242fd96 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
\ProvidesExplPackage {tagpdf-user} {2019/07/02} {0.61}
  {tagpdf - user commands}

\NewDocumentCommand \tagpdfsetup { m }
 {
  \keys_set:nn { uftag / setup } { #1 }
 }

\cs_set_eq:NN\tagpdfifluatexTF \sys_if_engine_luatex:TF
\cs_set_eq:NN\tagpdfifluatexT  \sys_if_engine_luatex:T
\cs_set_eq:NN\tagpdfifpdftexT  \sys_if_engine_pdftex:T

%%% a generic command to retrieve data

\cs_new:Npn \tagpdfget #1 { \uftag_get:n { #1} }
\cs_new:Npn \uftag_get:n #1 { \use:c {__uftag_get_data_#1: } }


%%%% mc related user commands
\NewDocumentCommand \tagmcifinTF { m m }
 {
  \__uftag_mc_if_in:TF { #1 } { #2 }
 }

\NewDocumentCommand \tagmcbegin { m }
 {
  \uftag_mc_begin:n {#1}\ignorespaces
 }


\NewDocumentCommand \tagmcend {  }
 {
  \unskip % this unskip appears to mess up some spacing; can we do this in another way?
  \uftag_mc_end:
 }

\NewDocumentCommand \tagmcuse { m }
 {
  \uftag_mc_use:n {#1}
 }


%%%% structure related commands

\NewDocumentCommand \tagstructbegin { m }
 {
  \uftag_struct_begin:n {#1}
 }

\NewDocumentCommand \tagstructend {  }
 {
  \uftag_struct_end:
 }

\NewDocumentCommand \tagstructuse { m }
 {
  \uftag_struct_use:n {#1}
 }



%%%% debug/show commands
\NewDocumentCommand\showtagpdfmcdata { O {\__uftag_get_mc_abs_cnt:} }
 {
  \bool_if:NT \g__uftag_mode_lua_bool
   {
    \sys_if_engine_luatex:T
     {
      \directlua{uftag.trace.show_all_mc_data(#1)}
     }
   }
 }

\NewDocumentCommand\showtagpdfattributes { }
 {
  \bool_if:NT \g__uftag_mode_lua_bool
   {
    \sys_if_engine_luatex:T
     {
      \directlua
       {
        uftag.trace.log(
        "showtagpdfattributes: MC=>abscnt=\__uftag_get_mc_abs_cnt:=>attr=\the\l__uftag_mc_cnt_attr=>tag=" ..
        tostring(uftag.func.get_tag_from (\the\l__uftag_mc_type_attr)) ..
        "=\the\l__uftag_mc_type_attr",0
        )
       }
      \ignorespaces
     }
   }
 }

\sys_if_engine_luatex:T
{
  \NewDocumentCommand\pdffakespace { }
  {
   \__uftag_fakespace:
  }
}


\endinput