JSenkCC commited on
Commit
daa8c1e
·
verified ·
1 Parent(s): e9cae80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -356,8 +356,7 @@ def generate_detailed_documentation(file_contents, functionality_description):
356
  '
357
  Functionality Flow:
358
  <Explain the sequence of functions and data flow. If there are multiple initial input points required for the user-defined functionality, show the flow of each one.
359
- An example flow description is: 1. User enters 3. 2. foo(3) is called. 3. foo(3) calls bar() and fubar(3) to return a list filled with... 7. dubar(97) returns 'yes' to the user
360
- make sure there is no empty line between 'Functionality Flow:' and what is to be placed in this section>
361
  '
362
  4. Generate detailed documentation for each function in the codebase:
363
  '
@@ -511,18 +510,20 @@ def generate_pdf(documentation):
511
  pdf = FPDF()
512
  pdf.set_auto_page_break(auto=True, margin=15)
513
  pdf.add_page()
514
- pdf.set_font("Arial", size=12)
515
 
516
  # Add headers and content
517
  for line in documentation.splitlines():
518
- if line.startswith("Project Summary:") or line.startswith("Functionality Summary:") or \
 
 
 
519
  line.startswith("Functionality Flow:") or line.startswith("Function Documentation:"):
520
- pdf.set_font("Arial", style="B", size=14)
521
- elif line.startswith("*") or line.startswith("- **Function**"):
522
- pdf.set_font("Arial", style="B", size=12)
523
  else:
524
- pdf.set_font("Arial", size=12)
525
- pdf.multi_cell(0, 10, line)
526
 
527
  # Save and download the PDF
528
  pdf_file = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
 
356
  '
357
  Functionality Flow:
358
  <Explain the sequence of functions and data flow. If there are multiple initial input points required for the user-defined functionality, show the flow of each one.
359
+ make sure to have no empty line between 'Functionality Flow' and this content>
 
360
  '
361
  4. Generate detailed documentation for each function in the codebase:
362
  '
 
510
  pdf = FPDF()
511
  pdf.set_auto_page_break(auto=True, margin=15)
512
  pdf.add_page()
513
+ pdf.set_font("Courier", size=12) # Use Courier for an IDE-like font
514
 
515
  # Add headers and content
516
  for line in documentation.splitlines():
517
+ if line.startswith("- '") and line.endswith("':"):
518
+ pdf.set_font("Courier", style="B", size=12) # Bold for specific lines
519
+ pdf.multi_cell(0, 10, line)
520
+ elif line.startswith("Project Summary:") or line.startswith("Functionality Summary:") or \
521
  line.startswith("Functionality Flow:") or line.startswith("Function Documentation:"):
522
+ pdf.set_font("Courier", style="B", size=14) # Bold larger headers
523
+ pdf.multi_cell(0, 10, line)
 
524
  else:
525
+ pdf.set_font("Courier", size=12) # Regular for other lines
526
+ pdf.multi_cell(0, 10, line)
527
 
528
  # Save and download the PDF
529
  pdf_file = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")