diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-16 22:43:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-16 22:43:33 +0000 |
commit | 7e80fa208736f4ab99b1d57dd1571da41f1e3744 (patch) | |
tree | 606bd82a5737d587ef239fd58a5a58c256666178 /Master/texmf-dist/scripts/webquiz/webquiz_layout.py | |
parent | 9de7d0ea371387f647487812b48b51030c739bdf (diff) |
webquiz
git-svn-id: svn://tug.org/texlive/trunk@50419 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/webquiz/webquiz_layout.py')
-rwxr-xr-x | Master/texmf-dist/scripts/webquiz/webquiz_layout.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/webquiz/webquiz_layout.py b/Master/texmf-dist/scripts/webquiz/webquiz_layout.py new file mode 100755 index 00000000000..89b5f3d94e4 --- /dev/null +++ b/Master/texmf-dist/scripts/webquiz/webquiz_layout.py @@ -0,0 +1,73 @@ +r''' +----------------------------------------------------------------------------- + webquiz_local | default layout of webquiz quiz pages. +----------------------------------------------------------------------------- + + Copyright (C) Andrew Mathas, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the WebQuiz system. + + <Andrew.Mathas@sydney.edu.au> +----------------------------------------------------------------------------- +''' + +# -*- encoding: utf-8 -*- + +from webquiz_templates import no_script + +# If you want to create a new version of this file to change the +# quiz web page layout then the following "dictionary" of code variables +# is likely to be useful: +# quiz.breadcrumbs = HTML for breadcrunbs +# quiz.css = css includes for quisz +# quiz.department = department from \UnitDepartment +# quiz.department_url = unit url from \UnitURL +# quiz.header = header links for quiz +# quiz.institution = institution from \Institution +# quiz.institution_url = unit url from \InstitutionURL +# quiz.javascript = javascript includes for quiz +# quiz.quiz_header = HTMK for quiz title and navigation arrows +# quiz.quiz_questions = html for quiz +# quiz.side_menu = HTML for side menu, including navigation buttons +# quiz.title = web page title from \title{...} command +# quiz.unit_code = unit code from \UnitCode +# quiz.unit_name = unit name from \UnitName +# quiz.unit_url = unit url from \UnitURL +# quiz.webquiz_init = javascript for initialising quiz page. +# This MUST appear tow<M-C-D-A>rds the end of HTML body + +def write_web_page(quiz): + return quiz_page.format( + title=quiz.quiz.title, # page title + htmlpreamble=quiz.header + quiz.javascript + quiz.css, # header material + breadcrumbs=quiz.breadcrumbs, # bread crumb constructed above + side_menu=quiz.side_menu, # navigation menu for quiz + quiz_header=quiz.quiz_header, # quiz title + navigation arrows + quiz_questions=quiz.quiz_questions, # html for quiz + no_script=no_script, # error when javascript is not enabled + webquiz_init=quiz.webquiz_init # parting javascript callsWebQuizInt + ) + + +quiz_page = r'''<!DOCTYPE HTML> +<html lang="en"> +<head> + <title> {title} </title> + {htmlpreamble} +</head> +<body> + {no_script}{breadcrumbs} + <div class="quiz-page"> + {side_menu} + <div class="quiz-questions"> + {quiz_header} + {quiz_questions} + </div> + </div> + {webquiz_init} +</body> +</html> +''' |