diff --git a/README.md b/README.md index 430db33..f0b9f3d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you have an idea for a generator, please add it as an issue and tag it with t ## Table of Contents * [Installation](#installation) * [Basic Usage](#basic-usage) - * [More Complicated Usage](#more-complicated-usage) + * [Creating a worksheet](#more-complicated-usage) * [Documentation](#documentation) * [List of Generators](#list-of-generators) * [algebra](#algebra) @@ -41,17 +41,20 @@ problem, solution = mathgen.addition() #another way to generate an addition problem using genById() problem, solution = mathgen.genById(0) ``` -### More Complicated Usage - +### Creating a worksheet +If you wish to create a worksheet, you can use the `worksheetgen` package. Install this with `pip install worksheetgen`. Here is an example of how a worksheet would be generated. ``` -import sys from mathgenerator import mathgen +from worksheetgen.wg import Worksheet -worksheet = mathgen.make_worksheet("2020-11-29") -mathgen.add_section_with_task_to_worksheet(worksheet, 105, 5) -mathgen.add_section_with_task_to_worksheet(worksheet, 2, 5) -mathgen.write_pdf(worksheet) +worksheet = Worksheet("Worksheet title") +worksheet.add_instruction("Instructions") +# Writes 10 problems generated with id 1, [0] at the end specifies to take problem, and not solution. +for _ in range(10): + worksheet.add_problem(mathgen.genById(1)[0]) +worksheet.write_pdf() ``` +This creates the pdf `ws.pdf` in your current directory ## Documentation * `getGenList()` returns a list of all generators in the repository in the format `[id, title, self, funcname, subjectname]` diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 55c1839..de0b45b 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -9,34 +9,3 @@ genList = getGenList() def genById(id, *args, **kwargs): generator = genList[id][2] return (generator(*args, **kwargs)) - - -def make_worksheet(title): - return Worksheet(title=title) - - -def write_pdf(worksheet): - worksheet.write_pdf() - - -def add_section_title(worksheet, task_id): - title = genList[task_id][1] - worksheet.add_instruction(title) - - -def add_task_to_worksheet(worksheet, task_id, count): - generator = genList[task_id][2] - for i in range(count): - worksheet.add_problem(generator()[0]) - - -def add_section_with_task_to_worksheet(worksheet, task_id, count): - add_section_title(worksheet, task_id) - add_task_to_worksheet(worksheet, task_id, count) - - -def make_pdf(task_id, count): - title = genList[task_id][1] - worksheet = make_worksheet(title) - add_task_to_worksheet(worksheet, task_id, count) - write_pdf(worksheet) diff --git a/setup.py b/setup.py index 78276f7..e4873c5 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ from setuptools import setup, find_packages setup(name='mathgenerator', - version='1.1.12', + version='1.1.13', description='An open source solution for generating math problems', url='https://github.com/lukew3/mathgenerator', author='Luke Weiler', author_email='lukew25073@gmail.com', license='MIT', packages=find_packages(), - install_requires=['sympy', 'numpy', 'scipy', 'worksheetgen'], + install_requires=['sympy', 'numpy', 'scipy'], entry_points={}) diff --git a/ws.pdf b/ws.pdf deleted file mode 100644 index 24b9401..0000000 Binary files a/ws.pdf and /dev/null differ