From cde4a73867a65eb4ecea664e55e08e4af6204f75 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 6 Oct 2021 23:19:57 -0400 Subject: [PATCH] add templates to funcs --- mathgenerator/funcs/template.py | 19 ++++++++++++++++++ mathgenerator/funcs/template_comments.py | 25 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 mathgenerator/funcs/template.py create mode 100644 mathgenerator/funcs/template_comments.py diff --git a/mathgenerator/funcs/template.py b/mathgenerator/funcs/template.py new file mode 100644 index 0000000..eddf71b --- /dev/null +++ b/mathgenerator/funcs/template.py @@ -0,0 +1,19 @@ +from .__init__ import * + + +def gen_func(format='string'): + + + if format == 'string': + + return problem, solution + elif format == 'latex': + + return 'Latex unavailable' + else: + + return + + +generator_name = Generator("", id, gen_func, + ["<kwarg1>"]) diff --git a/mathgenerator/funcs/template_comments.py b/mathgenerator/funcs/template_comments.py new file mode 100644 index 0000000..d18aad6 --- /dev/null +++ b/mathgenerator/funcs/template_comments.py @@ -0,0 +1,25 @@ +from .__init__ import * + + +def gen_func(format='string'): + # your generator code goes here + + if format == 'string': + # code that generates problem, solution strings goes here + return problem, solution + elif format == 'latex': + # code that generates latex representation of problem, and solution goes here + # if you can't do this, leave the return 'Latex unavailable' + #return latex_problem, latex_solution + return 'Latex unavailable' + else: + # Return necessary variables here + # Any variables that go into the problem and solution string without formatting + return a, b + +# generator_name should be the same as the file name +# id can be generated by running nextId.py inside of the scripts folder +# last argument of Generator should be a list of the kwargs used in your gen_func(). +generator_name = Generator("<Title>", <id>, gen_func, + ["<kwarg1>"]) +# Delete all comments before submitting a pr