problemtools 1.20231016__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- problemtools-1.20231016/LICENSE +21 -0
- problemtools-1.20231016/MANIFEST.in +4 -0
- problemtools-1.20231016/PKG-INFO +18 -0
- problemtools-1.20231016/README.md +227 -0
- problemtools-1.20231016/problemtools/ProblemPlasTeX/ProblemsetMacros.py +179 -0
- problemtools-1.20231016/problemtools/ProblemPlasTeX/__init__.py +125 -0
- problemtools-1.20231016/problemtools/ProblemPlasTeX/graphicx.py +28 -0
- problemtools-1.20231016/problemtools/ProblemPlasTeX/import.py +27 -0
- problemtools-1.20231016/problemtools/ProblemPlasTeX/listingsutf8.py +37 -0
- problemtools-1.20231016/problemtools/ProblemPlasTeX/ulem.py +11 -0
- problemtools-1.20231016/problemtools/__init__.py +1 -0
- problemtools-1.20231016/problemtools/_version.py +2 -0
- problemtools-1.20231016/problemtools/config/languages.yaml +256 -0
- problemtools-1.20231016/problemtools/config/problem.yaml +31 -0
- problemtools-1.20231016/problemtools/config/testdata.yaml +11 -0
- problemtools-1.20231016/problemtools/config.py +67 -0
- problemtools-1.20231016/problemtools/generatedata.py +275 -0
- problemtools-1.20231016/problemtools/languages.py +254 -0
- problemtools-1.20231016/problemtools/problem2html.py +155 -0
- problemtools-1.20231016/problemtools/problem2pdf.py +80 -0
- problemtools-1.20231016/problemtools/py.typed +0 -0
- problemtools-1.20231016/problemtools/run/__init__.py +114 -0
- problemtools-1.20231016/problemtools/run/buildrun.py +90 -0
- problemtools-1.20231016/problemtools/run/checktestdata.py +80 -0
- problemtools-1.20231016/problemtools/run/errors.py +8 -0
- problemtools-1.20231016/problemtools/run/executable.py +41 -0
- problemtools-1.20231016/problemtools/run/limit.py +67 -0
- problemtools-1.20231016/problemtools/run/program.py +123 -0
- problemtools-1.20231016/problemtools/run/rutil.py +54 -0
- problemtools-1.20231016/problemtools/run/source.py +159 -0
- problemtools-1.20231016/problemtools/run/tools.py +47 -0
- problemtools-1.20231016/problemtools/run/viva.py +82 -0
- problemtools-1.20231016/problemtools/template.py +117 -0
- problemtools-1.20231016/problemtools/templates/html/Accents.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/html/Alignment.zpts +11 -0
- problemtools-1.20231016/problemtools/templates/html/Arrays.zpts +25 -0
- problemtools-1.20231016/problemtools/templates/html/Bibliography.zpts +30 -0
- problemtools-1.20231016/problemtools/templates/html/Boxes.zpts +14 -0
- problemtools-1.20231016/problemtools/templates/html/Breaking.zpts +4 -0
- problemtools-1.20231016/problemtools/templates/html/Crossref.zpts +7 -0
- problemtools-1.20231016/problemtools/templates/html/Floats.zpts +13 -0
- problemtools-1.20231016/problemtools/templates/html/FontSelection.zpts +105 -0
- problemtools-1.20231016/problemtools/templates/html/Footnotes.zpts +7 -0
- problemtools-1.20231016/problemtools/templates/html/Index.zpts +46 -0
- problemtools-1.20231016/problemtools/templates/html/Lists.zpts +35 -0
- problemtools-1.20231016/problemtools/templates/html/Math.zpts +6 -0
- problemtools-1.20231016/problemtools/templates/html/Misc.zpts +11 -0
- problemtools-1.20231016/problemtools/templates/html/Pictures.zpts +4 -0
- problemtools-1.20231016/problemtools/templates/html/Primitives.zpts +8 -0
- problemtools-1.20231016/problemtools/templates/html/Quotations.zpts +8 -0
- problemtools-1.20231016/problemtools/templates/html/Sectioning.zpts +46 -0
- problemtools-1.20231016/problemtools/templates/html/Sentences.zpts +50 -0
- problemtools-1.20231016/problemtools/templates/html/Space.zpts +17 -0
- problemtools-1.20231016/problemtools/templates/html/Tabbing.zpts +4 -0
- problemtools-1.20231016/problemtools/templates/html/Themes/default/default-layout.html +37 -0
- problemtools-1.20231016/problemtools/templates/html/Themes/default/problem.css +90 -0
- problemtools-1.20231016/problemtools/templates/html/Verbatim.zpts +5 -0
- problemtools-1.20231016/problemtools/templates/html/alltt.html +1 -0
- problemtools-1.20231016/problemtools/templates/html/babel.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/html/changebar.zpts +5 -0
- problemtools-1.20231016/problemtools/templates/html/color.zpts +4 -0
- problemtools-1.20231016/problemtools/templates/html/fancybox.zpts +8 -0
- problemtools-1.20231016/problemtools/templates/html/float.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/html/graphicx.zpts +5 -0
- problemtools-1.20231016/problemtools/templates/html/hyperref.zpts +66 -0
- problemtools-1.20231016/problemtools/templates/html/ifthen.zpts +7 -0
- problemtools-1.20231016/problemtools/templates/html/lipsum.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/html/listingsutf8.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/html/longtable.zpts +25 -0
- problemtools-1.20231016/problemtools/templates/html/memoir.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/html/minitoc.zpts +51 -0
- problemtools-1.20231016/problemtools/templates/html/natbib.zpts +14 -0
- problemtools-1.20231016/problemtools/templates/html/problemsetmacros.zpts +44 -0
- problemtools-1.20231016/problemtools/templates/html/subfig.zpts +14 -0
- problemtools-1.20231016/problemtools/templates/html/subfigure.zpts +5 -0
- problemtools-1.20231016/problemtools/templates/html/textcomp.zpts +3 -0
- problemtools-1.20231016/problemtools/templates/html/ulem.zpts +20 -0
- problemtools-1.20231016/problemtools/templates/html/url.zpts +4 -0
- problemtools-1.20231016/problemtools/templates/html/wrapfig.zpts +2 -0
- problemtools-1.20231016/problemtools/templates/latex/problemset.cls +429 -0
- problemtools-1.20231016/problemtools/templates/latex/problemset_0.1.cls +257 -0
- problemtools-1.20231016/problemtools/templates/latex/template.tex +10 -0
- problemtools-1.20231016/problemtools/templates/latex/template_0.1.tex +10 -0
- problemtools-1.20231016/problemtools/tests/__init__.py +0 -0
- problemtools-1.20231016/problemtools/tests/config1/broken.yaml +1 -0
- problemtools-1.20231016/problemtools/tests/config1/test.yaml +2 -0
- problemtools-1.20231016/problemtools/tests/config1/test2.yaml +2 -0
- problemtools-1.20231016/problemtools/tests/config2/test2.yaml +4 -0
- problemtools-1.20231016/problemtools/tests/languages_examples/src1.zoo +1 -0
- problemtools-1.20231016/problemtools/tests/languages_examples/src2.zoo +3 -0
- problemtools-1.20231016/problemtools/tests/languages_examples/src3.zpp +1 -0
- problemtools-1.20231016/problemtools/tests/test_config.py +51 -0
- problemtools-1.20231016/problemtools/tests/test_languages.py +278 -0
- problemtools-1.20231016/problemtools/tests/test_run_limit.py +15 -0
- problemtools-1.20231016/problemtools/update_from_old_problemformat.py +60 -0
- problemtools-1.20231016/problemtools/verifyproblem.py +1886 -0
- problemtools-1.20231016/problemtools.egg-info/PKG-INFO +18 -0
- problemtools-1.20231016/problemtools.egg-info/SOURCES.txt +330 -0
- problemtools-1.20231016/problemtools.egg-info/dependency_links.txt +1 -0
- problemtools-1.20231016/problemtools.egg-info/entry_points.txt +5 -0
- problemtools-1.20231016/problemtools.egg-info/requires.txt +4 -0
- problemtools-1.20231016/problemtools.egg-info/top_level.txt +1 -0
- problemtools-1.20231016/setup.cfg +6 -0
- problemtools-1.20231016/setup.py +96 -0
- problemtools-1.20231016/support/Makefile +25 -0
- problemtools-1.20231016/support/checktestdata/.git +1 -0
- problemtools-1.20231016/support/checktestdata/.gitignore +15 -0
- problemtools-1.20231016/support/checktestdata/.travis.yml +11 -0
- problemtools-1.20231016/support/checktestdata/COPYING +22 -0
- problemtools-1.20231016/support/checktestdata/Makefile +139 -0
- problemtools-1.20231016/support/checktestdata/README.md +99 -0
- problemtools-1.20231016/support/checktestdata/bootstrap +10 -0
- problemtools-1.20231016/support/checktestdata/checktestdata.cc +195 -0
- problemtools-1.20231016/support/checktestdata/checktestdata.l +153 -0
- problemtools-1.20231016/support/checktestdata/checktestdata.y +150 -0
- problemtools-1.20231016/support/checktestdata/config.guess +1530 -0
- problemtools-1.20231016/support/checktestdata/config.mk.in +38 -0
- problemtools-1.20231016/support/checktestdata/config.sub +1782 -0
- problemtools-1.20231016/support/checktestdata/configure.ac +79 -0
- problemtools-1.20231016/support/checktestdata/debian/README.source +6 -0
- problemtools-1.20231016/support/checktestdata/debian/changelog +11 -0
- problemtools-1.20231016/support/checktestdata/debian/compat +1 -0
- problemtools-1.20231016/support/checktestdata/debian/control +19 -0
- problemtools-1.20231016/support/checktestdata/debian/copyright +26 -0
- problemtools-1.20231016/support/checktestdata/debian/docs +2 -0
- problemtools-1.20231016/support/checktestdata/debian/install +1 -0
- problemtools-1.20231016/support/checktestdata/debian/rules +14 -0
- problemtools-1.20231016/support/checktestdata/debian/source/format +1 -0
- problemtools-1.20231016/support/checktestdata/debian/source/lintian-overrides +1 -0
- problemtools-1.20231016/support/checktestdata/doc/format-spec.md +167 -0
- problemtools-1.20231016/support/checktestdata/fltcmp.ctd +10 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/LICENSE +30 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/Setup.hs +2 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/checktestdata.cabal +42 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/example.hs +26 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/example.in +4 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata/Core.hs +223 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata/Derived.hs +79 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata/Script/AST.hs +67 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata/Script/Interpreter.hs +230 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata/Script/Parser.hs +252 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata/Script.hs +13 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src/Checktestdata.hs +65 -0
- problemtools-1.20231016/support/checktestdata/haskell_edsl/src-main/Main.hs +24 -0
- problemtools-1.20231016/support/checktestdata/hello.ctd +4 -0
- problemtools-1.20231016/support/checktestdata/install-sh +520 -0
- problemtools-1.20231016/support/checktestdata/lex.cc +1362 -0
- problemtools-1.20231016/support/checktestdata/libchecktestdata.cc +1368 -0
- problemtools-1.20231016/support/checktestdata/libchecktestdata.hpp +47 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_append_compile_flags.m4 +67 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_append_flag.m4 +71 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_append_link_flags.m4 +65 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_boost_base.m4 +285 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_check_compile_flag.m4 +74 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_check_link_flag.m4 +74 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_compare_version.m4 +177 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_cxx_compile_stdcxx.m4 +562 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_lib_cxx_regex.m4 +12 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_path_generic.m4 +164 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_require_defined.m4 +37 -0
- problemtools-1.20231016/support/checktestdata/m4/ax_with_prog.m4 +70 -0
- problemtools-1.20231016/support/checktestdata/parse.cc +2792 -0
- problemtools-1.20231016/support/checktestdata/parser.h +44 -0
- problemtools-1.20231016/support/checktestdata/parser.ih +44 -0
- problemtools-1.20231016/support/checktestdata/parserbase.h +167 -0
- problemtools-1.20231016/support/checktestdata/parsetype.cc +55 -0
- problemtools-1.20231016/support/checktestdata/parsetype.hpp +138 -0
- problemtools-1.20231016/support/checktestdata/scanner.h +94 -0
- problemtools-1.20231016/support/checktestdata/scanner.ih +6 -0
- problemtools-1.20231016/support/checktestdata/scannerbase.h +395 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata1.err1 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata1.err2 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata1.err3 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata1.err4 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata1.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata10.err1 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata10.err2 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata10.err3 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata10.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata11.err1 +7 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata11.err2 +7 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata11.in +7 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata12.err1 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata12.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata13.err +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata13.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata14.in +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata15.err +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata15.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata16.err1 +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata16.err2 +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata16.in +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata17.err1 +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata17.err2 +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata17.in +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata18.err1 +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata18.in +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata19.err1 +21 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata19.in +20 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata2.err1 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata2.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata20.err1 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata20.err2 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata20.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata21.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata21.err2 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata21.err3 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata21.err4 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata21.in +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata22.err1 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata22.err2 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata22.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata22.in2 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata23.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata24.err1 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata24.in +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata24.in2 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata25.err1 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata25.err2 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata25.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata26.err +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata26.in +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata27.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata28.in +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.err1 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.err2 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.err3 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.err4 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.err5 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.err6 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.in +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata29.in2 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata3.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata3.err2 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata3.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata4.err1 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata4.err2 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata4.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata5.err1 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata5.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata6.err1 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata6.err2 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata6.err3 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata6.in +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata7.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata7.err2 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata7.err3 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata7.err4 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata7.in +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.err1 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.err2 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.err3 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.err4 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.err5 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.err6 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.in1 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata8.in2 +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata9.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testdata9.in +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testpresetprog.err +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testpresetprog.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog1.err1 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog1.in +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog10.err1 +20 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog10.err2 +20 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog10.err3 +18 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog10.in +18 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog11.in +13 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog12.in +17 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog13.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog14.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog15.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog16.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog17.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog18.err1 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog18.err2 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog18.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog19.in +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog2.err1 +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog2.err2 +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog2.err3 +9 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog2.in +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog20.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog20.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog21.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog22.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog22.err2 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog22.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog23.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog24.in +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog25.in +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog26.err1 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog26.err2 +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog26.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog27.in +10 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog28.err +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog28.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog29.err1 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog29.err2 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog29.err3 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog29.err4 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog29.in +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog29.in2 +1 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog3.err1 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog3.err2 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog3.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog4.in +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog5.err1 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog5.in +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog6.in +8 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog7.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog8.in +3 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog9.err1 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog9.err2 +2 -0
- problemtools-1.20231016/support/checktestdata/tests/testprog9.in +4 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsdata1.err1 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsdata1.err2 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsdata1.err3 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsdata1.in1 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsdata1.in2 +5 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsdata1.in3 +6 -0
- problemtools-1.20231016/support/checktestdata/tests/testwsprog1.in +8 -0
- problemtools-1.20231016/support/default_grader/default_grader +71 -0
- problemtools-1.20231016/support/default_validator/Makefile +8 -0
- problemtools-1.20231016/support/default_validator/default_validator.cc +172 -0
- problemtools-1.20231016/support/interactive/Makefile +8 -0
- problemtools-1.20231016/support/interactive/interactive.cc +325 -0
- problemtools-1.20231016/support/viva/VIVA User's Guide.pdf +0 -0
- problemtools-1.20231016/support/viva/viva.jar +0 -0
- problemtools-1.20231016/support/viva/viva.sh +4 -0
- problemtools-1.20231016/support/viva/vivagui.jar +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2019 Kattis and all respective contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: problemtools
|
|
3
|
+
Version: 1.20231016
|
|
4
|
+
Summary: Kattis Problem Tools
|
|
5
|
+
Home-page: https://github.com/Kattis/problemtools
|
|
6
|
+
Maintainer: Kattis AB
|
|
7
|
+
Maintainer-email: contact@kattis.com
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: PyYAML
|
|
11
|
+
Requires-Dist: plasTeX>=3.0; python_version >= "3"
|
|
12
|
+
Dynamic: home-page
|
|
13
|
+
Dynamic: license
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
Dynamic: maintainer
|
|
16
|
+
Dynamic: maintainer-email
|
|
17
|
+
Dynamic: requires-dist
|
|
18
|
+
Dynamic: summary
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Kattis Problem Tools
|
|
2
|
+
|
|
3
|
+
master:
|
|
4
|
+
[](https://travis-ci.org/Kattis/problemtools).
|
|
5
|
+
develop:
|
|
6
|
+
[](https://travis-ci.org/Kattis/problemtools)
|
|
7
|
+
|
|
8
|
+
These are tools to manage problem packages using the Kattis problem package
|
|
9
|
+
format.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Programs Provided
|
|
13
|
+
|
|
14
|
+
The problem tools provide the following three programs:
|
|
15
|
+
|
|
16
|
+
- `verifyproblem`: run a complete check on a problem
|
|
17
|
+
- `problem2pdf`: convert a problem statement to pdf
|
|
18
|
+
- `problem2html`: convert a problem statement to html
|
|
19
|
+
|
|
20
|
+
Running any of them with command-line option `-h` gives
|
|
21
|
+
documentation on what arguments they accept.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Example Problems
|
|
25
|
+
|
|
26
|
+
A few examples of problem packages can be found in [examples](examples).
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Installing problemtools
|
|
30
|
+
|
|
31
|
+
There are four supported ways of installing and running problemtools.
|
|
32
|
+
(For non-Linux users, "Method 2" below, to use Docker, is probably the least painful.)
|
|
33
|
+
|
|
34
|
+
### Method 1: Install the Python package
|
|
35
|
+
|
|
36
|
+
Run
|
|
37
|
+
```
|
|
38
|
+
pip3 install git+https://github.com/kattis/problemtools
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or if you don't want a system-wide installation,
|
|
42
|
+
```
|
|
43
|
+
pip3 install --user git+https://github.com/kattis/problemtools
|
|
44
|
+
```
|
|
45
|
+
With this second option, in order to get the command line scripts, you need
|
|
46
|
+
to make sure that the local user bin path used (e.g., on Linux,
|
|
47
|
+
`$HOME/.local/bin`) is in your `$PATH`.
|
|
48
|
+
|
|
49
|
+
In order for problemtools to build and run properly, you also need to have LaTeX
|
|
50
|
+
and various LaTeX packages installed. See [Requirements and
|
|
51
|
+
compatbility](#requirements-and-compatibility) below for details on
|
|
52
|
+
which packages are needed.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Method 2: Use Docker
|
|
56
|
+
|
|
57
|
+
This method allows you to run the Kattis problemtools inside a Docker container. This method is supported on any system for which Docker exists, including **macOS** and **Windows 10**.
|
|
58
|
+
|
|
59
|
+
We maintain three official problemtools Docker images on Docker Hub:
|
|
60
|
+
|
|
61
|
+
- [`problemtools/full`](https://hub.docker.com/r/problemtools/full/): this image contains problemtools along with compilers/interpreters for all supported programming languages.
|
|
62
|
+
|
|
63
|
+
- [`problemtools/icpc`](https://hub.docker.com/r/problemtools/icpc/): this image contains problemtools along with compilers/interpreters for the programming languages allowed in the International Collegiate Programming Contest (ICPC): C, C++, Java, Python 2+3, and Kotlin.
|
|
64
|
+
|
|
65
|
+
- [`problemtools/minimal`](https://hub.docker.com/r/problemtools/minimal/): this image only contains problemtools, no additional programming languages. As such as it is not particularly useful on its own, but if you are organizing a contest and want to set up a problemtools environment containing exactly the right set of compilers/interpreters for your contest, this is the recommended starting point.
|
|
66
|
+
|
|
67
|
+
For example, suppose you want to use the `problemtools/icpc` image. To get started, install the [Docker CLI](https://docs.docker.com/install), and then pull the image:
|
|
68
|
+
|
|
69
|
+
docker pull problemtools/icpc
|
|
70
|
+
|
|
71
|
+
Once the image has finished downloading, you can check that it exists on your system using `docker images`. To launch an interactive container and play around with *verifyproblem*, *problem2pdf*, and *problem2html* run:
|
|
72
|
+
|
|
73
|
+
docker run --rm -it problemtools/icpc
|
|
74
|
+
|
|
75
|
+
By default, docker containers do _NOT_ persist storage between runs, so any files you create or modify will be lost when the container stops running. Two common ways of dealing with this are:
|
|
76
|
+
|
|
77
|
+
1) Use a [bind mount](https://docs.docker.com/storage/bind-mounts/) to mount a directory on your machine into the docker container. This can be done as follows (see Docker documentation for further details):
|
|
78
|
+
```
|
|
79
|
+
docker run --rm -it -v ${FULL_PATH_TO_MOUNT}:/kattis_work_dir problemtools/icpc
|
|
80
|
+
```
|
|
81
|
+
2) Persist any changes you want to keep to a remote file system/source control (e.g. a remote Git repository, note however that you would first need to install Git in the image).
|
|
82
|
+
|
|
83
|
+
#### Building your own images
|
|
84
|
+
|
|
85
|
+
If you want a more complete environment in the Docker images (e.g. if
|
|
86
|
+
you want to install git or your favorite editor), feel free to extend
|
|
87
|
+
them in whichever way you like.
|
|
88
|
+
|
|
89
|
+
The `problemtools/{minimal,icpc,full}` images point to the latest
|
|
90
|
+
release versions of problemtools. If for some reason you want an
|
|
91
|
+
image containing the latest development version, you have to build it
|
|
92
|
+
yourself from scratch (while there are
|
|
93
|
+
`problemtools/{minimal,icpc,full}:develop` Docker images on Docker
|
|
94
|
+
Hub, these are only updated sporadically for testing purposes and not
|
|
95
|
+
kept up to date).
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Method 3: Run directly from the repository.
|
|
99
|
+
|
|
100
|
+
If you intend to help develop problemtools, or if you just want a
|
|
101
|
+
bare-bones way of running them, this is your option.
|
|
102
|
+
|
|
103
|
+
For this method, you need to clone the repository (just downloading a
|
|
104
|
+
zip archive of it does not work, because the project has submodules
|
|
105
|
+
that are not included in that zip archive).
|
|
106
|
+
|
|
107
|
+
In order for the tools to work, you first have to compile the various
|
|
108
|
+
support programs, which can be done by running `make` in the root
|
|
109
|
+
directory of problemtools.
|
|
110
|
+
|
|
111
|
+
When this is done, you can run the three programs
|
|
112
|
+
`bin/verifyproblem.sh`, `bin/problem2pdf.sh`, and
|
|
113
|
+
`bin/problem2html.sh` directly from the repository.
|
|
114
|
+
|
|
115
|
+
See [Requirements and compatibility](#requirements-and-compatibility)
|
|
116
|
+
below for what other software needs to be installed on your machine in
|
|
117
|
+
order for problemtools to work correctly.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Method 4: Build and install the Debian package
|
|
121
|
+
|
|
122
|
+
This applies if you are running on Debian or a Debian derivative such
|
|
123
|
+
as Ubuntu.
|
|
124
|
+
|
|
125
|
+
As with method 3, you need to clone the repository (just downloading a
|
|
126
|
+
zip archive of it does not work, because the project has submodules
|
|
127
|
+
that are not included in that zip archive).
|
|
128
|
+
|
|
129
|
+
Run `make builddeb` in the root of the problemtools repository to
|
|
130
|
+
build the package. It will be found as kattis-problemtools_X.Y.deb in
|
|
131
|
+
the directory containing problemtools (i.e., one level up from the
|
|
132
|
+
root of the repository).
|
|
133
|
+
|
|
134
|
+
Apart from the build dependencies listed [below](#ubuntu), building
|
|
135
|
+
the Debian package requires that the following tools are installed:
|
|
136
|
+
|
|
137
|
+
debhelper dh-python dpkg-dev
|
|
138
|
+
|
|
139
|
+
The package can then be installed using (replace `<version>` as appropriate):
|
|
140
|
+
|
|
141
|
+
sudo gdebi kattis-problemtools_<version>.deb
|
|
142
|
+
|
|
143
|
+
This installs the three provided programs in your path and they should
|
|
144
|
+
now be ready to use.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Configuration
|
|
148
|
+
|
|
149
|
+
System-wide problemtools configuration files are placed in
|
|
150
|
+
`/etc/kattis/problemtools/`, and user-specific configuration files are placed
|
|
151
|
+
in `$HOME/.config/problemtools/` (or in `$XDG_CONFIG_HOME` if this is defined). The following files can be used to change
|
|
152
|
+
problemtools' configuration:
|
|
153
|
+
|
|
154
|
+
1. `languages.yaml`. Use it to override problemtools' default
|
|
155
|
+
programming language configuration. For instance, while the
|
|
156
|
+
problemtools default is to use the CPython `/usr/bin/python3`
|
|
157
|
+
interpreter for Python 3, many contests, as well as the Kattis
|
|
158
|
+
online judge, use Pypy as the interpreter for Python 3. To change
|
|
159
|
+
this on your machine, you can simply place a file
|
|
160
|
+
`/etc/kattis/problemtools/languages.yaml` (or
|
|
161
|
+
`~/.config/problemtools/languages.yaml` if you only want to make the
|
|
162
|
+
change for your user) containing the following:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
python3:
|
|
166
|
+
name: 'Python 3 w/Pypy'
|
|
167
|
+
run: '/usr/bin/pypy3 "{mainfile}"'
|
|
168
|
+
```
|
|
169
|
+
Here, overriding the name of the language is not strictly
|
|
170
|
+
necessary, but it is often helpful to clearly indicate that Pypy is
|
|
171
|
+
being used.
|
|
172
|
+
|
|
173
|
+
For more details on the format of the language specifications and
|
|
174
|
+
what the default settings are, see the [default version of
|
|
175
|
+
languages.yaml](problemtools/config/languages.yaml)
|
|
176
|
+
|
|
177
|
+
2. `problem.yaml`. For most users, this should not be edited. If you
|
|
178
|
+
are not sure whether you should use it, then you probably shouldn't.
|
|
179
|
+
This file can be used to specify the system defaults for those
|
|
180
|
+
problem limits which are not given a fixed default value in the
|
|
181
|
+
[problem format specification](http://www.problemarchive.org/wiki/index.php/Problem_Format#limits).
|
|
182
|
+
The system defaults assumed by problemtools can be found in
|
|
183
|
+
(problemtools/config/problem.yaml). For instance, if you are
|
|
184
|
+
primarily working against a system with a default memory limit of 2 GiB,
|
|
185
|
+
you can place a file `~/.config/problemtools/problem.yaml` containing:
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
limits:
|
|
189
|
+
memory: 2048 # (unit is MiB)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
(In principle it is possible to override the defaults of other values than the
|
|
193
|
+
system-dependent defaults in the problem.yaml metadata files this way, but such
|
|
194
|
+
usage is very strongly discouraged.)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
## Requirements and compatibility
|
|
198
|
+
|
|
199
|
+
To build and run the tools, you need Python 3 with the YAML and PlasTeX libraries,
|
|
200
|
+
and a LaTeX installation.
|
|
201
|
+
|
|
202
|
+
### Ubuntu
|
|
203
|
+
|
|
204
|
+
The dependencies needed to *build/install* problemtools can be installed with:
|
|
205
|
+
|
|
206
|
+
sudo apt install automake g++ make libboost-regex-dev libgmp-dev libgmp10 libgmpxx4ldbl python3 python3-pytest python3-setuptools python3-yaml python3-plastex
|
|
207
|
+
|
|
208
|
+
And the dependencies needed to *run* problemtools can be installed with:
|
|
209
|
+
|
|
210
|
+
sudo apt install ghostscript libgmpxx4ldbl python3-minimal python-pkg-resources python3-plastex python3-yaml texlive-fonts-recommended texlive-lang-cyrillic texlive-latex-extra texlive-plain-generic tidy
|
|
211
|
+
|
|
212
|
+
### Fedora
|
|
213
|
+
|
|
214
|
+
On Fedora, these dependencies can be installed with:
|
|
215
|
+
|
|
216
|
+
sudo dnf install boost-regex gcc gmp-devel gmp-c++ python3 python3-pyyaml texlive-latex texlive-collection-fontsrecommended texlive-fancyhdr texlive-subfigure texlive-wrapfig texlive-import texlive-ulem texlive-xifthen texlive-overpic texlive-pbox tidy ghostscript
|
|
217
|
+
|
|
218
|
+
Followed by:
|
|
219
|
+
|
|
220
|
+
pip3 install --user plastex
|
|
221
|
+
|
|
222
|
+
### Other platforms
|
|
223
|
+
|
|
224
|
+
The problem tools have not been tested on other platforms. If you do
|
|
225
|
+
test on another platform, we would be happy to hear what worked and what
|
|
226
|
+
did not work, so that we can write proper instructions (and try to
|
|
227
|
+
figure out how to make the non-working stuff work).
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
import os.path
|
|
4
|
+
import io
|
|
5
|
+
from plasTeX.DOM import Node
|
|
6
|
+
from plasTeX.Base import Command
|
|
7
|
+
from plasTeX.Base import DimenCommand
|
|
8
|
+
from plasTeX.Logging import getLogger
|
|
9
|
+
import plasTeX.Packages.graphics as graphics
|
|
10
|
+
|
|
11
|
+
log = getLogger()
|
|
12
|
+
status = getLogger('status')
|
|
13
|
+
|
|
14
|
+
# Ugly hack: assume textwidth is 600pt. True for Kattis but not in
|
|
15
|
+
# general.
|
|
16
|
+
class textwidth(DimenCommand):
|
|
17
|
+
value = DimenCommand.new('600pt')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Convert an expression of the form "X\textwidth" to 100*x%
|
|
21
|
+
# (Used in ugly hack to handle illustrations)
|
|
22
|
+
def clean_width(width):
|
|
23
|
+
if not isinstance(width, Node):
|
|
24
|
+
return width
|
|
25
|
+
nodes = width.childNodes
|
|
26
|
+
if len(nodes) != 2 or nodes[1].nodeName != 'textwidth':
|
|
27
|
+
return width
|
|
28
|
+
return '%.2f%%' % (100*float(nodes[0]))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# \problemheader
|
|
32
|
+
class problemheader(Command):
|
|
33
|
+
args = 'title id:str'
|
|
34
|
+
|
|
35
|
+
def invoke(self, tex):
|
|
36
|
+
res = Command.invoke(self, tex)
|
|
37
|
+
timelimfile = os.path.join(os.path.dirname(tex.filename),
|
|
38
|
+
'..', '.timelimit')
|
|
39
|
+
if os.path.isfile(timelimfile):
|
|
40
|
+
self.attributes['timelim'] = open(timelimfile, 'r').read()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# \sampletable
|
|
44
|
+
class sampletable(Command):
|
|
45
|
+
args = 'header1 file1:str header2 file2:str'
|
|
46
|
+
|
|
47
|
+
def read_sample_file(self, filename):
|
|
48
|
+
return io.open(filename, 'r', encoding='utf-8').read()
|
|
49
|
+
|
|
50
|
+
def invoke(self, tex):
|
|
51
|
+
res = Command.invoke(self, tex)
|
|
52
|
+
dir = os.path.dirname(tex.filename)
|
|
53
|
+
file1 = os.path.join(dir, self.attributes['file1'])
|
|
54
|
+
file2 = os.path.join(dir, self.attributes['file2'])
|
|
55
|
+
try:
|
|
56
|
+
status.info(' ( verbatim %s ' % file1)
|
|
57
|
+
self.attributes['data1'] = self.read_sample_file(file1)
|
|
58
|
+
status.info(') ( verbatim %s ' % file2)
|
|
59
|
+
self.attributes['data2'] = self.read_sample_file(file2)
|
|
60
|
+
status.info(') ')
|
|
61
|
+
except (OSError, IOError):
|
|
62
|
+
log.warning('\nProblem opening files "%s" and "%s"', file1, file2)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# \sampletableinteractive
|
|
66
|
+
class sampletableinteractive(Command):
|
|
67
|
+
args = 'header read write file:str'
|
|
68
|
+
|
|
69
|
+
def read_sample_interaction(self, filename):
|
|
70
|
+
data = io.open(filename, 'r', encoding='utf-8').read()
|
|
71
|
+
messages = []
|
|
72
|
+
cur_msg = []
|
|
73
|
+
cur_mode = None
|
|
74
|
+
for line in data.split('\n'):
|
|
75
|
+
if not line: continue
|
|
76
|
+
if line[0] == '<': mode = 'read'
|
|
77
|
+
elif line[0] == '>': mode = 'write'
|
|
78
|
+
else: continue
|
|
79
|
+
line = line[1:]
|
|
80
|
+
if mode != cur_mode:
|
|
81
|
+
if cur_mode: messages.append({'mode': cur_mode,
|
|
82
|
+
'data': '\n'.join(cur_msg)})
|
|
83
|
+
cur_msg = []
|
|
84
|
+
cur_msg.append(line)
|
|
85
|
+
cur_mode = mode
|
|
86
|
+
if cur_mode: messages.append({'mode': cur_mode,
|
|
87
|
+
'data': '\n'.join(cur_msg)})
|
|
88
|
+
return messages
|
|
89
|
+
|
|
90
|
+
def invoke(self, tex):
|
|
91
|
+
res = Command.invoke(self, tex)
|
|
92
|
+
dir = os.path.dirname(tex.filename)
|
|
93
|
+
file = os.path.join(dir, self.attributes['file'])
|
|
94
|
+
try:
|
|
95
|
+
status.info(' ( sampletableinteractive %s ' % file)
|
|
96
|
+
self.attributes['messages'] = self.read_sample_interaction(file)
|
|
97
|
+
status.info(') ')
|
|
98
|
+
except (OSError, IOError):
|
|
99
|
+
log.warning('\nProblem opening file "%s"', file)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# Any command including a picture, such as \illustration and our
|
|
103
|
+
# re-implementation of \includegraphics. (Based on plasTeX's
|
|
104
|
+
# \includegraphics implementation)
|
|
105
|
+
class _graphics_command(Command):
|
|
106
|
+
def invoke(self, tex):
|
|
107
|
+
res = Command.invoke(self, tex)
|
|
108
|
+
|
|
109
|
+
# Overcome plasTeX bug by looking for love in the right place
|
|
110
|
+
basetex = self.ownerDocument.userdata['base_tex_instance']
|
|
111
|
+
f = self.attributes['file']
|
|
112
|
+
ext = self.ownerDocument.userdata.getPath(
|
|
113
|
+
'packages/graphicx/extensions',
|
|
114
|
+
['.png', '.jpg', '.jpeg', '.gif', '.pdf'])
|
|
115
|
+
paths = self.ownerDocument.userdata.getPath(
|
|
116
|
+
'packages/graphicx/paths', [os.path.dirname(basetex.filename)])
|
|
117
|
+
img = None
|
|
118
|
+
# Check for file using graphicspath
|
|
119
|
+
for p in paths:
|
|
120
|
+
for e in ['']+ext:
|
|
121
|
+
fname = os.path.join(p, f+e)
|
|
122
|
+
if os.path.isfile(fname):
|
|
123
|
+
img = os.path.abspath(fname)
|
|
124
|
+
break
|
|
125
|
+
if img is not None:
|
|
126
|
+
break
|
|
127
|
+
|
|
128
|
+
# Check for file using kpsewhich
|
|
129
|
+
if img is None:
|
|
130
|
+
for e in ['']+ext:
|
|
131
|
+
try:
|
|
132
|
+
img = os.path.abspath(basetex.kpsewhich(f+e))
|
|
133
|
+
break
|
|
134
|
+
except (OSError, IOError):
|
|
135
|
+
pass
|
|
136
|
+
|
|
137
|
+
if not os.path.isfile(img):
|
|
138
|
+
log.warning('Could not identify image "%s"' % f)
|
|
139
|
+
|
|
140
|
+
self.imageoverride = img
|
|
141
|
+
return res
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# \illustration
|
|
145
|
+
class illustration(_graphics_command):
|
|
146
|
+
args = 'width:double file:str description'
|
|
147
|
+
|
|
148
|
+
def invoke(self, tex):
|
|
149
|
+
res = _graphics_command.invoke(self, tex)
|
|
150
|
+
self.style['width'] = '%.2f%%' % (100*self.attributes['width'])
|
|
151
|
+
return res
|
|
152
|
+
|
|
153
|
+
# Dummy for \fontencoding to suppress warnings
|
|
154
|
+
class fontencoding(Command):
|
|
155
|
+
args = 'charset:str'
|
|
156
|
+
|
|
157
|
+
# Dummy for \selectfont to suppress warnings.
|
|
158
|
+
class selectfont(Command):
|
|
159
|
+
pass
|
|
160
|
+
|
|
161
|
+
# Dummy for \ExecuteOptions to suppress warnings.
|
|
162
|
+
class ExecuteOptions(Command):
|
|
163
|
+
pass
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def init(tex):
|
|
167
|
+
# Dirty hack #25783 to get plasTeX to work properly:
|
|
168
|
+
# any subprocess of the tex instance won't remember things like,
|
|
169
|
+
# say, the name of the .tex file being processed, which is needed
|
|
170
|
+
# for kpsewhich to work. So we'll keep a pointer to the original
|
|
171
|
+
# tex instance in the document's userdata.
|
|
172
|
+
tex.ownerDocument.userdata['base_tex_instance'] = tex
|
|
173
|
+
|
|
174
|
+
# Import the macros
|
|
175
|
+
tex.ownerDocument.context.importMacros(vars(sys.modules[__name__]))
|
|
176
|
+
|
|
177
|
+
# So apparently this is how to communicate to Plastex where to
|
|
178
|
+
# search for modules... Eugch.
|
|
179
|
+
sys.path = [os.path.dirname(__file__)] + sys.path
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import os
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
import plasTeX.Renderers
|
|
6
|
+
from plasTeX.Renderers.PageTemplate import Renderer
|
|
7
|
+
from plasTeX.Filenames import Filenames
|
|
8
|
+
from plasTeX.Imagers import Image
|
|
9
|
+
from plasTeX.Logging import getLogger
|
|
10
|
+
|
|
11
|
+
log = getLogger()
|
|
12
|
+
|
|
13
|
+
# Adapted from plasTeX.Imagers.Imager class
|
|
14
|
+
class ImageConverter(object):
|
|
15
|
+
fileExtension = '.png'
|
|
16
|
+
imageAttrs = ''
|
|
17
|
+
imageUnits = ''
|
|
18
|
+
|
|
19
|
+
imageTypes = ['.png', '.jpg', '.jpeg', '.gif'] #, '.svg']
|
|
20
|
+
imageConversion = {'.pdf': ['.png',
|
|
21
|
+
['gs', '-dUseCropBox', '-sDEVICE=pngalpha', '-r300', '-o']]}
|
|
22
|
+
|
|
23
|
+
def __init__(self, document):
|
|
24
|
+
self.config = document.config
|
|
25
|
+
self.ownerDocument = document
|
|
26
|
+
|
|
27
|
+
# Cache of already seen images
|
|
28
|
+
self.staticimages = {}
|
|
29
|
+
|
|
30
|
+
# Filename generator
|
|
31
|
+
self.newFilename = Filenames(self.config['images'].get('filenames'),
|
|
32
|
+
None,
|
|
33
|
+
variables={'jobname': document.userdata.get('jobname', '')},
|
|
34
|
+
extension=self.fileExtension, invalid={})
|
|
35
|
+
|
|
36
|
+
def close(self):
|
|
37
|
+
return
|
|
38
|
+
|
|
39
|
+
def getImage(self, node):
|
|
40
|
+
name = getattr(node, 'imageoverride', None)
|
|
41
|
+
if name is None:
|
|
42
|
+
log.error('Image handler called for non-image node "%s"' % node.source)
|
|
43
|
+
return None
|
|
44
|
+
|
|
45
|
+
if name in self.staticimages:
|
|
46
|
+
return self.staticimages[name]
|
|
47
|
+
|
|
48
|
+
oldext = os.path.splitext(name)[1]
|
|
49
|
+
path = self.newFilename()
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
directory = os.path.dirname(path)
|
|
53
|
+
if directory and not os.path.isdir(directory):
|
|
54
|
+
os.makedirs(directory)
|
|
55
|
+
if oldext in self.imageConversion:
|
|
56
|
+
# Need to convert image
|
|
57
|
+
newext = self.imageConversion[oldext][0]
|
|
58
|
+
path = os.path.splitext(path)[0]+newext
|
|
59
|
+
cmd = self.imageConversion[oldext][1] + [path, name]
|
|
60
|
+
status = subprocess.call(cmd)
|
|
61
|
+
if status:
|
|
62
|
+
log.warning('Failed to convert %s image "%s to %s', oldext, name, newext)
|
|
63
|
+
else:
|
|
64
|
+
# Just copy it
|
|
65
|
+
path = os.path.splitext(path)[0]+oldext
|
|
66
|
+
shutil.copyfile(name, path)
|
|
67
|
+
img = Image(path, self.ownerDocument.config['images'])
|
|
68
|
+
self.staticimages[name] = img
|
|
69
|
+
return img
|
|
70
|
+
|
|
71
|
+
except Exception as msg:
|
|
72
|
+
log.warning('%s in image "%s".' % (msg, name))
|
|
73
|
+
pass
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ProblemRenderer(Renderer):
|
|
80
|
+
""" Renderer for ProblemHTML documents """
|
|
81
|
+
|
|
82
|
+
fileExtension = '.html'
|
|
83
|
+
imageTypes = ['.png', '.jpg', '.jpeg', '.gif']
|
|
84
|
+
vectorImageTypes = ['.svg']
|
|
85
|
+
|
|
86
|
+
def render(self, document):
|
|
87
|
+
templatepaths = [os.path.join(os.path.dirname(__file__), '../templates/html'),
|
|
88
|
+
os.path.join(os.path.dirname(__file__), '../../templates/html'),
|
|
89
|
+
'/usr/lib/problemtools/templates/html']
|
|
90
|
+
templatepath = None
|
|
91
|
+
for p in templatepaths:
|
|
92
|
+
if os.path.isdir(p):
|
|
93
|
+
templatepath = p
|
|
94
|
+
break
|
|
95
|
+
if templatepath == None:
|
|
96
|
+
raise Exception('Could not find templates needed for conversion to HTML')
|
|
97
|
+
|
|
98
|
+
# Ugly but unfortunately PlasTeX is quite inflexible when it comes to
|
|
99
|
+
# configuring where to search for template files
|
|
100
|
+
os.environ['ProblemRendererTEMPLATES'] = templatepath
|
|
101
|
+
|
|
102
|
+
# Gigantic ugliness to cope with PlasTeX problem that prevents
|
|
103
|
+
# plastex from resetting list of invalid filenames when doing multiple renderings.
|
|
104
|
+
f = Filenames('blah.html', {}, {}, 'html')
|
|
105
|
+
f.invalid.clear()
|
|
106
|
+
|
|
107
|
+
# Setup our own mini-imager which just does copying and converts pdfs to png
|
|
108
|
+
self.imager = ImageConverter(document)
|
|
109
|
+
|
|
110
|
+
Renderer.render(self, document)
|
|
111
|
+
|
|
112
|
+
def processFileContent(self, document, s):
|
|
113
|
+
s = Renderer.processFileContent(self, document, s)
|
|
114
|
+
|
|
115
|
+
# Force XHTML syntax on empty tags
|
|
116
|
+
s = re.compile(r'(<(?:hr|br|img|link|meta)\b.*?)\s*/?\s*(>)',
|
|
117
|
+
re.I|re.S).sub(r'\1 /\2', s)
|
|
118
|
+
|
|
119
|
+
# Remove empty paragraphs
|
|
120
|
+
s = re.compile(r'<p>\s*</p>', re.I).sub(r'', s)
|
|
121
|
+
|
|
122
|
+
# Add a non-breaking space to empty table cells
|
|
123
|
+
s = re.compile(r'(<(td|th)\b[^>]*>)\s*(</\2>)', re.I).sub(r'\1 \3', s)
|
|
124
|
+
|
|
125
|
+
return s
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import plasTeX.Packages.graphics as graphics
|
|
2
|
+
from ProblemsetMacros import _graphics_command, clean_width
|
|
3
|
+
|
|
4
|
+
# Reimplementation of graphicx package because plasTeX is broken and
|
|
5
|
+
# annoying.
|
|
6
|
+
|
|
7
|
+
class includegraphics(_graphics_command):
|
|
8
|
+
args = '* [ options:dict ] file:str'
|
|
9
|
+
packageName = 'graphicx'
|
|
10
|
+
captionable = True
|
|
11
|
+
|
|
12
|
+
def invoke(self, tex):
|
|
13
|
+
res = _graphics_command.invoke(self, tex)
|
|
14
|
+
options = self.attributes['options']
|
|
15
|
+
if options is not None:
|
|
16
|
+
height = options.get('height')
|
|
17
|
+
if height is not None:
|
|
18
|
+
self.style['height'] = height
|
|
19
|
+
width = options.get('width')
|
|
20
|
+
if width is not None:
|
|
21
|
+
self.style['width'] = clean_width(width)
|
|
22
|
+
return res
|
|
23
|
+
|
|
24
|
+
class DeclareGraphicsExtensions(graphics.DeclareGraphicsExtensions):
|
|
25
|
+
packageName = 'graphicx'
|
|
26
|
+
|
|
27
|
+
class graphicspath(graphics.graphicspath):
|
|
28
|
+
packageName = 'graphicx'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import codecs
|
|
2
|
+
import os
|
|
3
|
+
from plasTeX.Base import Command
|
|
4
|
+
from plasTeX.Logging import getLogger
|
|
5
|
+
|
|
6
|
+
log = getLogger()
|
|
7
|
+
status = getLogger('status')
|
|
8
|
+
|
|
9
|
+
# (Partial) implementation of import.sty because plasTeX does not ship
|
|
10
|
+
# with an implementation. Only implement \import command which is the
|
|
11
|
+
# only one we'll use.
|
|
12
|
+
class import_sty(Command):
|
|
13
|
+
macroName = 'import'
|
|
14
|
+
args = 'dir:str file:str'
|
|
15
|
+
|
|
16
|
+
def invoke(self, tex):
|
|
17
|
+
a = self.parse(tex)
|
|
18
|
+
path = os.path.join(a['dir'], a['file'])
|
|
19
|
+
fullpath = tex.kpsewhich(path)
|
|
20
|
+
status.info(' ( %s ' % fullpath)
|
|
21
|
+
try:
|
|
22
|
+
encoding = self.config['files']['input-encoding']
|
|
23
|
+
tex.input(codecs.open(fullpath, 'r', encoding, 'replace'))
|
|
24
|
+
except (OSError, IOError):
|
|
25
|
+
log.warning('\nProblem opening file "%s"', fullpath)
|
|
26
|
+
status.info(' ) ')
|
|
27
|
+
return []
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from plasTeX.Base import Command
|
|
2
|
+
from plasTeX.Logging import getLogger
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import io
|
|
6
|
+
|
|
7
|
+
import ProblemsetMacros
|
|
8
|
+
|
|
9
|
+
log = getLogger()
|
|
10
|
+
|
|
11
|
+
# Implementation of (parts) of listingsutf8 package since PlasTeX does
|
|
12
|
+
# not have one
|
|
13
|
+
|
|
14
|
+
class lstinputlisting(Command):
|
|
15
|
+
args = '* [ options:dict ] file:str'
|
|
16
|
+
|
|
17
|
+
def read_file(self, filename):
|
|
18
|
+
data = io.open(filename, 'r', encoding='utf-8').read()
|
|
19
|
+
data = ProblemsetMacros.plastex_escape(data)
|
|
20
|
+
return data
|
|
21
|
+
|
|
22
|
+
def invoke(self, tex):
|
|
23
|
+
res = Command.invoke(self, tex)
|
|
24
|
+
basetex = self.ownerDocument.userdata['base_tex_instance']
|
|
25
|
+
f = self.attributes['file']
|
|
26
|
+
# Maybe more paths to look in?
|
|
27
|
+
paths = [os.path.dirname(basetex.filename)]
|
|
28
|
+
# Locate file
|
|
29
|
+
for p in paths:
|
|
30
|
+
fname = os.path.join(p, f)
|
|
31
|
+
if os.path.isfile(fname):
|
|
32
|
+
self.attributes['data'] = self.read_file(fname)
|
|
33
|
+
break
|
|
34
|
+
if 'data' not in self.attributes:
|
|
35
|
+
log.warning('Problem opening file "%s"', f)
|
|
36
|
+
|
|
37
|
+
# TODO: handle language param in options
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from plasTeX.Base.LaTeX.FontSelection import TextCommand
|
|
2
|
+
|
|
3
|
+
class uline(TextCommand): pass
|
|
4
|
+
class uuline(TextCommand): pass
|
|
5
|
+
class uwave(TextCommand): pass
|
|
6
|
+
class sout(TextCommand): pass
|
|
7
|
+
class xout(TextCommand): pass
|
|
8
|
+
class dashuline(TextCommand): pass
|
|
9
|
+
class dotuline(TextCommand): pass
|
|
10
|
+
|
|
11
|
+
|