Skip to content

Commit

Permalink
Allow different XLSX builders.
Browse files Browse the repository at this point in the history
Allow for specifying a builder class for XLSX output in the document definitions.
  • Loading branch information
fniessink committed Nov 27, 2024
1 parent c7dd0fd commit a67b0b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
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

0 comments on commit a67b0b1

Please sign in to comment.