{
* mkquiz
* creates HTML output for a quiz from a simplified input script
*
* the created HTML code needs the files:
* "akfquiz4.js", "leer.png", "falsch.png", "richtig.png",
* and optionally a given CSS file
*
* Copyright (c) 2003-2006,2007,2010,2014
* Andreas K. Foerster
*
* Environment: FreePascal
*
* This file is part of AKFQuiz
*
* AKFQuiz is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* AKFQuiz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
}
{ compatiblity definition }
{$IfDef _WIN32} {$Define Windows} {$EndIf}
{$IfDef Win32} {$Define Windows} {$EndIf}
{$IfDef Windows}
{$R w32/mkquiz.res}
{$EndIf}
{$IfDef FPC}
{$Mode Delphi}
{$LongStrings on}
{$IfDef Windows}
{$AppType Console}
{$EndIf}
{$EndIf}
{$I+}
program mkquiz(input, output, stderr);
uses uakfquiz, htmlquiz, qmsgs, qsys;
{ GNU compliant format }
const PrgVersion = 'mkquiz ('+ AKFQuizName + ') ' + AKFQuizVersion;
type TMode = (automode, makeindex);
type
Tjavascriptquiz =
object(Thtmlquiz)
function GeneratorName: mystring; virtual;
procedure headdata; virtual;
procedure StartQuiz; virtual;
procedure putgraphic; virtual;
procedure evaluate; virtual; { here: print buttons }
procedure processHint; virtual;
procedure processAssessment; virtual;
procedure processAssessmentPercent; virtual;
procedure EndQuiz; virtual;
procedure attachQuizfile;
end;
var
MyQuiz: Tjavascriptquiz;
MyExitCode: integer;
var
modes : set of TMode;
outpath : mystring;
idxfile : text;
procedure version;
begin
WriteLn(PrgVersion);
WriteLn;
WriteLn('Copyright (C) ', AKFQuizCopyright);
WriteLn('Copyright (C) 1999-2001 Free Software Foundation, Inc.');
WriteLn;
WriteLn(msg_License, msg_GPL);
{$IfDef Advertisement}
WriteLn;
WriteLn(msg_advertisement);
{$EndIf}
WriteLn;
WriteLn(msg_noWarranty);
WriteLn;
WriteLn('Written by Andreas K. Foerster');
WriteLn;
WriteLn(msg_contributions);
WriteLn(Contributors);
Halt
end;
procedure help;
begin
WriteLn('creates HTML file with a quiz (needs akfquiz5.js)');
WriteLn;
WriteLn('Usage: mkquiz [options] [input files]');
WriteLn(' or: mkquiz -h | --help | /?');
WriteLn(' or: mkquiz --version');
WriteLn;
WriteLn('Options:');
WriteLn(' -o , --out directory for output files');
WriteLn(' -a, --auto process all quizfiles in current directory');
WriteLn(' -i, --index write an index.html for all files processed');
{$IfDef FPC} {$IfDef Go32v2}
WriteLn(' -LFN use long filenames (DOS only)');
{$EndIf} {$EndIf}
WriteLn;
WriteLn('Default charset: '+def_charset);
{$IfDef FPC}
{$IfDef DPMI}
WriteLn('LFN support: ', LFNsupport);
{$EndIf}
{$EndIf}
if BugMail <> ''
then begin WriteLn; WriteLn('Report bugs to <' + BugMail + '>.') end;
Halt
end;
function quote(s: string): mystring;
var
i : integer;
e : mystring;
begin
e := '';
for i := 1 to length(s) do
if s[i]<>''''
then e := e + s[i]
else e := e + '\''';
quote := e
end;
{ --------------------------------------------------------------------- }
function Tjavascriptquiz.GeneratorName: mystring;
begin
GeneratorName := PrgVersion
end;
procedure Tjavascriptquiz.headdata;
begin
inherited headdata;
WriteLn(outp,
'')
end;
procedure Tjavascriptquiz.StartQuiz;
begin
inherited StartQuiz;
WriteLn(outp, '');
WriteLn(outp);
WriteLn(outp, '