Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow different XLSX builders. #985

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DocumentDefinitions/kwaliteitsaanpak.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"ReferenceFile": "DocumentDefinitions/reference-ictu.docx"
},
"xlsx": {
"BuilderClass": "SelfAssessmentXlsxBuilder",
"OutputFile": "ICTU-Kwaliteitsaanpak-Checklist.xlsx",
"OutputPaths": [
"docs/$VERSIE$"
Expand Down
2 changes: 1 addition & 1 deletion src/builder/xlsx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .builder import Builder


class XlsxBuilder(Builder):
class SelfAssessmentXlsxBuilder(Builder):
"""Self-assessment builder."""

MEASURE_ID_COLUMN, MEASURE_COLUMN, STATUS_COLUMN, EXPLANATION_COLUMN = range(4)
Expand Down
5 changes: 3 additions & 2 deletions src/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

from cli import parse_cli_arguments
from converter import Converter
from builder import xlsx_builder as xlsx_builder_module
from builder.docx_builder import DocxBuilder
from builder.html_builder import HTMLBuilder
from builder.pptx_builder import PptxBuilder
from builder.xlsx_builder import XlsxBuilder
from markdown_converter import MarkdownConverter
from markdown_syntax import VARIABLE_USE_PATTERN
from custom_types import JSON, Settings, Variables
Expand Down Expand Up @@ -130,7 +130,8 @@ def convert_xlsx(converter, settings: Settings) -> None:
"""Convert the XML to xlsx."""
build_path = get_build_path(settings)
xlsx_build_filename = build_path / settings["OutputFormats"]["xlsx"]["OutputFile"]
xlsx_builder = XlsxBuilder(xlsx_build_filename)
xlsx_builder_class_name = settings["OutputFormats"]["xlsx"]["BuilderClass"]
xlsx_builder = getattr(xlsx_builder_module, xlsx_builder_class_name)(xlsx_build_filename)
converter.convert(xlsx_builder)
copy_output(xlsx_build_filename, settings, "xlsx")

Expand Down