Write a single entry to a YAML file.
(entry: ChangeEntry, slug: str, output_dir: Path)
| 611 | |
| 612 | @staticmethod |
| 613 | def write_entry(entry: ChangeEntry, slug: str, output_dir: Path): |
| 614 | """Write a single entry to a YAML file.""" |
| 615 | # Ensure output directory exists |
| 616 | output_dir.mkdir(parents=True, exist_ok=True) |
| 617 | |
| 618 | filename = f"{slug}.yml" |
| 619 | filepath = output_dir / filename |
| 620 | |
| 621 | # Convert entry to dictionary and write as YAML |
| 622 | entry_dict = entry.to_dict() |
| 623 | |
| 624 | with open(filepath, 'w', encoding='utf-8') as f: |
| 625 | # Use custom YAML dumper for better formatting |
| 626 | yaml.dump( |
| 627 | entry_dict, |
| 628 | f, |
| 629 | default_flow_style=False, |
| 630 | sort_keys=False, |
| 631 | allow_unicode=True, |
| 632 | width=80 # Line width for better readability |
| 633 | ) |
| 634 | |
| 635 | return filepath |
| 636 | |
| 637 | |
| 638 | class ReleaseDate: |
no test coverage detected