Loading src/coliverter/FileFormat.py 0 → 100644 +6 −0 Original line number Diff line number Diff line from enum import StrEnum, auto class FileFormat(StrEnum): HTML = auto() PDF = auto() src/coliverter/app.py +15 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ from typing import Annotated import typer from coliverter.FileFormat import FileFormat app = typer.Typer() Loading @@ -20,9 +22,21 @@ def main( help="Path to the output file. If None, write output to STDOUT." ), ] = None, file_format: Annotated[ FileFormat | None, typer.Option( help="Format of the output file. If None, infer from extension in output path. If inferring is not possible, default to html." ), ] = None, ) -> None: """ Convert Markdown files into other formats, using the organization identity of Fachschaft Computerlinguistik. """ if file_format is None: try: file_format = FileFormat[output_path.suffix if output_path else None] except KeyError: file_format = FileFormat.HTML # TODO Implement this print(markdown_path, output_path) print(markdown_path, output_path, file_format) Loading
src/coliverter/FileFormat.py 0 → 100644 +6 −0 Original line number Diff line number Diff line from enum import StrEnum, auto class FileFormat(StrEnum): HTML = auto() PDF = auto()
src/coliverter/app.py +15 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ from typing import Annotated import typer from coliverter.FileFormat import FileFormat app = typer.Typer() Loading @@ -20,9 +22,21 @@ def main( help="Path to the output file. If None, write output to STDOUT." ), ] = None, file_format: Annotated[ FileFormat | None, typer.Option( help="Format of the output file. If None, infer from extension in output path. If inferring is not possible, default to html." ), ] = None, ) -> None: """ Convert Markdown files into other formats, using the organization identity of Fachschaft Computerlinguistik. """ if file_format is None: try: file_format = FileFormat[output_path.suffix if output_path else None] except KeyError: file_format = FileFormat.HTML # TODO Implement this print(markdown_path, output_path) print(markdown_path, output_path, file_format)