-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/columns sizing options #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
754e9d6
7d54d3b
aa50292
b19025d
ffe6318
43b3881
009b797
4c63767
b3c468c
65359c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,17 +36,26 @@ def get_classes(request): | |
| def generate_sheet(request): | ||
| """ | ||
| POST /api/generate-sheet/ | ||
| Accepts { "formulas": [...] } | ||
| Accepts { "formulas": [...], "columns": 2, "font_size": "10pt", "margins": "0.25in", "spacing": "large" } | ||
| Each formula: { "class": "ALGEBRA I", "category": "Linear Equations", "name": "Slope Formula" } | ||
| Or for special classes (like UNIT CIRCLE): { "class": "UNIT CIRCLE", "name": "Unit Circle (Key Angles)" } | ||
| Returns { "tex_code": "..." } | ||
| """ | ||
| selected = request.data.get("formulas", []) | ||
| columns = request.data.get("columns", 2) | ||
| font_size = request.data.get("font_size", "10pt") | ||
| margins = request.data.get("margins", "0.25in") | ||
| spacing = request.data.get("spacing", "large") | ||
|
Comment on lines
+45
to
+48
|
||
|
|
||
| if not selected: | ||
| return Response({"error": "No formulas selected"}, status=400) | ||
|
|
||
| # Get formula details from formula_data | ||
| try: | ||
| columns = int(columns) | ||
| except (TypeError, ValueError): | ||
| columns = 2 | ||
| columns = max(1, min(3, columns)) | ||
|
|
||
| formula_data = get_formula_data() | ||
| selected_formulas = [] | ||
|
|
||
|
|
@@ -55,14 +64,12 @@ def generate_sheet(request): | |
| category = sel.get("category") | ||
| name = sel.get("name") | ||
|
|
||
| # Check if this is a special class (no categories) | ||
| if is_special_class(class_name): | ||
| # Get the formula directly for special classes | ||
| formula = get_special_class_formula(class_name) | ||
| if formula: | ||
| selected_formulas.append({ | ||
| "class_name": class_name, | ||
| "category": class_name, # Use class name as category for special | ||
| "category": class_name, | ||
| "name": formula["name"], | ||
| "latex": formula["latex"] | ||
| }) | ||
|
|
@@ -82,7 +89,7 @@ def generate_sheet(request): | |
| if not selected_formulas: | ||
| return Response({"error": "No valid formulas found"}, status=400) | ||
|
|
||
| tex_code = build_latex_for_formulas(selected_formulas) | ||
| tex_code = build_latex_for_formulas(selected_formulas, columns, font_size, margins, spacing) | ||
| return Response({"tex_code": tex_code}) | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UI exposes “Text Size (10pt)” options, but
FONT_SIZE_MAPmaps"10pt"to\footnotesize(and"12pt"to\normalsize). Combined with\documentclass[{font_size}], this likely makes the effective font smaller than the selected size and makes the labels misleading. Consider mapping10pt -> \normalsize(and scaling others accordingly), or relabeling the UI to match the actual density preset.