diff --git a/MANUAL.md b/MANUAL.md index 153bc3d..98ab6d1 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -95,7 +95,10 @@ A test is a file in `yaml` format that can reside anywhere on the filesystem. It practice_mode: True # Show the data structures obtained from the test and the questions - debug: True + debug: False + + # Show the file and ref field of each question + show_ref: True # ------------------------------------------------------------------------- # This are the questions database to be imported. diff --git a/serve.py b/serve.py index 01d6367..32ff15b 100755 --- a/serve.py +++ b/serve.py @@ -146,6 +146,8 @@ def parse_arguments(): argparser.add_argument('--server', default='conf/server.conf', type=str, help='server configuration file') argparser.add_argument('--debug', action='store_true', help='Show datastructures when rendering questions') + argparser.add_argument('--show_ref', action='store_true', + help='Show filename and ref field for each question') argparser.add_argument('--show_points', action='store_true', help='Show normalized points for each question') argparser.add_argument('--show_hints', action='store_true', @@ -161,7 +163,7 @@ def parse_arguments(): if __name__ == '__main__': # --- parse command line arguments and build base test arg = parse_arguments() - testconf = test.read_configuration(arg.testfile[0], debug=arg.debug, show_points=arg.show_points, show_hints=arg.show_hints, save_answers=arg.save_answers, practice=arg.practice) + testconf = test.read_configuration(arg.testfile[0], debug=arg.debug, show_points=arg.show_points, show_hints=arg.show_hints, save_answers=arg.save_answers, practice=arg.practice, show_ref=arg.show_ref) print('=' * 79) print('- Title: %s' % testconf['title']) diff --git a/templates/test.html b/templates/test.html index 00296dc..0897134 100644 --- a/templates/test.html +++ b/templates/test.html @@ -157,7 +157,7 @@  Classificar
-

${i+1}.

+

${i+1}.

${pretty(q['text'])} @@ -253,11 +253,24 @@ % endif

- % if t['debug']: + % if t['debug'] or t['show_ref']: % endif diff --git a/test.py b/test.py index b5355ac..eab81f8 100644 --- a/test.py +++ b/test.py @@ -11,7 +11,7 @@ import questions import database # =========================================================================== -def read_configuration(filename, debug=False, show_points=False, show_hints=False, practice=False, save_answers=False): +def read_configuration(filename, debug=False, show_points=False, show_hints=False, practice=False, save_answers=False, show_ref=False): # FIXME validar se ficheiros e directorios existem??? if not os.path.isfile(filename): print('Cannot find file "%s"' % filename) @@ -31,6 +31,7 @@ def read_configuration(filename, debug=False, show_points=False, show_hints=Fals test['show_points'] = bool(test.get('show_points', show_points)) test['practice'] = bool(test.get('practice', practice)) test['debug'] = bool(test.get('debug', debug)) + test['show_ref'] = bool(test.get('show_ref', show_ref)) test['save_answers'] = bool(test.get('save_answers', save_answers)) if test['save_answers']: if 'answers_dir' not in test: -- libgit2 0.21.2