document_generator.py reads structured JSON output from ask and converts it to professionally formatted DOCX files for CV and cover letter.
Language: Python 3 (442 lines)Library: python-docx (for DOCX generation)Input: JSON file (parsed as YAML due to compatibility)Output: Two DOCX files (CV and cover letter)Formatting: Narrow margins (0.5 inches), Calibri 10.5pt, tight spacing
load_data(filename) - Read JSON/YAML filesetup_document() - Create DOCX with standard formattingadd_markdown_paragraph() - Add text with bold supportadd_hyperlink() - Add clickable links to paragraphsgenerate_cv() - Generate CV from cv section of JSONgenerate_cover_letter() - Generate cover letter from cover_letter section
Margins: 0.5 inches all sides (maximum content area)Font: Calibri 10.5pt (default)Spacing: Minimal (Pt(2) between paragraphs) to fit on pageHyperlinks: Styled with underlineLists: Bullet points supported via python-docx List Bullet style
Very limited Markdown parsing: bold text onlyImplementation: Text split on '**', alternating parts are boldedUsage: In professional_summary, bullet points, paragraphs
Skips CV generation if no cv section in JSONSkips cover letter generation if no cover_letter sectionGracefully handles missing optional fields (education, certifications, etc.)File paths from JSON filename fields define output locations
python3 document_generator.py <json_file>Example: python3 document_generator.py job_application.jsonGenerates:• File at path from cv.filename field• File at path from cover_letter.filename field