Skip to content
Snippets Groups Projects
Commit 1e6ae5be authored by Philip Kaluđerčić's avatar Philip Kaluđerčić :u7121:
Browse files

Allow folding questions and answers over multiple lines

parent 77391d36
No related branches found
No related tags found
No related merge requests found
......@@ -50,9 +50,8 @@ while (<>) {
my $any = 0;
foreach my $opt (@options) {
# unless (defined $opt->{"correct"}) {
# die "undefined \"$question\" ($ARGV:$.)\n";
# }
$opt->{"option"} = md($opt->{"option"})
if $opt->{"option"};
$any = 1 if (not (defined $opt->{"correct"})) or ($opt->{"correct"} eq JSON::true);
}
die "no correct option at \"$question\" ($ARGV)\n"
......@@ -80,9 +79,12 @@ while (<>) {
$question = $2;
chomp $question;
$source = $3;
chomp $source if $source;
} elsif (/^[|](.+)/) {
if ($last_option{"option"}) {
$last_option{"option"} .= $1;
} else {
$question .= $1;
}
} elsif (/^@(.*)/) {
$media = $1;
chomp $media;
......@@ -90,7 +92,7 @@ while (<>) {
add();
%last_option =
(
"option" => md($2),
"option" => $2,
"correct" => $1 eq "+" ? JSON::true : $1 eq "-" ? JSON::false : JSON::null
);
} elsif (/^.+$/) { # non-empty line
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment