Debian Codegraph @

texmf-dist/tex/latex/latex-lab/latex-lab-testphase-l3doc.sty

raw
1 %%
2 %% This is file `latex-lab-testphase-l3doc.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% latex-lab-l3doc-tagging.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright 2021-2025 LaTeX Project
12 %%
13 %% This file was generated from file(s) of the `LaTeX-lab Bundle'.
14 %% ------------------------------------------------------------------------------------
15 %%
16 %% It may be distributed and/or modified under the
17 %% conditions of the LaTeX Project Public License, either version 1.3c
18 %% of this license or (at your option) any later version.
19 %% The latest version of this license is in
20 %% http://www.latex-project.org/lppl.txt
21 %% and version 1.3c or later is part of all distributions of LaTeX
22 %% version 2008 or later.
23 %%
24 %% This file may only be distributed together with a copy of the LaTeX
25 %% `LaTeX-lab Bundle'. You may however distribute the `LaTeX-lab Bundle'
26 %% without such generated files.
27 %%
28 %% The newest sources can be found below
29 %%
30 %% https://github.com/latex3/latex2e/required/latex-lab
31 %%
32 %% where one can also log issues in case there are any.
33 %%
34 %%
35 %% File: latex-lab-l3doc-tagging.dtx
36 \def\ltlabdoctaggingdate{2025-06-09}
37 \def\ltlabdoctaggingversion{0.80c}
38
39 \ProvidesExplPackage {latex-lab-testphase-l3doc} {2025-05-07} {0.80b}
40 { Tagging Support for the l3doc class }
41 \IfClassLoadedF{l3doc}
42 {\PackageError{latex-lab-testphase-l3doc}{This~package~requires~the~l3doc~class!}{}}
43 \IfDocumentMetadataF
44 {\PackageError{latex-lab-testphase-l3doc}{This~package~requires~the~PDF~management!}{}}
45
46 \tagpdfsetup
47 {
48 role/new-tag=function/Sect,
49 role/new-tag=functionnames/Caption,
50 role/new-tag=functionname/Code,
51 role/new-tag=functionnamepart/Span,
52 role/new-tag=syntax/Sect,
53 role/new-tag=function-description/Div,
54 role/new-tag=macro/Sect,
55 role/new-tag=macronames/Caption,
56 role/new-tag=macroname/Span,
57 role/new-tag=variable/Sect,
58 role/new-tag=variablenames/Caption,
59 role/new-tag=variablename/Span,
60 role/new-tag=codelinenum/Span,
61 role/new-tag=part/H1
62 }
63 \tl_new:N\l__codedoc_current_names_struct_tl
64 \seq_new:N\g__codedoc_macroname_structnum_seq
65 \cs_set_protected:Npn \__codedoc_function_typeset_start:
66 {
67 \par \bigskip
68 \tagstructbegin{tag=function}
69 \tagpdfparaOff
70 \noindent
71 }
72 \cs_set_protected:Npn \__codedoc_typeset_functions:
73 { %
74 \small\ttfamily
75 \__codedoc_target:
76 \Hy@MakeCurrentHref { HD. \int_use:N \c@HD@hypercount }
77 \tagstructbegin{tag=functionnames}
78 \tagmcbegin{}
79 \tagpdfsetup{table/tagging=div}
80 \tl_set:Nn\l__tbl_rowtag_tl {functionname}
81 \tl_set:Nn\l__tbl_celltag_tl {functionnamepart}
82 \begin{tabular} [t] { @{} l @{} >{\hspace{\tabcolsep}} r @{} }
83 \toprule
84 \__codedoc_function_extra_labels:
85 \__codedoc_names_typeset:
86 \__codedoc_typeset_dates:
87 \bottomrule
88 \end{tabular}
89 \tagmcend
90 \tagstructend
91 \normalfont\normalsize\par
92 }
93 \cs_set_protected:Npn \__codedoc_function_descr_start:w
94 {
95 \vcoffin_set:Nnw \l__codedoc_descr_coffin { \textwidth }
96 \tagpdfparaOn
97 \tagstructbegin{tag=function-description}
98 \tl_set:Ne\l__codedoc_current_names_struct_tl{\tag_get:n{struct_num}}
99 \noindent \ignorespaces
100 }
101 \cs_set_protected:Npn \__codedoc_function_typeset_stop:
102 {
103 \par
104 \tagstructend % function-description
105 \tagstructend % function
106 \dim_set:Nn \prevdepth { \coffin_dp:N \l__codedoc_descr_coffin }
107 \allowbreak
108 }
109 \cs_set_protected:Npn \__codedoc_syntax:w
110 {
111 \box_if_empty:NF \g__codedoc_syntax_box
112 { \msg_error:nn { l3doc } { multiple-syntax } }
113 \dim_set:Nn \l__codedoc_syntax_dim
114 {
115 \textwidth
116 \bool_if:NT \l__codedoc_long_name_bool
117 { + \marginparwidth - \l__codedoc_trial_width_dim }
118 }
119 \tag_mc_end_push:
120 \hbox_gset:Nw \g__codedoc_syntax_box
121 \tl_if_empty:NTF\l__codedoc_current_names_struct_tl
122 {
123 \tagstructbegin{tag=syntax}
124 }
125 {
126 \tagstructbegin{tag=syntax,firstkid,parent=\l__codedoc_current_names_struct_tl}
127 }
128 \small \ttfamily
129 \tagpdfsetup{table/tagging=false}
130 \tagpdfparaOff
131 \arrayrulecolor{white}
132 \begin{tabular} { @{} p{\l__codedoc_syntax_dim} @{} }
133 \toprule
134 \begin{minipage}[t]{\l__codedoc_syntax_dim}
135 \raggedright
136 \obeyspaces
137 \obeylines
138 }
139 \cs_set_protected:Npn \__codedoc_syntax_end:
140 {
141 \end{minipage}
142 \end{tabular}
143 \arrayrulecolor{black}
144 \tagstructend
145 \hbox_gset_end:
146 \tag_mc_begin_pop:n{}
147 \bool_if:NF \l__codedoc_in_function_bool
148 {
149 \begin{quote}
150 \mode_leave_vertical:
151 \box_use_drop:N \g__codedoc_syntax_box
152 \end{quote}
153 }
154 }
155 \cs_set_protected:Npn \__codedoc_macro_dump:
156 {
157 \int_compare:nNnF{\l__codedoc_nested_macro_int}>{1}
158 {
159 \begin{displayblock} [tag-name=macro,beginsep=\MacroTopsep]
160 \tagstructbegin{tag=macronames}
161 \tl_set:Ne \l__codedoc_current_names_struct_tl {\tag_get:n{struct_num}}
162 \seq_map_inline:Nn \g__codedoc_macroname_structnum_seq
163 {\tag_struct_use_num:n {##1}}
164 \seq_gclear:N \g__codedoc_macroname_structnum_seq
165 \tagstructend
166 }
167 \noindent\llap
168 { \tagmcend
169 \hbox_unpack_drop:N \l__codedoc_macro_index_box
170 \vtop to \baselineskip
171 {
172 \vbox_unpack_drop:N \l__codedoc_macro_box
173 \vss
174 }
175 \hspace{\labelsep}
176 \tagmcbegin{}
177 }
178 }
179 \cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
180 {
181 \tag_mc_end_push:
182 \vbox_set:Nn \l__codedoc_macro_box
183 {
184 \vbox_unpack_drop:N \l__codedoc_macro_box
185 \int_compare:nNnTF { \l__codedoc_nested_macro_int } = { 1 }
186 {
187 \tagstructbegin{tag=macroname,stash}
188 \seq_gput_right:Ne
189 \g__codedoc_macroname_structnum_seq{\tag_get:n{struct_num}}
190 }
191 {
192 \tagstructbegin{tag=macroname,parent=\l__codedoc_current_names_struct_tl}
193 }
194 \tagmcbegin{}
195 \hbox { \llap { \__codedoc_print_macroname:nN {#1} #2
196 \MacroFont \
197 } }
198 \tagmcend
199 \tagstructend
200 }
201 \tag_mc_begin_pop:n{}
202 \int_incr:N \l__codedoc_macro_int
203 }
204 \cs_set_protected:Npn \__codedoc_macro_reset:
205 {
206 \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
207 \ignorespaces
208 }
209 \cs_set_protected:Npn \__codedoc_macro_end:
210 {
211 \__codedoc_macro_end_check_tested:
212 \int_compare:nNnT \l__codedoc_nested_macro_int = 1
213 {
214 \par \__codedoc_macro_end_style:n { \__codedoc_print_end_definition: }
215 \end{displayblock}
216 }
217 }
218 \def\legacymacrocodesetup{%
219 \macro@font
220 \blank@linefalse \def\par{\ifblank@line
221 \leavevmode \else \fi
222 \blank@linetrue{\@@par}
223 \penalty\interlinepenalty}
224 \obeylines
225 \@noligs
226 \let\do\@makeother \dospecials
227 \global\@newlistfalse
228 \global\@minipagefalse
229 \ifcodeline@index
230
231 \everypar{\global\advance\c@CodelineNo\@ne
232 \llap{\tagmcend\tagstructbegin{tag=codelinenum}
233 \tagmcbegin{}
234 \theCodelineNo\pdffakespace
235 \tagmcend\tagstructend
236 \tagmcbegin{}%
237 \ }%
238 \check@module}%
239 \else \everypar{\check@module}%
240 \fi
241 \tagtool{paratag=codeline}% check tagging
242 }
243 \DeclareInstance{blockenv}{macrocode}{display}
244 {
245 name = macrocode,
246 tag-name = verbatim,
247 tag-attr-class = ,
248 tagging-recipe = standard,
249 inner-level-counter = ,
250 increment-level = false,
251 setup-code = ,
252 block-instance = verbatimblock ,
253 inner-instance = ,
254 final-code = \legacymacrocodesetup ,
255 para-instance = justify,
256 tagging-suppress-paras= true
257 }
258 \RenewDocumentEnvironment{macrocode}{!O{}}
259 {\UseInstance{blockenv}{macrocode}
260 {beginpenalty=\predisplaypenalty,
261 begin-skip=\MacrocodeTopsep,
262 leftmargin=\MacroIndent,
263 parindent=0pt,#1}%
264 \@setupverbinvisiblespace
265 \init@crossref
266 \frenchspacing \@vobeyspaces
267 \xmacro@code
268 }
269 {
270 \ifpm@module \endgroup \pm@modulefalse \fi
271 \everypar{}
272 \endblockenv
273 \close@crossref
274 }
275 \long\def\@doc@env@#1#2#3{%
276 \tagpdfsetup{role/new-tag=#2/Sect}
277 \int_incr:N\l__codedoc_nested_macro_int
278 \int_compare:nNnF{\l__codedoc_nested_macro_int}>{1}
279 {\UseInstance{blockenv}{displayblock}
280 {level-increase=false,tag-name=#2,beginsep=\MacroTopsep}
281 \tagstructbegin{tag=macronames}
282 \tl_set:Ne \l__codedoc_current_names_struct_tl {\tag_get:n{struct_num}}
283 \tagstructend
284 }
285 \edef\saved@macroname{\string#3}%
286 \if #1%
287 \edef\saved@indexname{\expandafter\@gobble\saved@macroname}%
288 \expandafter\ifx
289 \csname Code#2Index\endcsname
290 \CodeMacroIndex
291 \else
292 \record@index@type@save
293 {\saved@indexname}{#2}%
294 \fi
295 \else
296 \let\saved@indexname\saved@macroname
297 \fi
298 \def\makelabel##1{\noindent\llap{
299 \tagmcend
300 \tagstructbegin{tag=macroname,parent=\l__codedoc_current_names_struct_tl}
301 \tagmcbegin{}
302 ##1\hspace{\itemsep}
303 \tagmcend
304 \tagstructend
305 \tagmcbegin{}
306 }}%
307 \int_compare:nNnTF{\l__codedoc_nested_macro_int}>{1}
308 {
309 \let\@tempa\@empty
310 \count@\macro@cnt
311 \loop\ifnum\count@>\z@
312 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne
313 \repeat
314 \edef\makelabel##1{\noindent\llap{
315 \tagmcend
316 \tagstructbegin{tag=macroname,parent=\l__codedoc_current_names_struct_tl}
317 \tagmcbegin{}
318 \vtop to\baselineskip{\@tempa\hbox{##1\kern\labelsep}\vss}
319 \tagmcend
320 \tagstructend
321 \tagmcbegin{}
322 }}%
323 \advance\macro@cnt\@ne
324 }
325 { \macro@cnt\@ne }
326 \ifdoc@noprint
327 \else
328 \edef\@tempa{%
329 \noexpand\makelabel{
330 \noexpand\doc@providetarget
331 \noexpand\strut
332 \noexpand\@nameuse{Print#2Name}{\saved@macroname}}}%
333 \@tempa
334 \fi
335 \ifdoc@noindex\else
336 \global\advance\c@CodelineNo\@ne
337 \csname SpecialMain#2Index\expandafter\endcsname
338 \expandafter{\saved@macroname}\nobreak
339 \global\advance\c@CodelineNo\m@ne
340 \fi
341 \if#1\expandafter\DoNotIndex \expandafter {\saved@macroname}\fi
342 \ignorespaces}
343 \def\doc@createenv#1#2#3{%
344 \@namedef{#3}{%
345 \@ifnextchar[%]
346 {\doc@env{#1}{#2}}{\doc@env{#1}{#2}[]}}%
347 \@namedef{end#3}{\endblockenv}%
348 }
349 \RenewDocElement[macrolike = false ,
350 idxtype = env. ,
351 idxgroup = environments ,
352 printtype = \textit{env.}
353 ]{Env}{environment}
354 \cs_if_exist:NT \__tag_patch_maketitle:
355 {
356 \cs_set_eq:NN \maketitle \__tag_patch_maketitle:
357 }
358
359 \cs_gset:Npn \l@section #1#2
360 {
361 \ifnum \c@tocdepth >\z@
362 \addpenalty\@secpenalty
363 \addvspace{1.0em \@plus\p@}
364 \setlength\@tempdima{2.5em} % was 1.5em
365 \begingroup
366 \parindent \z@ \rightskip \@pnumwidth
367 \parfillskip -\@pnumwidth
368 \leavevmode \bfseries
369 \advance\leftskip\@tempdima
370 \hskip -\leftskip
371 \UseHookWithArguments{contentsline/text/before}{4}
372 {\toclevel@section}{#1}{#2}{\@contentsline@destination}%
373 \csname contentsline@text@1@format\endcsname{#1}
374 \UseHookWithArguments{contentsline/text/after}{4}
375 {\toclevel@chapter}{#1}{#2}{\@contentsline@destination}%
376 \nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss
377 \UseHookWithArguments{contentsline/page/before}{4}
378 {\toclevel@section}{#1}{#2}{\@contentsline@destination}%
379 #2
380 \UseHookWithArguments{contentsline/page/after}{4}
381 {\toclevel@section}{#1}{#2}{\@contentsline@destination}%
382 }\par
383 \endgroup
384 \fi
385 }
386 \AtBeginDocument
387 {
388 \cs_gset_eq:NN \verbatim \Verbatim
389 \cs_gset_eq:NN \endverbatim \endVerbatim
390 }
391 \endinput
392 %%
393 %% End of file `latex-lab-testphase-l3doc.sty'.