Skip to content

Commit a89278a

Browse files
committed
Generate image reference for results
1 parent 4014467 commit a89278a

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

COMMANDS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ which is included in the pipeline [code-structure-analysis.yml](.github/workflow
140140
./../scripts/documentation/generateJupyterReportReference.sh
141141
```
142142
143+
### Generate Image Reference
144+
145+
Change into the [results](./results/) directory e.g. with `cd results` and then execute the script [generateImageReference.sh](./scripts/documentation/generateImageReference.sh) with the following command:
146+
147+
👉**Note:** This script is automatically triggered at the end of [copyReportsIntoResults.sh](./scripts/copyReportsIntoResults.sh)
148+
which is included in the pipeline [code-structure-analysis.yml](.github/workflows/code-structure-analysis.yml) and doesn't need to be executed manually normally.
149+
150+
```script
151+
./../scripts/documentation/generateImageReference.sh
152+
```
153+
143154
### Generate Environment Variable Reference
144155

145156
Change into the [scripts](./scripts/) directory e.g. with `cd scripts` and then execute the script [generateEnvironmentVariableReference.sh](./scripts/documentation/generateEnvironmentVariableReference.sh) with the following command:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ The [Code Structure Analysis Pipeline](./.github/workflows/code-structure-analys
8585

8686
[JUPYTER_REPORTS.md](./results/JUPYTER_REPORTS.md) lists all Jupyter Notebook reports inside the [results](./results) directory. It can be generated as described in [Generate Jupyter Notebook Report Reference](./COMMANDS.md#generate-jupyter-notebook-report-reference).
8787

88+
## 📈 Image Reference
89+
90+
[IMAGES.md](./results/IMAGES.md) lists all PNG images inside the [results](./results) directory. It can be generated as described in [Generate Image Reference](./COMMANDS.md#generate-image-reference).
91+
8892
## ⚙️ Script Reference
8993

9094
[SCRIPTS.md](./scripts/SCRIPTS.md) lists all shell scripts of this repository including their first comment line as a description. It can be generated as described in [Generate Script Reference](./COMMANDS.md#generate-script-reference).

scripts/copyReportsIntoResults.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@ done
4444
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateJupyterReportReference.sh")
4545

4646
# Generate CSV_REPORTS.md containing a reference to all CSV cypher query reports in the "results" directory and its subdirectories.
47-
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateCsvReportReference.sh")
47+
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateCsvReportReference.sh")
48+
49+
# Generate IMAGES.md containing a reference to all PNG images in the "results" directory and its subdirectories.
50+
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateImageReference.sh")
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
# Generates "IMAGES.md" containing a reference to all images (PNG) in this directory and its subdirectories.
4+
5+
# Markdown file name
6+
markdown_file="IMAGES.md"
7+
8+
{
9+
echo "# Image Reference"
10+
echo ""
11+
echo "This document serves as a reference for all images (PNG) in the current directory and its subdirectories."
12+
echo "It provides a table listing each file and the analysis it belongs to."
13+
echo "This file was generated with the script [generateImageReference.sh](./../scripts/documentation/generateImageReference.sh)."
14+
echo ""
15+
echo "Image | Analysis |"
16+
echo "-------|----------|"
17+
} > ${markdown_file}
18+
19+
# Loop through all Markdown files in the current directory
20+
find . -type f -name "*.png" | sort | while read -r image_file; do
21+
# Trim leading and trailing whitespace
22+
description=$(echo "${description}" | awk '{$1=$1;print}')
23+
24+
# Extract the script file name without the path
25+
filename=$(basename "$image_file")
26+
27+
if [ "$filename" = "${markdown_file}" ]; then
28+
continue
29+
fi
30+
31+
# Extract the script file path without the name
32+
pathname=$(dirname "$image_file")
33+
34+
# Extract the second part of the path after ./ that contains the analysis directory name
35+
analysisname=$(echo "${pathname}" | cut -d/ -f2)
36+
37+
# Create a link to the script file in the table
38+
link="[${filename}](${image_file})"
39+
40+
# Add the script file and its description to the Markdown table
41+
echo "| ${link} | ${analysisname%%.} |" >> ${markdown_file}
42+
done

0 commit comments

Comments
 (0)