summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ximera/src/outcomes.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/ximera/src/outcomes.dtx')
-rw-r--r--macros/latex/contrib/ximera/src/outcomes.dtx34
1 files changed, 34 insertions, 0 deletions
diff --git a/macros/latex/contrib/ximera/src/outcomes.dtx b/macros/latex/contrib/ximera/src/outcomes.dtx
new file mode 100644
index 0000000000..1e174b7655
--- /dev/null
+++ b/macros/latex/contrib/ximera/src/outcomes.dtx
@@ -0,0 +1,34 @@
+% \subsubsection{Learning Outcomes}
+% \DescribeMacro{\outcome}{Specify a learning outcome, either at the level of a |problem| or an entire document in the preamble.}
+% \begin{macrocode}
+%<*classXimera>
+\def\theoutcomes{}
+
+\ifdefined\HCode%
+ \newcommand{\outcome}[1]{}
+\else%
+ \newwrite\outcomefile
+ \immediate\openout\outcomefile=\jobname.oc
+
+ \newcommand{\outcome}[1]{\edef\theoutcomes{\theoutcomes #1~}%
+ \immediate\write\outcomefile{\unexpanded{\outcome}{#1}}}
+ \fi%
+%</classXimera>
+% \end{macrocode}
+% These can appear in either the preamble or in problem environments.
+% with pdflatex, we produce the .oc file which includes ALL the
+% outcomes; in the tex4ht world, we just produce spans for the
+% specific outcomes.
+% \begin{macrocode}
+%<*cfgXimera>
+\renewcommand{\outcome}[1]{
+ \Configure{@HEAD}{\HCode{<meta name="learning-outcome" content="#1"/>\Hnewline}}
+}
+% Sometimes there are no outcomes at all
+\IfFileExists{\jobname.oc}{\input{\jobname.oc}}{}
+
+\renewcommand{\outcome}[1]{%
+ \HCode{<span class="learning-outcome">#1</span>}
+}
+%</cfgXimera>
+% \end{macrocode}