Removed worksheet generation from the scope of this package

This commit is contained in:
lukew3
2021-02-21 13:14:13 -05:00
parent 0df6f15899
commit e92b44c7d8
4 changed files with 13 additions and 41 deletions

View File

@@ -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]`

View File

@@ -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)

View File

@@ -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={})

BIN
ws.pdf

Binary file not shown.