texlive[50694] trunk: webquiz (1apr19)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 1 23:07:31 CEST 2019


Revision: 50694
          http://tug.org/svn/texlive?view=revision&revision=50694
Author:   karl
Date:     2019-04-01 23:07:31 +0200 (Mon, 01 Apr 2019)
Log Message:
-----------
webquiz (1apr19)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/webquiz/webquiz.py
    trunk/Master/texmf-dist/doc/latex/webquiz/README.rst
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/README-examples
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-complex.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-integer.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-lowercase.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-number.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-star.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-string.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/breadcrumbs.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/choice-multiple.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/choice-single.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/ctanLion.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/discussion-Qref.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/discussion-ref.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/discussion.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/display-as-image.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/french.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/index-cz.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/index-en.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/montypython.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/nounits.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/onepage.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/pst2pdf.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/pstricks-ex.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/quiz-page.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/quiz-page.tex
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/quizindex-dropdown.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/random.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/simple-html.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/simple-pdf.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-blue.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-darkblue.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-darkred.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-default.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-earthy.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-fresh.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-light.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-lively.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-muted.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-sleek.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-spring.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-vibrant.png
    trunk/Master/texmf-dist/doc/latex/webquiz/examples/tikz-ex.png
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz-online-manual.pdf
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.languages
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.pdf
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.settings
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.tex
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.themes
    trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.usage
    trunk/Master/texmf-dist/doc/man/man1/webquiz.1
    trunk/Master/texmf-dist/doc/man/man1/webquiz.man1.pdf
    trunk/Master/texmf-dist/scripts/webquiz/CHANGES.rst
    trunk/Master/texmf-dist/scripts/webquiz/webquiz
    trunk/Master/texmf-dist/scripts/webquiz/webquiz.bat
    trunk/Master/texmf-dist/scripts/webquiz/webquiz.py
    trunk/Master/texmf-dist/scripts/webquiz/webquiz_layout.py
    trunk/Master/texmf-dist/scripts/webquiz/webquiz_makequiz.py
    trunk/Master/texmf-dist/scripts/webquiz/webquiz_templates.py
    trunk/Master/texmf-dist/scripts/webquiz/webquiz_util.py
    trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.cfg
    trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.ini

Modified: trunk/Build/source/texk/texlive/linked_scripts/webquiz/webquiz.py
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/webquiz/webquiz.py	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Build/source/texk/texlive/linked_scripts/webquiz/webquiz.py	2019-04-01 21:07:31 UTC (rev 50694)
@@ -42,7 +42,7 @@
     try:
         metadata = webquiz_util.MetaData(ini_file, debugging=False)
     except (FileNotFoundError, subprocess.CalledProcessError):
-        print('webquiz installation error: unable to find webquiz.ini -> {}'.format(ini_file))
+        print(webquiz_templates.missing_webquiz_ini.format(ini_file))
         sys.exit(1)
 
 # ---------------------------------------------------------------------------------------
@@ -71,7 +71,8 @@
         # pst2pdf converts pspicture environments to svg images and makes a
         # new latex file quiz_file+'-pdf' that includes these
         cmd = 'pst2pdf --svg --imgdir={q_file} {q_file}.tex'.format(q_file=quiz_file)
-        options.run(cmd)
+        # pst2pdf is missing a #!-header so we need shell=True
+        options.run(cmd, shell=True)
     except OSError as err:
         if err.errno == errno.ENOENT:
             webquiz_util.webquiz_error(options.debugging, 'pst2pdf not found. You need to install pst2pdf to use the pst2pdf option', err)
@@ -226,12 +227,16 @@
 
         # define user and system rc file and load the ones that exist
 
-        self.system_rcfile = os.path.join(webquiz_util.kpsewhich('-var TEXMFLOCAL'),
-                                           'tex',
-                                           'latex',
-                                           'webquiz',
-                                           'webquizrc'
-        )
+        TEXMFLOCAL=''
+        try:
+            TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFLOCAL')
+        except subprocess.CalledProcessError:
+            pass
+
+        if TEXMFLOCAL == '':
+            TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
+
+        self.system_rcfile = os.path.join(TEXMFLOCAL, 'tex', 'latex', 'webquiz', 'webquizrc')
         self.read_webquizrc(self.system_rcfile)
 
         # the user rc file defaults to:
@@ -378,9 +383,8 @@
         Print the non-default settings for webquiz from the webquizrc
         '''
         if not hasattr(self, 'rcfile'):
-            print(
-                'Please initialise WebQuiz using the command: webquiz --initialise\n'
-            )
+            print(webquiz_templates.initialise_settings)
+            sys.exit(1)
 
         if setting not in ['all', 'verbose', 'help']:
             setting = setting.replace('-', '_')
@@ -440,7 +444,7 @@
             default_root = '/Library/WebServer/Documents/WebQuiz'
             platform = 'Mac OSX'
         elif sys.platform.startswith('win'):
-            default_root = ' c:\inetpub\wwwroot\WebQuiz'
+            default_root = 'c:\inetpub\wwwroot\WebQuiz'
             platform = 'Windows'
         else:
             default_root = '/var/www/html/WebQuiz'
@@ -496,7 +500,7 @@
                     # if texdoc failed then try using TEXMFMAIN
                     if webquiz_doc=='':
                         try:
-                            webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var TEXMFMAIN'), 'doc','latex', 'webquiz')
+                            webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var-value TEXMFMAIN'), 'doc','latex', 'webquiz')
                         except subprocess.CalledProcessError:
                             pass
 
@@ -648,7 +652,7 @@
         Undocumented feature - useful for debugging initialisation routine
         '''
         webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..'))
-        texmf = webquiz_util.kpsewhich('-var TEXMFMAIN')
+        texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
         for (src, target) in [('scripts', 'scripts'),
                          ('latex', 'tex/latex'),
                          ('doc', 'doc/latex')]:
@@ -665,8 +669,17 @@
         try:
 
             # add a link to webquiz.py
-            texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-            os.symlink(os.path.join(texmf,'scripts','webquiz','webquiz.py'), os.path.join(texbin, 'webquiz'))
+            texbin = os.path.dirname(shutil.which('pdflatex'))
+            if sys.platform.startswith('win'):
+                shutil.copyfile(
+                    os.path.join(texmf,'scripts','webquiz','webquiz.bat'), 
+                    os.path.join(texbin, 'webquiz.bat')
+                )
+            else:
+                os.symlink(
+                    os.path.join(texmf,'scripts','webquiz','webquiz.py'), 
+                    os.path.join(texbin, 'webquiz')
+                )
             subprocess.call('mktexlsr', shell=True)
 
         except (FileExistsError,FileNotFoundError):
@@ -677,8 +690,7 @@
             sys.exit(1)
 
         except subprocess.CalledProcessError as err:
-            print('There was a problem running mktexlsr')
-            sys.exit(1)
+            self.webquiz_error('There was a problem running mktexlsr', err)
 
     def tex_uninstall(self):
         r'''
@@ -692,7 +704,7 @@
         Undocumented feature - useful for debugging initialisation routine
         '''
         webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..'))
-        texmf = webquiz_util.kpsewhich('-var TEXMFMAIN')
+        texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
         for target in ['scripts', 'tex/latex', 'doc/latex']:
             try:
                 shutil.rmtree(os.path.join(texmf, target, 'webquiz'))
@@ -706,8 +718,11 @@
 
         try:
             # remove link from texbin to webquiz.py
-            texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-            os.remove(os.path.join(texbin, 'webquiz'))
+            texbin = os.path.dirname(shutil.which('pdflatex'))
+            if sys.platform.startswith('win'):
+                os.remove(os.path.join(texbin, 'webquiz.bat'))
+            else:
+                os.remove(os.path.join(texbin, 'webquiz'))
 
         except (FileExistsError,FileNotFoundError):
             pass
@@ -729,12 +744,16 @@
             sys.exit(1)
 
         # remove link to webquiz.py
-        texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-        webquiz = os.path.join(texbin,'webquiz')
+        texbin = os.path.dirname(shutil.which('pdflatex'))
         try:
-            target = os.readlink(webquiz)
-            if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'):
+            if sys.platform.startswith('win'):
+                webquiz = os.path.join(texbin, 'webquiz.bat')
                 os.remove(webquiz)
+            else:
+                webquiz = os.path.join(texbin,'webquiz')
+                target = os.readlink(webquiz)
+                if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'):
+                    os.remove(webquiz)
 
         except (FileExistsError,FileNotFoundError):
             pass
@@ -852,6 +871,7 @@
         settings_parser.add_argument(
             '-i',
             '--initialise',
+            '--initialize',
             action='store_true',
             default=False,
             help='Install web components of webquiz')
@@ -1001,13 +1021,13 @@
         #       - we need to use shell=True because otherwise pst2pdf gives an error
         # options.talk() is a shorthand for letting the user know what is happening
         if options.quiet == 0:
-            options.run = lambda cmd: subprocess.call(cmd, shell=True)
+            options.run = webquiz_util.run
             options.talk = lambda msg: print(msg)
         elif options.quiet == 1:
-            options.run  = lambda cmd: subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'))
+            options.run  = webquiz_util.quiet_run
             options.talk = lambda msg: print(msg)
         else:
-            options.run  = lambda cmd: subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'))
+            options.run  = webquiz_util.silent_run
             options.talk = lambda msg: None
 
         # run through the list of quizzes and make them
@@ -1014,21 +1034,31 @@
         for quiz_file in options.quiz_file:
             if len(options.quiz_file) > 1 and options.quiet < 3:
                 print('Making web page for {}'.format(quiz_file))
+
+            quiz_name, ext = os.path.splitext(quiz_file)  # extract filename and extension
             # quiz_file is assumed to be a tex file if no extension is given
-            if not '.' in quiz_file:
-                quiz_file += '.tex'
+            if ext=='':
+                ext = '.tex'
+                quiz_file += ext
+ 
+            # windows likes adding a prefix of '.\\'to filename and this causes havoc with latex
+            if os.path.dirname(quiz_file)=='.':
+                quiz_file = os.path.basename(quiz_file)
 
+            if ext not in ['.tex', '.xml']:
+                    webquiz_util.webquiz_error(True, 'unrecognised file extension {}'.format(ext))
+
             if not os.path.isfile(quiz_file):
-                print('WebQuiz error: cannot read file {}'.format(quiz_file))
+                webquiz_util.webquiz+error(True, 'WebQuiz error: cannot read file {}'.format(quiz_file))
 
-            else:
+            # the quiz name and the quiz_file will be different if pst2pdf is used
+            quiz_name = quiz_file
+            if options.quiet < 2:
+                print('WebQuiz generating web page for {}'.format(quiz_file))
 
-                # the quiz name and the quiz_file will be if pst2pdf is used
-                quiz_name = quiz_file
-                if options.quiet < 2:
-                    print('WebQuiz generating web page for {}'.format(quiz_file))
-
-                # If the pst2podf option is used then we need to preprocess
+            options.pst2pdf = False
+            if ext==".tex":
+                # If the pst2pdf option is used then we need to preprocess
                 # the latex file BEFORE passing it to MakeWebQuiz. Set
                 # options.pst2pdf = True if pst2pdf is given as an option to
                 # the webquiz documentclass
@@ -1035,7 +1065,6 @@
                 with codecs.open(quiz_file, 'r', encoding='utf8') as q_file:
                     doc = q_file.read()
 
-                options.pst2pdf = False
                 try:
                     brac = doc.index(r'\documentclass[') + 15  # start of class options
                     if 'pst2pdf' in [
@@ -1049,46 +1078,46 @@
                 except ValueError:
                     pass
 
-                # the file exists and is readable so make the quiz
-                webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata)
+            # the file exists and is readable so make the quiz
+            webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata)
 
-                quiz_name = quiz_name[:quiz_name.index('.')]  # remove the extension
+            quiz_name, ext = os.path.splitext(quiz_name)  # extract filename and extension
 
-                # move the css file into the directory for the quiz
-                css_file = os.path.join(quiz_name, quiz_name + '.css')
-                if os.path.isfile(quiz_name + '.css'):
-                    if os.path.isfile(css_file):
-                        os.remove(css_file)
-                    shutil.move(quiz_name + '.css', css_file)
+            # move the css file into the directory for the quiz
+            css_file = os.path.join(quiz_name, quiz_name + '.css')
+            if os.path.isfile(quiz_name + '.css'):
+                if os.path.isfile(css_file):
+                    os.remove(css_file)
+                shutil.move(quiz_name + '.css', css_file)
 
-                # now clean up unless debugging
-                if not options.debugging:
-                    for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log',
-                        'ps', 'pdf', 'tmp', 'xml', 'xref'
+            # now clean up unless debugging
+            if not options.debugging:
+                for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log',
+                    'ps', 'pdf', 'tmp', 'xml', 'xref'
+                ]:
+                    if os.path.isfile(quiz_name + '.' + ext):
+                        os.remove(quiz_name + '.' + ext)
+
+                # files created when using pst2pdf
+                if options.pst2pdf:
+                    for file in glob.glob(quiz_name + '-pdf.*'):
+                        os.remove(file)
+                    for file in glob.glob(quiz_name + '-pdf-fixed.*'):
+                        os.remove(file)
+                    for extention in ['.preamble', '.plog', '-tmp.tex',
+                            '-pst.tex', '-fig.tex'
                     ]:
-                        if os.path.isfile(quiz_name + '.' + ext):
-                            os.remove(quiz_name + '.' + ext)
+                        if os.path.isfile(quiz_name + extention):
+                            os.remove(quiz_name + extention)
+                    if os.path.isdir(os.path.join(quiz_name, quiz_name)):
+                        shutil.rmtree(os.path.join(quiz_name, quiz_name))
 
-                    # files created when using pst2pdf
-                    if options.pst2pdf:
-                        for file in glob.glob(quiz_name + '-pdf.*'):
-                            os.remove(file)
-                        for file in glob.glob(quiz_name + '-pdf-fixed.*'):
-                            os.remove(file)
-                        for extention in ['.preamble', '.plog', '-tmp.tex',
-                                '-pst.tex', '-fig.tex'
-                        ]:
-                            if os.path.isfile(quiz_name + extention):
-                                os.remove(quiz_name + extention)
-                        if os.path.isdir(os.path.join(quiz_name, quiz_name)):
-                            shutil.rmtree(os.path.join(quiz_name, quiz_name))
-
-        if settings.initialise_warning != '':
+        if settings.initialise_warning != '' and not settings.have_initialised:
             print(webquiz_templates.text_initialise_warning)
 
     except Exception as err:
 
-        # there is a small chance that there is an error before we the
+        # there is a small chance that there is an error before the
         # settings.debugging flag has been set
         webquiz_util.webquiz_error(settings.debugging if 'settings' in globals() else True,
             'unknown problem.\n\nIf you think this is a bug please report it by creating an issue at\n    {}\n'

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/README.rst
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/README.rst	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/README.rst	2019-04-01 21:07:31 UTC (rev 50694)
@@ -44,7 +44,8 @@
   -x, --xelatex         Use xelatex to compile the quiz
   -r RCFILE, --rcfile RCFILE
                         Specify location of the webquiz rc-file
-  -i, --initialise      Install web components of webquiz
+  -i, --initialise, --initialize
+                        Install web components of webquiz
   -e, --edit-settings   Edit default settings for webquiz
   --settings <SETTINGS>
                         List default settings for webquiz
@@ -61,40 +62,33 @@
 
 Please see the manual for more details about initialising and using WebQuiz_.
 
-Installation from ctan
-----------------------
-If you are installing WebQuiz using the zip file from ctan, as opposed to
-installing the package from TeX distribution like TeXLive, then the following
-steps are recommended:
+Installation from the ctan zipfile
+----------------------------------
+On both unix-like systems (including macosx), and windows systems (using
+either TeXLive or MiKTeX), you can install WebQuiz by downloading the
+WebQuiz zip file from:
 
-- Create a symbolic link, or equivalent, to the main WebQuiz executable, which
-  is the file webquiz.py in the scripts directory
-- Copy the latex directory to somewhere in TeX search path, or set your
-  TEXINPUTS environment variable appropriately, and then run `mktexlsr` or
-  equivalent so that LaTeX and WebQuiz can find these files.
-- Ideally the doc subdirectory should be copied into the doc/layetx subdirecory
-  of the main TeX distribution.
+    http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip
 
-If you are using a unix system, or macosx, there is an (undocumented)
-command-line option `--tex-install` that installs the three different
-components of WebQuiz_ into the standard locations in the TeXLive
-tree:
+To install the package, unzip this file and change directory to the
+webquiz/scripts subdirectory run:
 
-- $TEXMFMAIN/tex/latex/webquiz  all LaTeX files
-- $TEXMFMAIN/scripts/webquiz    the python programs
-- $TEXMFMAIN/doc/latex/webquiz  the documentation and web components
-- A symbolic link is made from the TeX bin directory to the main
-  WebQuiz executable $TEXMFMAIN/scripts/webquiz/webquiz.py
+> webquiz --tex-install
 
-To install these files in TEXMFMAIN you will almost certainly need
-adminsistrator or root privledges, so on a unix-like system you will
-need to use:
+(or webquiz.bat --text-install on windows). This commands unpacks the webquiz
+files into their standard locations in the TeX install tree to it should be
+run from an administrators account, or using sudo on a unix-like system.
+Roughly what this command does is the following:
 
-> sudo webquiz/scripts/webquiz --tex-install
+- It creates a symbolic link, or equivalent, to the main WebQuiz executable,
+  which is the file webquiz.py in the scripts directory
+- Copies the latex directory to somewhere in the TeX search path and then
+  runs `mktexlsr` so that LaTeX and WebQuiz can find these files.
+- Copies the python code into the TeX scripts subdirectory
+- Copies the WebQuiz doc subdirectory into the TeX doc/latex subdirectory.
 
-In principle, this command may also work on a windows computer,
-provided that the command `kpsewhich` is available, but this is
-untested.
+If you are using MiKTeX you may need to open the MiKTeX console, go to
+the Tasks menu and then rebuild the TeX filename database.
 
 Once the files above are in place initialise WebQuiz by following the
 installation instructions above.
@@ -135,7 +129,12 @@
 
 Authors
 -------
-The LaTeX component of WebQuiz_ was written by Andrew Mathas and the python, css and javascript code was written by Andrew Mathas (and Don Taylor), based on an initial protype of Don Taylor's from 2001. Since 2004 the program has been maintained and developed by Andrew Mathas. Although the program has changed substantially since 2004 Don's idea of using TeX 4ht, and some of his code, is still very much in use.
+The LaTeX component of WebQuiz_ was written by Andrew Mathas and the python,
+css and javascript code was written by Andrew Mathas (and Don Taylor), based on
+an initial protype of Don Taylor's from 2001. Since 2004 the program has been
+maintained and developed by Andrew Mathas. Although the program has changed
+substantially since 2004 Don's idea of using TeX4ht_, and some of his code, is
+still very much in use.
 
 Copyright (C) 2004-2019
 

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/README-examples
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/examples/README-examples	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/examples/README-examples	2019-04-01 21:07:31 UTC (rev 50694)
@@ -1,2 +1,2 @@
-The tex and png files in this directory are used to build the WebQuiz manual.
-Each tex file can be compiled using (pdf)latex and webquiz.
+The TeX and png files in this directory are used to generate images in the
+WebQuiz manual. Each TeX file can be compiled using (pdf)latex and webquiz.

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-complex.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-integer.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-lowercase.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-number.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-star.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/answer-string.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/breadcrumbs.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/choice-multiple.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/choice-single.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/ctanLion.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/discussion-Qref.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/discussion-ref.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/discussion.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/display-as-image.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/french.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/index-cz.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/index-en.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/montypython.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/nounits.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/onepage.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/pst2pdf.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/pstricks-ex.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/quiz-page.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/quiz-page.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/examples/quiz-page.tex	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/examples/quiz-page.tex	2019-04-01 21:07:31 UTC (rev 50694)
@@ -1,6 +1,5 @@
 \documentclass[]{webquiz}
-\usepackage[MATH1001]{sms-uos}
-\BreadCrumbs{department | unitcode | quizindex | title}
+\BreadCrumbs{quizindex | title}
 \DeclareMathOperator{\cis}{cis}
 \newcommand{\R}{\mathbb R}
 \newcommand{\C}{\mathbb C}

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/quizindex-dropdown.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/random.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/simple-html.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/simple-pdf.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-blue.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-darkblue.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-darkred.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-default.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-earthy.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-fresh.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-light.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-lively.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-muted.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-sleek.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-spring.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/theme-vibrant.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/examples/tikz-ex.png
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz-online-manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.languages
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.languages	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.languages	2019-04-01 21:07:31 UTC (rev 50694)
@@ -1,3 +1,3 @@
 % List of languages currently supported by WebQuiz
-% Generated using 'makedoc --languages' on 2019-03-10
+% Generated using 'makedoc --languages' on 2019-04-01
 \newcommand\WebQuizLanguages{Czech, English, French, German, Greek, Italian, Japanese, Mandarin, Russian, Spanish,, Swedish}

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.settings
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.settings	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.settings	2019-04-01 21:07:31 UTC (rev 50694)
@@ -1,6 +1,6 @@
----------------------------------------------------------
-WebQuiz rc-file: /Users/andrew/.dotfiles/config/webquizrc
----------------------------------------------------------
+---------------------------------------------------------------------------
+WebQuiz rc-file: /usr/local/texlive/texmf-local/tex/latex/webquiz/webquizrc
+---------------------------------------------------------------------------
 breadcrumbs       = 
 department        = 
 department-url    = /
@@ -12,10 +12,10 @@
 one-page          = false
 random-order      = false
 theme             = default
-version           = 5.1
-webquiz-url       = /~andrew/Webby
-webquiz-www       = /Users/andrew/Sites/Webby
+version           = 5.2
+webquiz-url       = /WebQuiz
+webquiz-www       = /Library/WebServer/Documents/WebQuiz
 make4ht           = 
 mathjax           = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js
 webquiz-layout    = webquiz_layout
----------------------------------------------------------
+---------------------------------------------------------------------------

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.tex	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.tex	2019-04-01 21:07:31 UTC (rev 50694)
@@ -85,16 +85,16 @@
 \renewcommand*\contentsname{\relax}
 
 % hyperref links to ctan
-\newcommand\TeXLive{\ctan[/]{\TeX Live}\xspace}
+\newcommand\TeXLive{\href{https://www.tug.org/texlive/}{\TeX Live}\xspace}
 \newcommand\Ctan{\ctan[]{ctan}\xspace}
 \newcommand\ddash{\texttt{\textemdash\textemdash}}
 \NewDocumentCommand\webquizrc{s}{\index{webquizrc}%
 \BashCode|webquizrc| file\IfBooleanF{#1}{ (\autoref{SS:rcfile})}\xspace%
 }
-
+\newcommand\MiKTeX{\href{https://miktex.org/}{MiK\TeX}\xspace}
 \NewDocumentCommand\OnlineManual{s}{%
   \href{http://www.maths.usyd.edu.au/u/mathas/WebQuiz/webquiz-online-manual.html}{Online manual}%
-  \IfBooleanF{#1}{ (\hyperref[S:online]{Appendix B})}\xspace%
+  \IfBooleanF{#1}{ (\hyperref[S:online]{Appendix~B})}\xspace%
 }
 
 \indexprologue{%
@@ -423,7 +423,7 @@
      are due to
         Thomas Cailleteau
         Michael Palmer and
-        Hendrik Suess,
+        Hendrik Suess
      for helpful feedback on the package.
 
    \section{The \WebQuiz document class --- \hologo{LaTeX}{} commands}
@@ -1548,7 +1548,7 @@
 
   In order to work \WebQuiz needs the following programs to be
   installed on your system:
-  \begin{itemize}
+  \begin{itemize}[nosep]
      \item An up-to-date \LaTeX{} distribution, such as that provided
      by \TeXLive. In particular, you need to have \TeXfht{} and
      \ctan{make4ht} installed.
@@ -1569,6 +1569,39 @@
       will need to install the web components of \WebQuiz.
   \end{itemize}
 
+  \subsection{Installing
+  \WebQuiz}\label{SS:Install}\index{install}\index{miktex at Mik\TeX}\index{texlive@\TeXLive}
+  \WebQuiz will be included as a package in \TeXLive 2019 and, once a
+  packaging issue is sorted out, it will be included in \MiKTeX. If
+  \WebQuiz is available as a package from either of these distributions
+  then it can be installed in the usual way.
+
+  Alternatively, it is possible to download the
+  \href{http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip}{WebQuiz zipfile} from \Ctan.
+  To install \WebQuiz from the zipfile you should:
+  \begin{enumerate}[nosep]
+    \item Download the
+          \href{http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip}{WebQuiz zipfile} from \Ctan.
+    \item Unzip the file
+    \item Change directory of the \BashCode|webquiz/scripts| subdirectory from the zipfile
+    \item From an administrators account, or using \BashCode|sudo| on a
+    unix-like system, run he command:
+    \begin{bashcode}
+      > webquiz --tex-install
+    \end{bashcode}
+    On windows, use:
+    \begin{bashcode}
+      > webquiz.bat --tex-install
+    \end{bashcode}
+  \end{enumerate}
+  This will install the different components of \WebQuiz to their
+  ``standard'' locations in he \TeX\ search tree.  If you are using
+  \MiKTeX you may need to open the \MiKTeX console, go to the Tasks menu
+  and then rebuild the TeX filename database.
+
+  Once the \WebQuiz package is installed you should initialise thew
+  package, following the steps given in \autoref{SS:Initialise}.
+
   \subsection{Initialising \WebQuiz}\label{SS:Initialise}
   \CrossIndex{command-line option}{initialise}
   \index{initialisation}
@@ -1681,7 +1714,7 @@
   \href{https://en.wikipedia.org/wiki/Scalable_Vector_Graphics}{Scalable
   Vector Graphics} (SVG). This is done using his is done
   using \ctan{dvisvgm}. At first sight this is OK because \ctan{dvisvgm} is
-  included in \TeXLive and Mik\TeX, however, \ctan{dvisvgm} uses
+  included in \TeXLive and \MiKTeX, however, \ctan{dvisvgm} uses
   \Ghostscript and this needs to be correctly configured and, as
   outlined in \href{http://dvisvgm.bplaced.net/FAQ}{FAQ}, \ctan{dvisvgm}
   needs to know where to find the \Ghostscript libraries. For example,
@@ -1901,8 +1934,8 @@
         exit (currently \webquiz{version})
 
         \item[\ddash tex-install] Use this command-line option if
-        are are installing the \LaTeX{} components of
-        \WebQuiz from the \Ctan zip-file. It will install the different
+        you are installing the \LaTeX{} components of
+        \WebQuiz from the \Ctan zip-filei (see \autoref{SS:Install}). It will install the different
         \LaTeX{} components of \WebQuiz into \BashCode|TEXMFMAIN|. If
         you installed \WebQuiz as part of a \TeX{} distribution, such as
         \TeXLive, then you do not need to use this option.

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.themes
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.themes	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.themes	2019-04-01 21:07:31 UTC (rev 50694)
@@ -1,2 +1,2 @@
-% List of themes supported by WebQuiz -- generated 2019-03-10
+% List of themes supported by WebQuiz -- generated 2019-04-01
 \newcommand\WebQuizThemes{blue, darkblue, darkred, default, earthy, fresh, light, lively, muted, sleek, spring,, vibrant}

Modified: trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.usage
===================================================================
--- trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.usage	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/latex/webquiz/webquiz.usage	2019-04-01 21:07:31 UTC (rev 50694)
@@ -17,7 +17,8 @@
   -x, --xelatex         Use xelatex to compile the quiz
   -r RCFILE, --rcfile RCFILE
                         Specify location of the webquiz rc-file
-  -i, --initialise      Install web components of webquiz
+  -i, --initialise, --initialize
+                        Install web components of webquiz
   -e, --edit-settings   Edit default settings for webquiz
   --settings [SETTINGS]
                         List default settings for webquiz

Modified: trunk/Master/texmf-dist/doc/man/man1/webquiz.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/webquiz.1	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/doc/man/man1/webquiz.1	2019-04-01 21:07:31 UTC (rev 50694)
@@ -95,7 +95,7 @@
 .BI \-r \ RCFILE\fP,\fB \ \-\-rcfile \ RCFILE
 Specify location of the webquiz rc\-file
 .TP
-.B \-i\fP,\fB  \-\-initialise
+.B \-i\fP,\fB  \-\-initialise\fP,\fB  \-\-initialize
 Install web components of webquiz
 .TP
 .B \-e\fP,\fB  \-\-edit\-settings
@@ -116,50 +116,42 @@
 If you want to install the web components of \fI\%WebQuiz\fP into a system directory then you need to run this command from an administrators account, so using \fIsudo\fP on a unix\-like system. For more details about the installation and configuration of \fI\%WebQuiz\fP please see Section 3.2 of the \fI\%WebQuiz\fP manual.
 .sp
 Please see the manual for more details about initialising and using \fI\%WebQuiz\fP\&.
-.SH INSTALLATION FROM CTAN
+.SH INSTALLATION FROM THE CTAN ZIPFILE
 .sp
-If you are installing WebQuiz using the zip file from ctan, as opposed to
-installing the package from TeX distribution like TeXLive, then the following
-steps are recommended:
+On both unix\-like systems (including macosx), and windows systems (using
+either TeXLive or MiKTeX), you can install WebQuiz by downloading the
+WebQuiz zip file from:
 .INDENT 0.0
-.IP \(bu 2
-Create a symbolic link, or equivalent, to the main WebQuiz executable, which
-is the file webquiz.py in the scripts directory
-.IP \(bu 2
-Copy the latex directory to somewhere in TeX search path, or set your
-TEXINPUTS environment variable appropriately, and then run \fImktexlsr\fP or
-equivalent so that LaTeX and WebQuiz can find these files.
-.IP \(bu 2
-Ideally the doc subdirectory should be copied into the doc/layetx subdirecory
-of the main TeX distribution.
+.INDENT 3.5
+\fI\%http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip\fP
 .UNINDENT
+.UNINDENT
 .sp
-If you are using a unix system, or macosx, there is an (undocumented)
-command\-line option \fI\-\-tex\-install\fP that installs the three different
-components of \fI\%WebQuiz\fP into the standard locations in the TeXLive
-tree:
+To install the package, unzip this file and change directory to the
+webquiz/scripts subdirectory run:
+.sp
+> webquiz \-\-tex\-install
+.sp
+(or webquiz.bat \-\-text\-install on windows). This commands unpacks the webquiz
+files into their standard locations in the TeX install tree to it should be
+run from an administrators account, or using sudo on a unix\-like system.
+Roughly what this command does is the following:
 .INDENT 0.0
 .IP \(bu 2
-$TEXMFMAIN/tex/latex/webquiz  all LaTeX files
+It creates a symbolic link, or equivalent, to the main WebQuiz executable,
+which is the file webquiz.py in the scripts directory
 .IP \(bu 2
-$TEXMFMAIN/scripts/webquiz    the python programs
+Copies the latex directory to somewhere in the TeX search path and then
+runs \fImktexlsr\fP so that LaTeX and WebQuiz can find these files.
 .IP \(bu 2
-$TEXMFMAIN/doc/latex/webquiz  the documentation and web components
+Copies the python code into the TeX scripts subdirectory
 .IP \(bu 2
-A symbolic link is made from the TeX bin directory to the main
-WebQuiz executable $TEXMFMAIN/scripts/webquiz/webquiz.py
+Copies the WebQuiz doc subdirectory into the TeX doc/latex subdirectory.
 .UNINDENT
 .sp
-To install these files in TEXMFMAIN you will almost certainly need
-adminsistrator or root privledges, so on a unix\-like system you will
-need to use:
+If you are using MiKTeX you may need to open the MiKTeX console, go to
+the Tasks menu and then rebuild the TeX filename database.
 .sp
-> sudo webquiz/scripts/webquiz \-\-tex\-install
-.sp
-In principle, this command may also work on a windows computer,
-provided that the command \fIkpsewhich\fP is available, but this is
-untested.
-.sp
 Once the files above are in place initialise WebQuiz by following the
 installation instructions above.
 .sp
@@ -198,7 +190,12 @@
 .UNINDENT
 .SH AUTHORS
 .sp
-The LaTeX component of \fI\%WebQuiz\fP was written by Andrew Mathas and the python, css and javascript code was written by Andrew Mathas (and Don Taylor), based on an initial protype of Don Taylor\(aqs from 2001. Since 2004 the program has been maintained and developed by Andrew Mathas. Although the program has changed substantially since 2004 Don\(aqs idea of using TeX 4ht, and some of his code, is still very much in use.
+The LaTeX component of \fI\%WebQuiz\fP was written by Andrew Mathas and the python,
+css and javascript code was written by Andrew Mathas (and Don Taylor), based on
+an initial protype of Don Taylor\(aqs from 2001. Since 2004 the program has been
+maintained and developed by Andrew Mathas. Although the program has changed
+substantially since 2004 Don\(aqs idea of using \fI\%TeX4ht\fP, and some of his code, is
+still very much in use.
 .sp
 Copyright (C) 2004\-2019
 .SH LICENSE

Modified: trunk/Master/texmf-dist/doc/man/man1/webquiz.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/webquiz/CHANGES.rst
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/CHANGES.rst	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/CHANGES.rst	2019-04-01 21:07:31 UTC (rev 50694)
@@ -2,6 +2,10 @@
 WebQuiz Changes
 ===============
 
+Version 5.2:
+------------
+    - compatibility with both MikTeX and TeXLive under windows
+
 Version 5.1:
 ------------
     - code reorganised n zip file for TeXLive inclusion

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz	2019-04-01 21:07:31 UTC (rev 50694)
@@ -42,7 +42,7 @@
     try:
         metadata = webquiz_util.MetaData(ini_file, debugging=False)
     except (FileNotFoundError, subprocess.CalledProcessError):
-        print('webquiz installation error: unable to find webquiz.ini -> {}'.format(ini_file))
+        print(webquiz_templates.missing_webquiz_ini.format(ini_file))
         sys.exit(1)
 
 # ---------------------------------------------------------------------------------------
@@ -71,7 +71,8 @@
         # pst2pdf converts pspicture environments to svg images and makes a
         # new latex file quiz_file+'-pdf' that includes these
         cmd = 'pst2pdf --svg --imgdir={q_file} {q_file}.tex'.format(q_file=quiz_file)
-        options.run(cmd)
+        # pst2pdf is missing a #!-header so we need shell=True
+        options.run(cmd, shell=True)
     except OSError as err:
         if err.errno == errno.ENOENT:
             webquiz_util.webquiz_error(options.debugging, 'pst2pdf not found. You need to install pst2pdf to use the pst2pdf option', err)
@@ -226,12 +227,16 @@
 
         # define user and system rc file and load the ones that exist
 
-        self.system_rcfile = os.path.join(webquiz_util.kpsewhich('-var TEXMFLOCAL'),
-                                           'tex',
-                                           'latex',
-                                           'webquiz',
-                                           'webquizrc'
-        )
+        TEXMFLOCAL=''
+        try:
+            TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFLOCAL')
+        except subprocess.CalledProcessError:
+            pass
+
+        if TEXMFLOCAL == '':
+            TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
+
+        self.system_rcfile = os.path.join(TEXMFLOCAL, 'tex', 'latex', 'webquiz', 'webquizrc')
         self.read_webquizrc(self.system_rcfile)
 
         # the user rc file defaults to:
@@ -378,9 +383,8 @@
         Print the non-default settings for webquiz from the webquizrc
         '''
         if not hasattr(self, 'rcfile'):
-            print(
-                'Please initialise WebQuiz using the command: webquiz --initialise\n'
-            )
+            print(webquiz_templates.initialise_settings)
+            sys.exit(1)
 
         if setting not in ['all', 'verbose', 'help']:
             setting = setting.replace('-', '_')
@@ -440,7 +444,7 @@
             default_root = '/Library/WebServer/Documents/WebQuiz'
             platform = 'Mac OSX'
         elif sys.platform.startswith('win'):
-            default_root = ' c:\inetpub\wwwroot\WebQuiz'
+            default_root = 'c:\inetpub\wwwroot\WebQuiz'
             platform = 'Windows'
         else:
             default_root = '/var/www/html/WebQuiz'
@@ -496,7 +500,7 @@
                     # if texdoc failed then try using TEXMFMAIN
                     if webquiz_doc=='':
                         try:
-                            webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var TEXMFMAIN'), 'doc','latex', 'webquiz')
+                            webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var-value TEXMFMAIN'), 'doc','latex', 'webquiz')
                         except subprocess.CalledProcessError:
                             pass
 
@@ -648,7 +652,7 @@
         Undocumented feature - useful for debugging initialisation routine
         '''
         webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..'))
-        texmf = webquiz_util.kpsewhich('-var TEXMFMAIN')
+        texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
         for (src, target) in [('scripts', 'scripts'),
                          ('latex', 'tex/latex'),
                          ('doc', 'doc/latex')]:
@@ -665,8 +669,17 @@
         try:
 
             # add a link to webquiz.py
-            texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-            os.symlink(os.path.join(texmf,'scripts','webquiz','webquiz.py'), os.path.join(texbin, 'webquiz'))
+            texbin = os.path.dirname(shutil.which('pdflatex'))
+            if sys.platform.startswith('win'):
+                shutil.copyfile(
+                    os.path.join(texmf,'scripts','webquiz','webquiz.bat'), 
+                    os.path.join(texbin, 'webquiz.bat')
+                )
+            else:
+                os.symlink(
+                    os.path.join(texmf,'scripts','webquiz','webquiz.py'), 
+                    os.path.join(texbin, 'webquiz')
+                )
             subprocess.call('mktexlsr', shell=True)
 
         except (FileExistsError,FileNotFoundError):
@@ -677,8 +690,7 @@
             sys.exit(1)
 
         except subprocess.CalledProcessError as err:
-            print('There was a problem running mktexlsr')
-            sys.exit(1)
+            self.webquiz_error('There was a problem running mktexlsr', err)
 
     def tex_uninstall(self):
         r'''
@@ -692,7 +704,7 @@
         Undocumented feature - useful for debugging initialisation routine
         '''
         webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..'))
-        texmf = webquiz_util.kpsewhich('-var TEXMFMAIN')
+        texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
         for target in ['scripts', 'tex/latex', 'doc/latex']:
             try:
                 shutil.rmtree(os.path.join(texmf, target, 'webquiz'))
@@ -706,8 +718,11 @@
 
         try:
             # remove link from texbin to webquiz.py
-            texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-            os.remove(os.path.join(texbin, 'webquiz'))
+            texbin = os.path.dirname(shutil.which('pdflatex'))
+            if sys.platform.startswith('win'):
+                os.remove(os.path.join(texbin, 'webquiz.bat'))
+            else:
+                os.remove(os.path.join(texbin, 'webquiz'))
 
         except (FileExistsError,FileNotFoundError):
             pass
@@ -729,12 +744,16 @@
             sys.exit(1)
 
         # remove link to webquiz.py
-        texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-        webquiz = os.path.join(texbin,'webquiz')
+        texbin = os.path.dirname(shutil.which('pdflatex'))
         try:
-            target = os.readlink(webquiz)
-            if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'):
+            if sys.platform.startswith('win'):
+                webquiz = os.path.join(texbin, 'webquiz.bat')
                 os.remove(webquiz)
+            else:
+                webquiz = os.path.join(texbin,'webquiz')
+                target = os.readlink(webquiz)
+                if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'):
+                    os.remove(webquiz)
 
         except (FileExistsError,FileNotFoundError):
             pass
@@ -852,6 +871,7 @@
         settings_parser.add_argument(
             '-i',
             '--initialise',
+            '--initialize',
             action='store_true',
             default=False,
             help='Install web components of webquiz')
@@ -1001,13 +1021,13 @@
         #       - we need to use shell=True because otherwise pst2pdf gives an error
         # options.talk() is a shorthand for letting the user know what is happening
         if options.quiet == 0:
-            options.run = lambda cmd: subprocess.call(cmd, shell=True)
+            options.run = webquiz_util.run
             options.talk = lambda msg: print(msg)
         elif options.quiet == 1:
-            options.run  = lambda cmd: subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'))
+            options.run  = webquiz_util.quiet_run
             options.talk = lambda msg: print(msg)
         else:
-            options.run  = lambda cmd: subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'))
+            options.run  = webquiz_util.silent_run
             options.talk = lambda msg: None
 
         # run through the list of quizzes and make them
@@ -1014,21 +1034,31 @@
         for quiz_file in options.quiz_file:
             if len(options.quiz_file) > 1 and options.quiet < 3:
                 print('Making web page for {}'.format(quiz_file))
+
+            quiz_name, ext = os.path.splitext(quiz_file)  # extract filename and extension
             # quiz_file is assumed to be a tex file if no extension is given
-            if not '.' in quiz_file:
-                quiz_file += '.tex'
+            if ext=='':
+                ext = '.tex'
+                quiz_file += ext
+ 
+            # windows likes adding a prefix of '.\\'to filename and this causes havoc with latex
+            if os.path.dirname(quiz_file)=='.':
+                quiz_file = os.path.basename(quiz_file)
 
+            if ext not in ['.tex', '.xml']:
+                    webquiz_util.webquiz_error(True, 'unrecognised file extension {}'.format(ext))
+
             if not os.path.isfile(quiz_file):
-                print('WebQuiz error: cannot read file {}'.format(quiz_file))
+                webquiz_util.webquiz+error(True, 'WebQuiz error: cannot read file {}'.format(quiz_file))
 
-            else:
+            # the quiz name and the quiz_file will be different if pst2pdf is used
+            quiz_name = quiz_file
+            if options.quiet < 2:
+                print('WebQuiz generating web page for {}'.format(quiz_file))
 
-                # the quiz name and the quiz_file will be if pst2pdf is used
-                quiz_name = quiz_file
-                if options.quiet < 2:
-                    print('WebQuiz generating web page for {}'.format(quiz_file))
-
-                # If the pst2podf option is used then we need to preprocess
+            options.pst2pdf = False
+            if ext==".tex":
+                # If the pst2pdf option is used then we need to preprocess
                 # the latex file BEFORE passing it to MakeWebQuiz. Set
                 # options.pst2pdf = True if pst2pdf is given as an option to
                 # the webquiz documentclass
@@ -1035,7 +1065,6 @@
                 with codecs.open(quiz_file, 'r', encoding='utf8') as q_file:
                     doc = q_file.read()
 
-                options.pst2pdf = False
                 try:
                     brac = doc.index(r'\documentclass[') + 15  # start of class options
                     if 'pst2pdf' in [
@@ -1049,46 +1078,46 @@
                 except ValueError:
                     pass
 
-                # the file exists and is readable so make the quiz
-                webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata)
+            # the file exists and is readable so make the quiz
+            webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata)
 
-                quiz_name = quiz_name[:quiz_name.index('.')]  # remove the extension
+            quiz_name, ext = os.path.splitext(quiz_name)  # extract filename and extension
 
-                # move the css file into the directory for the quiz
-                css_file = os.path.join(quiz_name, quiz_name + '.css')
-                if os.path.isfile(quiz_name + '.css'):
-                    if os.path.isfile(css_file):
-                        os.remove(css_file)
-                    shutil.move(quiz_name + '.css', css_file)
+            # move the css file into the directory for the quiz
+            css_file = os.path.join(quiz_name, quiz_name + '.css')
+            if os.path.isfile(quiz_name + '.css'):
+                if os.path.isfile(css_file):
+                    os.remove(css_file)
+                shutil.move(quiz_name + '.css', css_file)
 
-                # now clean up unless debugging
-                if not options.debugging:
-                    for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log',
-                        'ps', 'pdf', 'tmp', 'xml', 'xref'
+            # now clean up unless debugging
+            if not options.debugging:
+                for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log',
+                    'ps', 'pdf', 'tmp', 'xml', 'xref'
+                ]:
+                    if os.path.isfile(quiz_name + '.' + ext):
+                        os.remove(quiz_name + '.' + ext)
+
+                # files created when using pst2pdf
+                if options.pst2pdf:
+                    for file in glob.glob(quiz_name + '-pdf.*'):
+                        os.remove(file)
+                    for file in glob.glob(quiz_name + '-pdf-fixed.*'):
+                        os.remove(file)
+                    for extention in ['.preamble', '.plog', '-tmp.tex',
+                            '-pst.tex', '-fig.tex'
                     ]:
-                        if os.path.isfile(quiz_name + '.' + ext):
-                            os.remove(quiz_name + '.' + ext)
+                        if os.path.isfile(quiz_name + extention):
+                            os.remove(quiz_name + extention)
+                    if os.path.isdir(os.path.join(quiz_name, quiz_name)):
+                        shutil.rmtree(os.path.join(quiz_name, quiz_name))
 
-                    # files created when using pst2pdf
-                    if options.pst2pdf:
-                        for file in glob.glob(quiz_name + '-pdf.*'):
-                            os.remove(file)
-                        for file in glob.glob(quiz_name + '-pdf-fixed.*'):
-                            os.remove(file)
-                        for extention in ['.preamble', '.plog', '-tmp.tex',
-                                '-pst.tex', '-fig.tex'
-                        ]:
-                            if os.path.isfile(quiz_name + extention):
-                                os.remove(quiz_name + extention)
-                        if os.path.isdir(os.path.join(quiz_name, quiz_name)):
-                            shutil.rmtree(os.path.join(quiz_name, quiz_name))
-
-        if settings.initialise_warning != '':
+        if settings.initialise_warning != '' and not settings.have_initialised:
             print(webquiz_templates.text_initialise_warning)
 
     except Exception as err:
 
-        # there is a small chance that there is an error before we the
+        # there is a small chance that there is an error before the
         # settings.debugging flag has been set
         webquiz_util.webquiz_error(settings.debugging if 'settings' in globals() else True,
             'unknown problem.\n\nIf you think this is a bug please report it by creating an issue at\n    {}\n'

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz.bat
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz.bat	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz.bat	2019-04-01 21:07:31 UTC (rev 50694)
@@ -1,14 +1,30 @@
 @echo off
+rem WebQuiz batch file to find and launch python executable
+
+rem Set TEXMF to root TeX directory and look for webquiz.py in scripts/webquiz
 setlocal enableextensions
-rem assuming the main script is in the same directory
-if not exist "%~dpn0.py" (
-  echo %~nx0: main script "%~dpn0.py" not found>&2
+for /F "tokens=*" %%i in ('kpsewhich -var-value TEXMFMAIN') do (SET TEXMF=%%i)
+
+rem First look for webquiz.py in the current directory
+set WebQuiz="webquiz.py"
+if not exist %WebQuiz% (
+    if exist "%TEXMF%/scripts/webquiz/webquiz.py" (
+      set WebQuiz="%TEXMF%/scripts/webquiz/webquiz.py"
+    )
+)
+rem
+rem exit with an error if webquiz.py has not been found
+if not exist %WebQuiz% (
+  echo WebQuiz executable not found. Please check that WebQuiz is properly installed>&2
   exit /b 1
 )
-rem check if interpreter is on the PATH
+
+rem check for the python interpreter in the PATH
 for %%I in (python.exe) do set "PYTHONEXE=%%~$PATH:I"
 if not defined PYTHONEXE (
   echo %~nx0: Python interpreter not installed or not on the PATH>&2
   exit /b 1
 )
-"%PYTHONEXE%" "%~dpn0.py" %*
+
+rem launch webquiz
+"%PYTHONEXE%" %WebQuiz% %*

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz.py
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz.py	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz.py	2019-04-01 21:07:31 UTC (rev 50694)
@@ -42,7 +42,7 @@
     try:
         metadata = webquiz_util.MetaData(ini_file, debugging=False)
     except (FileNotFoundError, subprocess.CalledProcessError):
-        print('webquiz installation error: unable to find webquiz.ini -> {}'.format(ini_file))
+        print(webquiz_templates.missing_webquiz_ini.format(ini_file))
         sys.exit(1)
 
 # ---------------------------------------------------------------------------------------
@@ -71,7 +71,8 @@
         # pst2pdf converts pspicture environments to svg images and makes a
         # new latex file quiz_file+'-pdf' that includes these
         cmd = 'pst2pdf --svg --imgdir={q_file} {q_file}.tex'.format(q_file=quiz_file)
-        options.run(cmd)
+        # pst2pdf is missing a #!-header so we need shell=True
+        options.run(cmd, shell=True)
     except OSError as err:
         if err.errno == errno.ENOENT:
             webquiz_util.webquiz_error(options.debugging, 'pst2pdf not found. You need to install pst2pdf to use the pst2pdf option', err)
@@ -226,12 +227,16 @@
 
         # define user and system rc file and load the ones that exist
 
-        self.system_rcfile = os.path.join(webquiz_util.kpsewhich('-var TEXMFLOCAL'),
-                                           'tex',
-                                           'latex',
-                                           'webquiz',
-                                           'webquizrc'
-        )
+        TEXMFLOCAL=''
+        try:
+            TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFLOCAL')
+        except subprocess.CalledProcessError:
+            pass
+
+        if TEXMFLOCAL == '':
+            TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
+
+        self.system_rcfile = os.path.join(TEXMFLOCAL, 'tex', 'latex', 'webquiz', 'webquizrc')
         self.read_webquizrc(self.system_rcfile)
 
         # the user rc file defaults to:
@@ -378,9 +383,8 @@
         Print the non-default settings for webquiz from the webquizrc
         '''
         if not hasattr(self, 'rcfile'):
-            print(
-                'Please initialise WebQuiz using the command: webquiz --initialise\n'
-            )
+            print(webquiz_templates.initialise_settings)
+            sys.exit(1)
 
         if setting not in ['all', 'verbose', 'help']:
             setting = setting.replace('-', '_')
@@ -440,7 +444,7 @@
             default_root = '/Library/WebServer/Documents/WebQuiz'
             platform = 'Mac OSX'
         elif sys.platform.startswith('win'):
-            default_root = ' c:\inetpub\wwwroot\WebQuiz'
+            default_root = 'c:\inetpub\wwwroot\WebQuiz'
             platform = 'Windows'
         else:
             default_root = '/var/www/html/WebQuiz'
@@ -496,7 +500,7 @@
                     # if texdoc failed then try using TEXMFMAIN
                     if webquiz_doc=='':
                         try:
-                            webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var TEXMFMAIN'), 'doc','latex', 'webquiz')
+                            webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var-value TEXMFMAIN'), 'doc','latex', 'webquiz')
                         except subprocess.CalledProcessError:
                             pass
 
@@ -648,7 +652,7 @@
         Undocumented feature - useful for debugging initialisation routine
         '''
         webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..'))
-        texmf = webquiz_util.kpsewhich('-var TEXMFMAIN')
+        texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
         for (src, target) in [('scripts', 'scripts'),
                          ('latex', 'tex/latex'),
                          ('doc', 'doc/latex')]:
@@ -665,8 +669,17 @@
         try:
 
             # add a link to webquiz.py
-            texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-            os.symlink(os.path.join(texmf,'scripts','webquiz','webquiz.py'), os.path.join(texbin, 'webquiz'))
+            texbin = os.path.dirname(shutil.which('pdflatex'))
+            if sys.platform.startswith('win'):
+                shutil.copyfile(
+                    os.path.join(texmf,'scripts','webquiz','webquiz.bat'), 
+                    os.path.join(texbin, 'webquiz.bat')
+                )
+            else:
+                os.symlink(
+                    os.path.join(texmf,'scripts','webquiz','webquiz.py'), 
+                    os.path.join(texbin, 'webquiz')
+                )
             subprocess.call('mktexlsr', shell=True)
 
         except (FileExistsError,FileNotFoundError):
@@ -677,8 +690,7 @@
             sys.exit(1)
 
         except subprocess.CalledProcessError as err:
-            print('There was a problem running mktexlsr')
-            sys.exit(1)
+            self.webquiz_error('There was a problem running mktexlsr', err)
 
     def tex_uninstall(self):
         r'''
@@ -692,7 +704,7 @@
         Undocumented feature - useful for debugging initialisation routine
         '''
         webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..'))
-        texmf = webquiz_util.kpsewhich('-var TEXMFMAIN')
+        texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN')
         for target in ['scripts', 'tex/latex', 'doc/latex']:
             try:
                 shutil.rmtree(os.path.join(texmf, target, 'webquiz'))
@@ -706,8 +718,11 @@
 
         try:
             # remove link from texbin to webquiz.py
-            texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-            os.remove(os.path.join(texbin, 'webquiz'))
+            texbin = os.path.dirname(shutil.which('pdflatex'))
+            if sys.platform.startswith('win'):
+                os.remove(os.path.join(texbin, 'webquiz.bat'))
+            else:
+                os.remove(os.path.join(texbin, 'webquiz'))
 
         except (FileExistsError,FileNotFoundError):
             pass
@@ -729,12 +744,16 @@
             sys.exit(1)
 
         # remove link to webquiz.py
-        texbin = os.path.dirname(webquiz_util.shell_command('which pdflatex').split()[-1])
-        webquiz = os.path.join(texbin,'webquiz')
+        texbin = os.path.dirname(shutil.which('pdflatex'))
         try:
-            target = os.readlink(webquiz)
-            if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'):
+            if sys.platform.startswith('win'):
+                webquiz = os.path.join(texbin, 'webquiz.bat')
                 os.remove(webquiz)
+            else:
+                webquiz = os.path.join(texbin,'webquiz')
+                target = os.readlink(webquiz)
+                if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'):
+                    os.remove(webquiz)
 
         except (FileExistsError,FileNotFoundError):
             pass
@@ -852,6 +871,7 @@
         settings_parser.add_argument(
             '-i',
             '--initialise',
+            '--initialize',
             action='store_true',
             default=False,
             help='Install web components of webquiz')
@@ -1001,13 +1021,13 @@
         #       - we need to use shell=True because otherwise pst2pdf gives an error
         # options.talk() is a shorthand for letting the user know what is happening
         if options.quiet == 0:
-            options.run = lambda cmd: subprocess.call(cmd, shell=True)
+            options.run = webquiz_util.run
             options.talk = lambda msg: print(msg)
         elif options.quiet == 1:
-            options.run  = lambda cmd: subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'))
+            options.run  = webquiz_util.quiet_run
             options.talk = lambda msg: print(msg)
         else:
-            options.run  = lambda cmd: subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'))
+            options.run  = webquiz_util.silent_run
             options.talk = lambda msg: None
 
         # run through the list of quizzes and make them
@@ -1014,21 +1034,31 @@
         for quiz_file in options.quiz_file:
             if len(options.quiz_file) > 1 and options.quiet < 3:
                 print('Making web page for {}'.format(quiz_file))
+
+            quiz_name, ext = os.path.splitext(quiz_file)  # extract filename and extension
             # quiz_file is assumed to be a tex file if no extension is given
-            if not '.' in quiz_file:
-                quiz_file += '.tex'
+            if ext=='':
+                ext = '.tex'
+                quiz_file += ext
+ 
+            # windows likes adding a prefix of '.\\'to filename and this causes havoc with latex
+            if os.path.dirname(quiz_file)=='.':
+                quiz_file = os.path.basename(quiz_file)
 
+            if ext not in ['.tex', '.xml']:
+                    webquiz_util.webquiz_error(True, 'unrecognised file extension {}'.format(ext))
+
             if not os.path.isfile(quiz_file):
-                print('WebQuiz error: cannot read file {}'.format(quiz_file))
+                webquiz_util.webquiz+error(True, 'WebQuiz error: cannot read file {}'.format(quiz_file))
 
-            else:
+            # the quiz name and the quiz_file will be different if pst2pdf is used
+            quiz_name = quiz_file
+            if options.quiet < 2:
+                print('WebQuiz generating web page for {}'.format(quiz_file))
 
-                # the quiz name and the quiz_file will be if pst2pdf is used
-                quiz_name = quiz_file
-                if options.quiet < 2:
-                    print('WebQuiz generating web page for {}'.format(quiz_file))
-
-                # If the pst2podf option is used then we need to preprocess
+            options.pst2pdf = False
+            if ext==".tex":
+                # If the pst2pdf option is used then we need to preprocess
                 # the latex file BEFORE passing it to MakeWebQuiz. Set
                 # options.pst2pdf = True if pst2pdf is given as an option to
                 # the webquiz documentclass
@@ -1035,7 +1065,6 @@
                 with codecs.open(quiz_file, 'r', encoding='utf8') as q_file:
                     doc = q_file.read()
 
-                options.pst2pdf = False
                 try:
                     brac = doc.index(r'\documentclass[') + 15  # start of class options
                     if 'pst2pdf' in [
@@ -1049,46 +1078,46 @@
                 except ValueError:
                     pass
 
-                # the file exists and is readable so make the quiz
-                webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata)
+            # the file exists and is readable so make the quiz
+            webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata)
 
-                quiz_name = quiz_name[:quiz_name.index('.')]  # remove the extension
+            quiz_name, ext = os.path.splitext(quiz_name)  # extract filename and extension
 
-                # move the css file into the directory for the quiz
-                css_file = os.path.join(quiz_name, quiz_name + '.css')
-                if os.path.isfile(quiz_name + '.css'):
-                    if os.path.isfile(css_file):
-                        os.remove(css_file)
-                    shutil.move(quiz_name + '.css', css_file)
+            # move the css file into the directory for the quiz
+            css_file = os.path.join(quiz_name, quiz_name + '.css')
+            if os.path.isfile(quiz_name + '.css'):
+                if os.path.isfile(css_file):
+                    os.remove(css_file)
+                shutil.move(quiz_name + '.css', css_file)
 
-                # now clean up unless debugging
-                if not options.debugging:
-                    for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log',
-                        'ps', 'pdf', 'tmp', 'xml', 'xref'
+            # now clean up unless debugging
+            if not options.debugging:
+                for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log',
+                    'ps', 'pdf', 'tmp', 'xml', 'xref'
+                ]:
+                    if os.path.isfile(quiz_name + '.' + ext):
+                        os.remove(quiz_name + '.' + ext)
+
+                # files created when using pst2pdf
+                if options.pst2pdf:
+                    for file in glob.glob(quiz_name + '-pdf.*'):
+                        os.remove(file)
+                    for file in glob.glob(quiz_name + '-pdf-fixed.*'):
+                        os.remove(file)
+                    for extention in ['.preamble', '.plog', '-tmp.tex',
+                            '-pst.tex', '-fig.tex'
                     ]:
-                        if os.path.isfile(quiz_name + '.' + ext):
-                            os.remove(quiz_name + '.' + ext)
+                        if os.path.isfile(quiz_name + extention):
+                            os.remove(quiz_name + extention)
+                    if os.path.isdir(os.path.join(quiz_name, quiz_name)):
+                        shutil.rmtree(os.path.join(quiz_name, quiz_name))
 
-                    # files created when using pst2pdf
-                    if options.pst2pdf:
-                        for file in glob.glob(quiz_name + '-pdf.*'):
-                            os.remove(file)
-                        for file in glob.glob(quiz_name + '-pdf-fixed.*'):
-                            os.remove(file)
-                        for extention in ['.preamble', '.plog', '-tmp.tex',
-                                '-pst.tex', '-fig.tex'
-                        ]:
-                            if os.path.isfile(quiz_name + extention):
-                                os.remove(quiz_name + extention)
-                        if os.path.isdir(os.path.join(quiz_name, quiz_name)):
-                            shutil.rmtree(os.path.join(quiz_name, quiz_name))
-
-        if settings.initialise_warning != '':
+        if settings.initialise_warning != '' and not settings.have_initialised:
             print(webquiz_templates.text_initialise_warning)
 
     except Exception as err:
 
-        # there is a small chance that there is an error before we the
+        # there is a small chance that there is an error before the
         # settings.debugging flag has been set
         webquiz_util.webquiz_error(settings.debugging if 'settings' in globals() else True,
             'unknown problem.\n\nIf you think this is a bug please report it by creating an issue at\n    {}\n'

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz_layout.py
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz_layout.py	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz_layout.py	2019-04-01 21:07:31 UTC (rev 50694)
@@ -36,8 +36,8 @@
 #   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
+#   quiz.webquiz_init = javascript for initialising quiz page
+#                       MUST appear towards the end of HTML body
 
 def write_web_page(quiz):
   return quiz_page.format(

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz_makequiz.py
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz_makequiz.py	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz_makequiz.py	2019-04-01 21:07:31 UTC (rev 50694)
@@ -49,14 +49,14 @@
         self.options = options
         self.settings = settings
         self.metadata = metadata
-        self.quiz_name = quiz_name.split('.')[0]
-        self.quiz_file, extension = quiz_file.split('.')
+        self.quiz_file, extension = os.path.splitext(quiz_file)
+        self.quiz_name = os.path.basename(self.quiz_file)
         self.webquiz_url = settings['webquiz_url']
-        if  self.webquiz_url[-1] == '/':
+        if self.webquiz_url[-1] == '/':
             self.webquiz_url =  self.webquiz_url[:len(self.webquiz_url)-1]
 
         # run htlatex only if quiz_file has a .tex extension
-        if extension == 'tex':
+        if extension == '.tex':
             self.htlatex_quiz_file()
 
         self.read_xml_file()

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz_templates.py
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz_templates.py	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz_templates.py	2019-04-01 21:07:31 UTC (rev 50694)
@@ -195,12 +195,6 @@
         </div>'''
 multiple_feedback_answer = '              <li><em>{correct_answer}</em> {reason}</li>'
 
-initialise_invite = r'''WebQuiz needs to be initialised. In order to display quiz web pages
-WebQuiz needs to copy some css and javascript files into a directory
-that is accessible from your webserver.
-
-Do you want to initialise WebQuiz now [Y/n]? '''
-
 # no script error when javascript is not enabled
 no_script = r'''<noscript>
     <div class="warning">
@@ -211,9 +205,39 @@
   </noscript>'''
 
 ######################################################################
+# missing webquiz.ini file
+######################################################################
+
+missing_webquiz_ini = r'''
+webquiz installation error: unable to find webquiz.ini -> {}
+
+If you believe that WebQuiz has been installed correctly then please try
+rebuilding the TeX filename database. On TeXLive systems this can be done
+using the command mktexlsl, or using the TeXLive gui. On MiKTEX you can
+rebuild the database from the Tasks menu on the MiKTeX console. You may
+need to run this command using an administrator account or sudo, on unix
+systems.
+
+'''
+
+######################################################################
 # the remaining templates prompt the user when initialising webquiz
 ######################################################################
 
+initialise_invite = r'''WebQuiz needs to be initialised.
+
+Before WebQuiz can display quiz web pages on your system it first needs to
+copy some css and javascript files into a directory that is accessible from
+your webserver.
+
+Do you want to initialise WebQuiz now [Y/n]? '''
+
+initialise_before_settings = r'''
+Before you can view the webquiz settings you need to initialise WebQuiz
+using the command:
+    webquiz --initialise
+'''
+
 initialise_introduction = r'''
 WebQuiz Initialisation
 ======================
@@ -290,13 +314,6 @@
     webquiz --edit-settings
 '''
 
-webquiz_url_warning = r'''
-WebQuiz has not been initialised. To remove the warning message from
-the web page please use
-    webquiz --initialise
-to install the WebQuiz javascript and css files.
-'''
-
 text_initialise_warning = r'''
 WebQuiz has not yet been initialised. To remove this warning please use
       webquiz --initialise

Modified: trunk/Master/texmf-dist/scripts/webquiz/webquiz_util.py
===================================================================
--- trunk/Master/texmf-dist/scripts/webquiz/webquiz_util.py	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/scripts/webquiz/webquiz_util.py	2019-04-01 21:07:31 UTC (rev 50694)
@@ -33,9 +33,11 @@
 
 def kpsewhich(search):
     r'''
-    Short-cut to access kpsewhich output. usage: kpsewhich('-var-value=TEXMFLOCAL')
+    Short-cut to access kpsewhich output.
+
+    usage: kpsewhich('-var-value=TEXMFLOCAL')
     '''
-    return subprocess.check_output('kpsewhich ' + search, stderr=subprocess.STDOUT, shell=True).decode('ascii').strip()
+    return subprocess.check_output('kpsewhich ' + search, shell=True).decode('ascii').strip()
 
 # ---------------------------------------------------------------------------------------
 class MetaData(dict):
@@ -126,3 +128,34 @@
             copytree(s, d, symlinks, ignore)
         else:
             shutil.copy2(s, d)
+
+###############################################################################
+## shortcuts for running commands
+environ = os.environ.copy()
+
+def run(cmd, shell=False):
+    r'''
+    Run commands with output to stdout and errors to stderr
+    '''
+    if shell:
+        subprocess.call(cmd, env=environ, shell=True)
+    else:
+        subprocess.call(cmd.split(), env=environ)
+
+def quiet_run(cmd, shell=False):
+    r'''
+    Run commands with ignoring and sending errors to stderr
+    '''
+    if shell:
+        subprocess.call(cmd, env=environ, stdout=open(os.devnull, 'wb'), shell=True)
+    else:
+        subprocess.call(cmd.split(), env=environ, stdout=open(os.devnull, 'wb'))
+
+def silent_run(cmd, shell=False):
+    r'''
+    Run commands ignoring all output and errors
+    '''
+    if shell:
+        subprocess.call(cmd, env=environ, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'), shell=True)
+    else:
+        subprocess.call(cmd.split(), env=environ, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'))

Modified: trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.cfg	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.cfg	2019-04-01 21:07:31 UTC (rev 50694)
@@ -27,8 +27,8 @@
 \Configure{VERSION}{}
 
 % Output a WebQuiz doctype instead of the default for HTML5
-\Configure{DOCTYPE}{\HCode{<?xml version="1.0" encoding="UTF-8" standalone="no"?>\Hnewline
-<!DOCTYPE webquiz SYSTEM "webquiz.dtd">}}
+\Configure{DOCTYPE}{\HCode{<?xml version="1.0" encoding="UTF-8" ?>\Hnewline
+<!DOCTYPE webquiz>}}
 
 \ifWQ at Debugging\def\WQ at debugging{true}\else\def\WQ at debugging{false}\fi
 

Modified: trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.ini
===================================================================
--- trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.ini	2019-04-01 17:22:52 UTC (rev 50693)
+++ trunk/Master/texmf-dist/tex/latex/webquiz/webquiz.ini	2019-04-01 21:07:31 UTC (rev 50694)
@@ -11,4 +11,4 @@
 repository    = github.com/AndrewAtLarge/WebQuiz/issues
 requirements  = Python3 and \LaTeX, including \TeX 4ht and make4ht
 url           = www.maths.usyd.edu.au/u/mathas/WebQuiz/doc/webquiz-online-manual.html
-version       = 5.1
+version       = 5.2



More information about the tex-live-commits mailing list