Skip to content

Commit b9583ec

Browse files
committed
🐛 handle single descripton.md files
⚠️ duplicated code - description files are parsed by configuration_manager - skipped for section content. So a section can have content, which is not used - a single description.md file
1 parent 0f39cf9 commit b9583ec

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

src/vuegen/quarto_reportview.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,27 @@ def generate_report(self, output_dir: Path = BASE_DIR) -> None:
127127
# ? Do we need to handle overview separately?
128128
main_section = self.report.sections[0]
129129

130+
# ! description can be a Markdown component, but it is treated differently
131+
# ! It won't be added to the section content.
130132
if main_section.components:
131133
self.report.logger.debug(
132134
"Adding components of main section folder to the report as overall overview."
133135
)
134-
qmd_content.append("# General Overview")
135-
if is_report_revealjs:
136-
qmd_content.append("::: {.panel-tabset}\n")
137136
section_content, section_imports = self._combine_components(
138137
main_section.components
139138
)
140-
qmd_content.extend(section_content)
141-
if is_report_revealjs:
142-
qmd_content.append(":::\n")
139+
if section_content:
140+
qmd_content.append("# General Overview")
141+
142+
if is_report_revealjs:
143+
# Add tabset for revealjs
144+
section_content = [
145+
"::: {.panel-tabset}\n",
146+
*section_content,
147+
":::",
148+
]
149+
qmd_content.extend(section_content)
150+
143151
report_imports.extend(section_imports)
144152

145153
# Add the sections and subsections to the report
@@ -154,21 +162,28 @@ def generate_report(self, output_dir: Path = BASE_DIR) -> None:
154162
qmd_content.append(f"""{section.description}\n""")
155163

156164
# Add components of section to the report
165+
# ! description can be a Markdown component, but it is treated differently
166+
# ! It won't be added to the section content.
157167
if section.components:
158168
self.report.logger.debug(
159169
"Adding components of section folder to the report."
160170
)
161-
qmd_content.append(f"## Overview {section.title}".strip())
162-
163-
if is_report_revealjs:
164-
qmd_content.append("::: {.panel-tabset}\n")
165171
section_content, section_imports = self._combine_components(
166172
section.components
167173
)
168-
qmd_content.extend(section_content)
174+
if section_content:
175+
qmd_content.append(f"## Overview {section.title}".strip())
176+
177+
if is_report_revealjs:
178+
# Add tabset for revealjs
179+
section_content = [
180+
"::: {.panel-tabset}\n",
181+
*section_content,
182+
":::",
183+
]
184+
qmd_content.extend(section_content)
185+
169186
report_imports.extend(section_imports)
170-
if is_report_revealjs:
171-
qmd_content.append(":::\n")
172187

173188
if section.subsections:
174189
# Iterate through subsections and integrate them into the section file

0 commit comments

Comments
 (0)