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 (<>) { ...@@ -50,9 +50,8 @@ while (<>) {
my $any = 0; my $any = 0;
foreach my $opt (@options) { foreach my $opt (@options) {
# unless (defined $opt->{"correct"}) { $opt->{"option"} = md($opt->{"option"})
# die "undefined \"$question\" ($ARGV:$.)\n"; if $opt->{"option"};
# }
$any = 1 if (not (defined $opt->{"correct"})) or ($opt->{"correct"} eq JSON::true); $any = 1 if (not (defined $opt->{"correct"})) or ($opt->{"correct"} eq JSON::true);
} }
die "no correct option at \"$question\" ($ARGV)\n" die "no correct option at \"$question\" ($ARGV)\n"
...@@ -80,9 +79,12 @@ while (<>) { ...@@ -80,9 +79,12 @@ while (<>) {
$question = $2; $question = $2;
chomp $question; chomp $question;
} elsif (/^[|](.+)/) {
$source = $3; if ($last_option{"option"}) {
chomp $source if $source; $last_option{"option"} .= $1;
} else {
$question .= $1;
}
} elsif (/^@(.*)/) { } elsif (/^@(.*)/) {
$media = $1; $media = $1;
chomp $media; chomp $media;
...@@ -90,7 +92,7 @@ while (<>) { ...@@ -90,7 +92,7 @@ while (<>) {
add(); add();
%last_option = %last_option =
( (
"option" => md($2), "option" => $2,
"correct" => $1 eq "+" ? JSON::true : $1 eq "-" ? JSON::false : JSON::null "correct" => $1 eq "+" ? JSON::true : $1 eq "-" ? JSON::false : JSON::null
); );
} elsif (/^.+$/) { # non-empty line } 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