summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/urcls/tex/URoptions.sty
blob: 39b1cb162f4a99b6f03eb4310a39dc65d24b438f (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
%% 
%%  This is file `URoptions.sty' version 2.0 (2017/04/05),
%%	it is part of
%%  urcls -- Corporate Design for the University of Regensburg
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2016--2017 by Marei Peischl <TeX@mareipeischl.de>
%%
%% ----------------------------------------------------------------------------
%%  License information
%% ----------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Marei Peischl.
%%
%% ============================================================================
%%
%%  Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz
%%  in der Version 1.3c, verteilt und/oder verändert werden. Die aktuelle
%%  Version dieser Lizenz ist http://www.latex-project.org/lppl.txt und
%%  Version 1.3c oder neuer ist Teil aller LaTeX-Distributionen ab 2005/12/01. 
%%  Dieses Werk hat den LPPL-Verwaltungs-Status "maintained". 
%%  Die Verwaltung liegt aktuell bei der Autorin, Marei Peischl.
%%
%% ----------------------------------------------------------------------------
%%  End of license information
%% ----------------------------------------------------------------------------
%%

\NeedsTeXFormat{LaTeX2e}
\def\fileversion{2.0}
\def\filedate{2017/04/05}

\RequirePackage{expl3}
\ProvidesExplPackage{URoptions}{\filedate}{\fileversion}{Implementation of keyval-options for the urcls bundle}

\RequirePackage{URspecialopts}


%Define the departments
\clist_new:N \g_UR@dep_clist
\clist_gset:Nn \g_UR@dep_clist {lov,ffg,asz,rw,ww,kt,pkgg,pps,slk,bvm,mat,ph,chp,med,ub,zsk,eur,zhw,rul,zfw,spo,rz,fsimphy}


\cs_new:Nn \UR_Define@Key:n {
	\exp_args:Nx \keys_define:nn { \@currname.\@currext }
	{#1}
}

\cs_new:Nn \UR_Define@Key:nnn {
	\exp_args:Nx \keys_define:nn { \@currname.\@currext }
	{#1#2=#3}
}

\cs_generate_variant:Nn \UR_Define@Key:nnn {xno,xnn}% {xo,xn}

\cs_new:Nn \UR_set@Key:n {
	\exp_args:Nx \keys_set:nn { \@currname.\@currext }
	{#1}
}

\cs_new:Npn \UR_Define@BoolKey [#1]#2 {
	\UR_Define@Key:n {
		#2 .bool_gset:c = {g_UR@#1_bool},
		#2 .default:n = {true}
	}
}

\cs_new:Nn \UR_set@InitialValue:nn {
	\UR_Define@Key:n {
		#1 .initial:n = #2
	}
}




%\NewDocumentCommand{\UR_Define@ComplementaryKey}{smmD<>{}}{
\cs_new:Npn \UR_Define@ComplementaryKey [#1]#2 {
	\UR_Define@Key:n 
	{
		#2 .bool_gset_inverse:c = {g_UR@#1_bool},
		#2 .default:n = {true},
	}
}


\newcommand*{\UR_new@BoolOpt}{
	\@dblarg\UR_Define@BoolKey
}


\newcommand*{\UR@define@draftfinalkeys}{
	\UR_new@BoolOpt{draft}
	\UR_Define@ComplementaryKey[draft]{final}
}

%\UR@create@ChoiceKey{key}[default]{{value}{code},{value}{code}}<initial value>
\NewDocumentCommand\UR@create@ChoiceKey{momd<>}{
	\UR_Define@Key:n{
		#1 .choice:
	}
	\clist_map_inline:nn {#3} {
		\UR_Define@Key:xnn {#1 / \use_i:nn ##1} { .code:n} {\use_ii:nn ##1}
	}
	\IfNoValueF{#4}{
		\UR_set@InitialValue:nn {#1}{#4}
	}
	\IfNoValueF{#2}{\UR_Define@Key:n { #1 .default:n = #2}}
}

\newcommand*{\UR@DeclareColorOptions}{
	\Module@DefineSpecialPassKey{colors}<URrules>
	\clist_map_inline:Nn \g_UR@dep_clist  {\Module@DeclarePassOption{##1}[true]{URrules}}
	\clist_map_inline:nn {all,faculties} {\Module@DeclarePassOption{##1}[true]{URrules}}
}

\endinput