diff --git a/scraibe/docx_cover.py b/scraibe/docx_cover.py index 180f978..5edaeda 100644 --- a/scraibe/docx_cover.py +++ b/scraibe/docx_cover.py @@ -2,12 +2,11 @@ Cover-page generator for transcript and summary DOCX files. Layout (all centered): -- 5 blank lines - 3 blank lines - Title in uppercase: "TRANSCRIPT" or "SUMMARY" - Next line: date of transcription (e.g. "June 19, 2026") -- Next line: "Created by " -- 3 blank lines +- Next line: "Transcribed by " +- 2 blank lines - Disclaimer (underlined) - Page break (ensures content starts on page 2) @@ -76,9 +75,6 @@ def add_cover_page( if not provided, uses current server time in SERVER_TIMEZONE. """ - # 5 blank lines - _add_blank_lines(doc, 5) - # 3 blank lines _add_blank_lines(doc, 3) @@ -92,13 +88,13 @@ def add_cover_page( date_str = now.strftime("%B %d, %Y") _add_centered_paragraph(doc, text=date_str, font_size=Pt(14)) - # Created by + organization + # Transcribed by + organization org = (os.getenv("COVER_PAGE_ORGANIZATION") or "").strip() if org: - _add_centered_paragraph(doc, text=f"Created by {org}", font_size=Pt(12)) + _add_centered_paragraph(doc, text=f"Transcribed by {org}", font_size=Pt(12)) - # 3 blank lines - _add_blank_lines(doc, 3) + # 2 blank lines + _add_blank_lines(doc, 2) # Disclaimer: only the word "Disclaimer" is underlined disclaimer_title = "Disclaimer" @@ -107,7 +103,7 @@ def add_cover_page( ) # Underlined "Disclaimer" line - p = _add_centered_paragraph(doc, text=disclaimer_title, font_size=Pt(10), underline=True) + _add_centered_paragraph(doc, text=disclaimer_title, font_size=Pt(10), underline=True) # Body text (not underlined) _add_centered_paragraph(doc, text=disclaimer_body, font_size=Pt(10), underline=False) diff --git a/scraibe/email_sender.py b/scraibe/email_sender.py index 6d09533..e5e531c 100644 --- a/scraibe/email_sender.py +++ b/scraibe/email_sender.py @@ -523,20 +523,9 @@ def create_transcript_docx(text: str, filename: str, summary_text: str = ""): # Step 4: Write prepared pages into DOCX for page_idx, page_lines in enumerate(prepared_pages): - # Write each line with its number (1-30) + # Write each line with its number (1-29) for line_num, line_text in enumerate(page_lines, start=1): - p = doc.add_paragraph() _add_transcript_paragraph(doc, line_text, line_number=line_num) - # Remove the extra paragraph added by add_paragraph (we already added runs) - # _add_transcript_paragraph already creates its own paragraph, so we need to avoid duplication. - # Correct approach: _add_transcript_paragraph should add to doc, not p. - # To avoid breaking existing behavior, keep _add_transcript_paragraph as-is - # and remove the temporary paragraph we just added. - # This is an internal fix to ensure page break logic is clean. - # We'll rely on _add_transcript_paragraph creating its own paragraph. - # To avoid an extra blank paragraph, we remove p if it has no runs. - if not p.runs: - body.remove(p._p) # After each page except the last, add a page break via next paragraph if page_idx < len(prepared_pages) - 1: