Skip to content

Commit 07d0ac4

Browse files
authored
🐛 update formatting to support again multi-line descriptions (#151)
* 🚧 update formatting logic for long description - update tests once the relative imports are updated * 🐛 remove typo in update shell script * 🚧 update streamlit tests 🐛 Centering does not work for text after a blank line * 🎨 remove unnecesary identation - less confusing handling of files.
1 parent 01dd9c5 commit 07d0ac4

File tree

32 files changed

+466
-351
lines changed

32 files changed

+466
-351
lines changed

bin/update_test_reports.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
§set -e
1+
set -e
22
vuegen -dir docs/example_data/Basic_example_vuegen_demo_notebook -output_dir tests/report_examples/Basic_example_vuegen_demo_notebook
33

44
vuegen -dir docs/example_data/Basic_example_vuegen_demo_notebook -output_dir tests/report_examples/Basic_example_vuegen_demo_notebook/html -rt html
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
A general description of the report.
1+
A general description of the report.
2+
3+
It should test all major components which are available
4+
to be integrated into VueGen.
5+
6+
Check our tests folder for examples of report files used to generate actual reports.

src/vuegen/config_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _read_description_file(self, folder_path: Path) -> str:
211211
"""
212212
description_file = folder_path / "description.md"
213213
if description_file.exists():
214-
ret = description_file.read_text().strip().replace("\n", "\n ")
214+
ret = description_file.read_text().strip()
215215
return f"{ret}\n"
216216
return ""
217217

src/vuegen/quarto_reportview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def generate_report(self, output_dir: Optional[Path] = None) -> None:
129129

130130
# Add description of the report
131131
if self.report.description:
132-
qmd_content.append(f"""{self.report.description}""")
132+
qmd_content.append(self.report.description)
133133

134134
# If available add the graphical abstract
135135
if self.report.graphical_abstract:

src/vuegen/streamlit_reportview.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,17 +424,19 @@ def _format_text(
424424
)
425425

426426
text = text.strip() # get rid of new lines
427-
428-
return textwrap.dedent(
429-
f"""
427+
text = textwrap.indent(text, " ")
428+
ret = textwrap.dedent(
429+
f"""\
430430
st.markdown(
431-
(
432-
"<{tag} style='text-align: {text_align}; "
433-
"color: {color};'>{text}</{tag}>"
434-
),
431+
'''
432+
<{tag} style='text-align: {text_align};
433+
color: {color};'>\n{text}
434+
</{tag}>
435+
''',
435436
unsafe_allow_html=True)
436437
"""
437438
)
439+
return ret
438440

439441
def _generate_home_section(
440442
self,

tests/report_examples/Basic_example_vuegen_demo_notebook/docx/quarto_report/quarto_report.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ report_dir = Path().cwd()
2727

2828
A general description of the report.
2929

30+
It should test all major components which are available
31+
to be integrated into VueGen.
32+
33+
Check our tests folder for examples of report files used to generate actual reports.
34+
3035
![](../../../../../docs/example_data/Basic_example_vuegen_demo_notebook/home_image.png){fig-alt= width=90%}
3136

3237
# Plots

tests/report_examples/Basic_example_vuegen_demo_notebook/html/quarto_report/quarto_report.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ report_dir = Path().cwd()
5353

5454
A general description of the report.
5555

56+
It should test all major components which are available
57+
to be integrated into VueGen.
58+
59+
Check our tests folder for examples of report files used to generate actual reports.
60+
5661
![](../../../../../docs/example_data/Basic_example_vuegen_demo_notebook/home_image.png){fig-alt= width=90%}
5762

5863
# Plots

tests/report_examples/Basic_example_vuegen_demo_notebook/jupyter/quarto_report/quarto_report.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ report_dir = Path().cwd()
5353

5454
A general description of the report.
5555

56+
It should test all major components which are available
57+
to be integrated into VueGen.
58+
59+
Check our tests folder for examples of report files used to generate actual reports.
60+
5661
![](../../../../../docs/example_data/Basic_example_vuegen_demo_notebook/home_image.png){fig-alt= width=90%}
5762

5863
# Plots

tests/report_examples/Basic_example_vuegen_demo_notebook/odt/quarto_report/quarto_report.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ report_dir = Path().cwd()
2727

2828
A general description of the report.
2929

30+
It should test all major components which are available
31+
to be integrated into VueGen.
32+
33+
Check our tests folder for examples of report files used to generate actual reports.
34+
3035
![](../../../../../docs/example_data/Basic_example_vuegen_demo_notebook/home_image.png){fig-alt= width=90%}
3136

3237
# Plots

tests/report_examples/Basic_example_vuegen_demo_notebook/pdf/quarto_report/quarto_report.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ report_dir = Path().cwd()
3939

4040
A general description of the report.
4141

42+
It should test all major components which are available
43+
to be integrated into VueGen.
44+
45+
Check our tests folder for examples of report files used to generate actual reports.
46+
4247
![](../../../../../docs/example_data/Basic_example_vuegen_demo_notebook/home_image.png){fig-alt= width=90%}
4348

4449
# Plots

0 commit comments

Comments
 (0)