Skip to content

Commit 3eedafd

Browse files
committed
Better folder structure
1 parent 334a93d commit 3eedafd

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

.github/scripts/disable-showlink.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44

55
cd charts
66

7-
for file in *.html; do
8-
# Skip index.html
9-
if [ "$file" = "index.html" ]; then
10-
continue
11-
fi
12-
7+
# Find all HTML files recursively, excluding index.html
8+
find . -name "*.html" ! -name "index.html" | while read -r file; do
139
# Check if file exists and is not empty
1410
if [ ! -f "$file" ] || [ ! -s "$file" ]; then
1511
continue

.github/scripts/generate-index.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ cat > index.html << 'EOF'
201201
EOF
202202

203203
# Find all HTML files except index.html and add them to the page
204-
html_files=$(find . -maxdepth 1 -name "*.html" ! -name "index.html" | sort)
204+
html_files=$(find . -name "*.html" ! -name "index.html" | sort)
205205

206206
if [ -z "$html_files" ]; then
207207
cat >> index.html << 'EOF'
@@ -213,22 +213,24 @@ if [ -z "$html_files" ]; then
213213
EOF
214214
else
215215
for file in $html_files; do
216+
# Remove leading ./ from path
217+
relative_path="${file#./}"
216218
filename=$(basename "$file")
217-
# URL encode the filename for use in href attributes
219+
# URL encode the path for use in href attributes
218220
# This handles special characters like spaces, %, etc.
219-
encoded_filename=$(printf '%s' "$filename" | jq -sRr @uri)
221+
encoded_path=$(printf '%s' "$relative_path" | jq -sRr @uri)
220222
# Convert filename to readable title (remove .html, replace hyphens/underscores with spaces, capitalize)
221223
# Also decode any URL-encoded characters for the display title
222224
decoded_filename=$(printf '%s' "$filename" | sed 's/%20/ /g' | sed 's/%/ /g')
223225
title=$(echo "$decoded_filename" | sed 's/.html$//' | sed 's/[-_]/ /g' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1')
224226

225227
cat >> index.html << EOF
226228
<div class="chart-card">
227-
<a href="$encoded_filename">$title</a>
228-
<div class="chart-name">$filename</div>
229+
<a href="$encoded_path">$title</a>
230+
<div class="chart-name">$relative_path</div>
229231
<div class="button-group">
230-
<a href="$encoded_filename" class="btn btn-primary">View Chart</a>
231-
<button class="btn btn-secondary" onclick="copyEmbedCode('$encoded_filename')">Copy Embed Code</button>
232+
<a href="$encoded_path" class="btn btn-primary">View Chart</a>
233+
<button class="btn btn-secondary" onclick="copyEmbedCode('$encoded_path')">Copy Embed Code</button>
232234
</div>
233235
</div>
234236
EOF
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)