diff --git a/quizgen.py b/quizgen.py index 9a73fdb..affac43 100755 --- a/quizgen.py +++ b/quizgen.py @@ -434,6 +434,7 @@ def add_dom_to_template(dom, html_file_name, quiz): # Add the header. By replacing this early, we allow the header to # contain IMG and LINK tags (or even CODE), though it would typically # be pure HTML + content = content.replace('[STYLES_SCRIPTS]', get_head()); content = content.replace('[SUBMIT_LABEL]', _('Submit')) content = content.replace('[HIDE_LABEL]', _('Hide')) content = content.replace('[HEADER]', get_header()) @@ -549,6 +550,17 @@ def get_header(): else: header = header_file.read() return header + +# Should a HTML head file exist return the content of that file +# otherwise return the STYLES_SCRIPTS +def get_head(): + try: + header_file = open('head.html') + except IOError: + header = STYLES_SCRIPTS + else: + header = header_file.read() + return header # Should a footer file exist return the content of that file # otherwise return the standard footer @@ -654,24 +666,8 @@ def main(): - [TITLE] - - - - - - - - - + [STYLES_SCRIPTS] + + + + + +""" if __name__ == '__main__': main()