Commit c9a1939f authored by Jojo Boulix's avatar Jojo Boulix
Browse files

Bugfix: allow 0 in boxes with [0] in the AMC-TXT source file. Closes: #681.

parent 035014a5
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ sub scoring_string {
sub format_answer {
    my ( $self, $a ) = @_;
    my $t = '\\' . ( $a->{correct} ? 'correct' : 'wrong' ) . 'choice';
    $t .= '[' . $a->{letter} . ']' if ( $a->{letter} && $a->{letter} ne '' );
    $t .= '[' . $a->{letter} . ']' if ( defined($a->{letter}) && $a->{letter} ne '' );
    $t .= '{' . $self->format_text( $a->{text} ) . "}";
    $t .= $self->scoring_string( $a, 'a' );
    $t .= "\n";
+8 −1
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ sub new {
        export_ods          => '',
        blind               => 0,
        check_zooms         => {},
        check_subject       => '',
        skip_prepare        => 0,
        skip_scans          => 0,
        tracedest           => \*STDERR,
@@ -1078,6 +1079,11 @@ sub check_textest {
    }
  }

sub check_subject {
    my ($self) = @_;
    $self->see_file( $self->{temp_dir} . "/sujet.pdf" );
}

sub data {
    my ($self) = @_;
    return ( AMC::Data->new( $self->{temp_dir} . "/data" ) );
@@ -1264,6 +1270,7 @@ sub default_process {
    my ($self) = @_;

    $self->prepare       if ( !$self->{skip_prepare} );
    $self->check_subject if ( $self->{check_subject} );
    $self->defects;
    $self->check_pages;
    if ( !$self->{skip_scans} ) {
+1 −0
Original line number Diff line number Diff line
f5da334596176ae6e907f2c39c63d3e6 /tmp/AMC-VISUAL-TEST/0002-sujet.pdf
+13 −0
Original line number Diff line number Diff line
# AMC-TXT source
PaperSize: A4
Lang: FR
SeparateAnswerSheet:1
AnswerSheetTitle: Feuille réponse
Title: Mon premier questionnaire

**Ma question

-[0]{0} 0
-[]{1} lettre (1)
+[2]{2} 2
+{3} lettre (2)
+31 −0
Original line number Diff line number Diff line
#! /usr/bin/perl
#
# Copyright (C) 2012-2019 Alexis Bienvenue <paamc@passoire.fr>
#
# This file is part of Auto-Multiple-Choice
#
# Auto-Multiple-Choice 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 2 of
# the License, or (at your option) any later version.
#
# Auto-Multiple-Choice 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 Auto-Multiple-Choice.  If not, see
# <http://www.gnu.org/licenses/>.

require "./AMC/Test.pm";

AMC::Test->new(
    dir           => __FILE__,
    filter        => 'plain',
    tex_engine    => 'xelatex',
    n_copies      => 1,
    perfect_copy  => [],
    check_subject => 1
)->default_process;