summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/schule/schule.mod.Aufgabenpool.code.tex
blob: 76e66d9795c718796f10b528c0f433102885bf0e (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
\ExplSyntaxOn

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Optionen für den Aufgabenpool
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clist_new:N \g__schule_aufgabenoptionen_clist

\DeclareDocumentCommand{\ifAufgabenpoolOptionTF}{m m m}{
    \clist_if_in:NnTF \g__schule_aufgabenoptionen_clist {#1} {#2} {#3}
}

\DeclareDocumentCommand{\ifAufgabenpoolOptionT}{m m}{
    \clist_if_in:NnT \g__schule_aufgabenoptionen_clist {#1} {#2}
}

\DeclareDocumentCommand{\ifAufgabenpoolOptionF}{m m}{
    \clist_if_in:NnF \g__schule_aufgabenoptionen_clist {#1} {#2}
}

\DeclareExerciseProperty-{poolOptionen}

\DeclareDocumentCommand{\setAufgabenpoolOptionen}{m}{
    \clist_set:Nn \g__schule_aufgabenoptionen_clist {#1}%
}

\DeclareDocumentCommand{\set@AufgabenpoolOptionen@Property}{}{
    \exp_args:Nnf\SetExerciseProperty{poolOptionen}{\clist_use:Nn \g__schule_aufgabenoptionen_clist {,}}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Basedir Elemente
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\str_new:N \g__schule_basedir_string
\str_gset:Nn \g__schule_basedir_string {.}

\DeclareExerciseProperty-{basedir}

\DeclareDocumentCommand{\setBasedir}{}{
    \exp_args:Nnf\SetExerciseProperty{basedir}{\str_use:N \g__schule_basedir_string}%
}

\DeclareDocumentCommand{\getBasedir}{}{
    \str_use:N \g__schule_basedir_string
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Aufgabenhinweise
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bool_new:N \g__schule_aufgabenhinweis_bool
\bool_gset_true:N \g__schule_aufgabenhinweis_bool
\NewDocumentEnvironment{aufgabenpoolHinweis}{+b}{
     \bool_if:NT \g__schule_aufgabenhinweis_bool {#1}
}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Aufgabeneinbindung
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\aufgabeninput}{o m m}{
    \bool_gset_false:N \g__schule_aufgabenhinweis_bool
    \str_gset:Nn \g__schule_basedir_string {#2}
    \clist_set:Nn \g__schule_aufgabenoptionen_clist {#1}
    \input{#2/#3}
    \bool_gset_true:N \g__schule_aufgabenhinweis_bool
}

\xsimsetup{
  aufgabe/begin-hook = \setBasedir\set@AufgabenpoolOptionen@Property,
  loesung/begin-hook = \clist_set:Nx \g__schule_aufgabenoptionen_clist {\GetExerciseProperty{poolOptionen}} \str_gset:Nx \g__schule_basedir_string {\GetExerciseProperty{basedir}},
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% InputOnce
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clist_new:N \g__schule_inputonce_clist

\DeclareDocumentCommand{\inputOnce}{m}{
    \clist_if_in:NnF \g__schule_inputonce_clist {#1} {
        \clist_gput_right:Nn \g__schule_inputonce_clist {#1}
        \input{\getBasedir/#1}
    }
}

\ExplSyntaxOff