summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ximera/src/foldable.dtx
blob: 94c5eb36cb0205c61152420c1ac7fde71f228318 (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
% \subsubsection{Foldable}
% The package \verb|mdframed| is used to make pretty foldable, but the
% amsthm/mdframed conflict also messes up the .jax file so we don't
% load mdframed when performing the xake step.  But even the below
% isn't enough to fix this.
%    \begin{macrocode}
%\iftikzexport\else\RequirePackage[framemethod=TikZ]{mdframed}\fi
%    \end{macrocode}
% \DescribeEnv{foldable}{Does it fold?}
%    \begin{macrocode}
%<*classXimera>

\colorlet{textColor}{black} % since textColor is referenced below
\colorlet{background}{white} % since background is referenced below

% The core environments. Find results in 4ht file.
%% pretty-foldable
%\iftikzexport
\newenvironment{foldable}{%
}{%
}
%\else
%\renewmdenv[
%  font=\upshape,
%  outerlinewidth=3,
%  topline=false,
%  bottomline=false,
%  leftline=true,
%  rightline=false, 
%  leftmargin=0,
%  innertopmargin=0pt,
%  innerbottommargin=0pt,
%  skipbelow=\baselineskip,
%  linecolor=textColor!20!white,
%  fontcolor=textColor,
%  backgroundcolor=background
%]{foldable}%
%\fi

%% pretty-expandable
%\iftikzexport
\newenvironment{expandable}{%
}{%
}
%\else
%\newmdenv[
%  font=\upshape,
%  outerlinewidth=3,
%  topline=false,
%  bottomline=false,
%  leftline=true,
%  rightline=false, 
%  leftmargin=0,
%  innertopmargin=0pt,
%  innerbottommargin=0pt,
%  skipbelow=\baselineskip,
%  linecolor=black,
%]{expandable}%
%\fi

\newcommand{\unfoldable}[1]{#1}

%</classXimera>
%    \end{macrocode}
% On the web, these foldable elements could be HTML5 details and summary.
%    \begin{macrocode}
%<*htXimera>
\renewenvironment{foldable}{\stepcounter{identification}\ifvmode \IgnorePar\fi \EndP\HCode{<div id="foldable\arabic{identification}" class="foldable">}}{\HCode{</div>}\IgnoreIndent}

\renewenvironment{expandable}{\stepcounter{identification}\ifvmode \IgnorePar\fi \EndP\HCode{<div data-original="expandable" id="foldable\arabic{identification}" class="foldable">}

}{\HCode{</div>}\IgnoreIndent}

\renewcommand{\unfoldable}[1]{\HCode{<span class="unfoldable">}#1\HCode{</span>}}
%</htXimera>
%    \end{macrocode}