summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/commutative-diagrams/tikzlibrarycommutative-diagrams.ozos.code.tex
blob: 2af54462b5b76e5495cfcad33c3f0f0b857a8e2a (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
%
% CoDi: Commutative Diagrams for TeX
% Copyright (c) 2015-2024 Paolo Brasolin <paolo.brasolin@gmail.com>
% SPDX-License-Identifier: MIT
%
% This file is part of CoDi 1.1.1, released on 2024/03/29 under MIT license.
%

% όζος • (ózos)
%   1. node
%   2. nodule
%   3. gnarl

% Ozos is an alternative parsing mechanism for TiKz nodes.
% It implements the following transformation
%   \kDOzos ... {CONTENTS};  --->  \node ... [node contents={CONTENTS}];
% to ensure the node contents always pass through the TikZ key.

\usetikzlibrary{commutative-diagrams.koinos}

%==[ TikZ/pgf layer ]===========================================================

\pgfkeys{/ozos/every node/.style={}}

%==[ main macro ]===============================================================

\def\kDOzos%
  {\kDOzosFetchThen
  {\kDOzosMaybeDumpThen
   \kDOzosOutput}}

%==[ fetching routine ]=========================================================

% I use the general one implemented by koinos.
\let\kDOzosFetchThen\kDFetchOptAndGrpThen

%==[ parsing routine ]==========================================================

% Trivially solved by fetching.

%==[ dumping routine ]==========================================================

\def\kDOzosMaybeDumpThen#1{%
  \kDDump{options: '\the\kDOptTok'}%
  \kDDump{content: '\the\kDGrpTok'}%
  #1}

%==[ output routine ]===========================================================

\def\kDOzosOutput{
  \edef\kDAct{
    \noexpand\node
      [/ozos/every node]
      \the\kDOptTok
      [/tikz/node contents={\the\kDGrpTok}];
  }
  \kDAct
}