summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/tex4ht/exerquiz.4ht
blob: a9740d354a12c9afd6a5afb46190abff0d5c2436 (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
128
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% exerquiz.4ht                          2019-09-14-15:17 %
% Copyright (C) 1999-2009       Eitan M. Gurari         %
% Copyright 2009-2019 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c 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.3c 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 the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.

\def\Rect#1{#1}
\ifx \pdf@rect\:UnDef
   \newsavebox{\pdf@box}
   \def\pdf@rect#1{\leavevmode #1}
\fi
\NewConfigure{javascript}{1}

\let\sv:tocsection\tocsection
\def\tocsection{\let\toclikesection\:gobbleIII \sv:tocsection}
\def\hypertarget#1#2{\Link{}{#1}\EndLink#2}
\def\hyperlink#1#2{\Link{#1}{}#2\EndLink}

\append:def\exercise{\Link{}{page.ex\the@exno}\EndLink }
\pend:def\endsolution{\def\thepage{ex\the@exno}}

\let\:shortquiz\shortquiz
\def\shortquiz{\gHAdvance\:onClick by 1
   \Link{}{page.qz\:onClick}\EndLink   \:shortquiz
   \pend:def\endsolution{\def\thepage{qz\:onClick}}}

\pend:def\include@quizsolutions{%
    \let\sv:newpage\newpage
    \append:def\newpage{\ht:everypar{\HtmlPar}}}
\append:def\include@solutions{%
    \let\noindent\sv:noindent}

\HAssign\:onClick = 0
\HAssign\Prob:N = 0
\HAssign\Quiz:N = 0

\append:def\shortquiz{\pend:def\answers{\gHAdvance\Prob:N by 1
   \let\:NAME\empty}}
\let\:@quiz\@quiz
\def\@quiz*#1#2{%
   \if #1f \let\c:quiz\C:quiz\fi
   \:@quiz*{#1}{#2}%
   \pend:defI\answers{\gHAdvance\Prob:N by 1
   \let\:NAME\empty}}

\pend:def\quiz{%
   \let\:bqlabel\bqlabel
   \def\bqlabel{\IgnorePar\EndP
      \Tg<form action="." class="quiz"
            id="thisform\Quiz:N">%
            \Tg<input value="\:bqlabel"  type="reset"
             onClick='\c:quiz' />}%
    \let\:eqlabel\eq@eqlabel
    \def\eq@eqlabel{\IgnorePar\EndP
             \Tg<input type="button" value="\:eqlabel"
             onClick='\a:javascript \d:quiz' />%
        \ifeq@nocorrections\else
           \Tg<input type="button" value="\eq@CA"
              name="correct\Quiz:N"
              onClick='\a:javascript \e:quiz' />%
        \fi
    }%
    \gHAdvance\Quiz:N by 1 \gHAssign\Prob:N=0    \ShowPar
   }
\append:def\endquiz{\let\eq@eqlabel=\:eqlabel
   \Tg</form>\Tag{ans-\Quiz:N}{\Prob:N}}
\pend:def\shortquiz{\leavevmode
   \Tg<form action="." class="shortquiz">\IgnorePar}
\append:def\endshortquiz{\Tg</form>}{}{}
\def\Ans@i#1{\stepcounter{quizno}{
   \ifx#11
         \js:click{\b:shortquiz}{\a:shortquiz}{\ifx
                \@qzsolndest\empty 0\else 1\fi}%
   \else \js:click{\c:shortquiz}{\a:shortquiz}{0}%
   \fi
}}%
\NewConfigure{shortquiz}{3}
\pend:defII\ReturnTo{\noindent\a:ReturnTo}
\append:defII\ReturnTo{\b:ReturnTo}
\NewConfigure{ReturnTo}{2}

\def\Ans@l#1{\stepcounter{quizno}%
   \ifnum #1=1 \def\:NAME{ id="ans\Quiz:N x\Prob:N" }\fi
   \def\ANS{#1}%
   \js:click{\b:quiz}{\a:quiz}{0}}
\NewConfigure{quiz}{5}

\def\Ans@f#1{\stepcounter{quizno}%
   \ifnum #1=1 \def\:NAME{ id="ans\Quiz:N x\Prob:N" }\fi
   \def\ANS{#1}%
   \js:click{\B:quiz}{\A:quiz}{0}}
\NewConfigure{quiz*}[3]{\def\A:quiz{#1}\def\B:quiz{#2}\def\C:quiz{#3}}
\Configure{quiz*}{}{}{}

\LinkCommand\js:link{input,,,, /}
\LinkCommand\js:Link{input,onClick='\a:javascript \noexpand\:tempa
   href(\noexpand\:gobble,,, /}
\def\js:click#1#2#3{\ifnum #3=0
      \js:link[ type="button" value="#2"\Hnewline
                class="onClickClass"  onClick='\a:javascript #1'
                name="ans\Quiz:N y\Prob:N"
                \:NAME]{}{}%
   \else
      \def\:tempa{#1}%
      \js:Link[ );' type="button" value="#2"\Hnewline
                name="ans\Quiz:N y\Prob:N"
                class="onClickClass"  \:NAME]{\@qzsolndest}{}%
   \fi
}

\Hinput{exerquiz}
\endinput