Update app.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,7 @@ def generate_release_notes(github_repo, github_token, gemini_api_key, start_date
|
|
| 40 |
- Do not use any Markdown syntax (*, #, `, etc.)
|
| 41 |
- Use plain text only
|
| 42 |
- For section headers, simply use the text as is (e.g., "New Features:")
|
| 43 |
-
- For list items, use
|
| 44 |
-
- Do not use multiple bullet points or numbers for a single item
|
| 45 |
- Keep the text structure simple and easy to convert to a Word document format
|
| 46 |
"""
|
| 47 |
|
|
@@ -51,16 +50,18 @@ def generate_release_notes(github_repo, github_token, gemini_api_key, start_date
|
|
| 51 |
doc = docx.Document()
|
| 52 |
doc.add_heading('Release Notes', 0)
|
| 53 |
|
|
|
|
| 54 |
for line in release_notes.split('\n'):
|
| 55 |
line = line.strip()
|
| 56 |
if line.endswith(':'):
|
| 57 |
doc.add_heading(line, level=1)
|
| 58 |
-
|
| 59 |
-
# Remove extra bullet points if present
|
| 60 |
-
cleaned_line = re.sub(r'^•+\s*', '• ', line)
|
| 61 |
-
doc.add_paragraph(cleaned_line, style='List Bullet')
|
| 62 |
elif line:
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
temp_file = "release_notes.docx"
|
| 66 |
doc.save(temp_file)
|
|
|
|
| 40 |
- Do not use any Markdown syntax (*, #, `, etc.)
|
| 41 |
- Use plain text only
|
| 42 |
- For section headers, simply use the text as is (e.g., "New Features:")
|
| 43 |
+
- For list items, do not use any bullet points or numbers. Start each item directly with the text.
|
|
|
|
| 44 |
- Keep the text structure simple and easy to convert to a Word document format
|
| 45 |
"""
|
| 46 |
|
|
|
|
| 50 |
doc = docx.Document()
|
| 51 |
doc.add_heading('Release Notes', 0)
|
| 52 |
|
| 53 |
+
current_list_style = None
|
| 54 |
for line in release_notes.split('\n'):
|
| 55 |
line = line.strip()
|
| 56 |
if line.endswith(':'):
|
| 57 |
doc.add_heading(line, level=1)
|
| 58 |
+
current_list_style = None
|
|
|
|
|
|
|
|
|
|
| 59 |
elif line:
|
| 60 |
+
if current_list_style is None:
|
| 61 |
+
current_list_style = doc.add_paragraph().style
|
| 62 |
+
current_list_style.name = 'List Bullet'
|
| 63 |
+
current_list_style.font.size = docx.shared.Pt(11)
|
| 64 |
+
doc.add_paragraph(line, style=current_list_style)
|
| 65 |
|
| 66 |
temp_file = "release_notes.docx"
|
| 67 |
doc.save(temp_file)
|