Skip to content

Commit d266f46

Browse files
committed
chore: add script for fixing documentation issues and enhance workflow
- Introduced fix-docs.sh script to create lowercase copies of documentation files and fix Liquid template syntax. - Updated test-docs-generation.yml to execute the new script during the documentation generation process. - Added new index and feature markdown files to improve documentation structure and navigation for code-based and configuration-based features.
1 parent 8d20c5c commit d266f46

8 files changed

Lines changed: 102 additions & 1 deletion

File tree

.github/scripts/docs/fix-docs.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# fix-docs.sh - Quick script to fix documentation issues
3+
4+
echo "🔄 Fixing documentation files..."
5+
6+
# Create lowercase copies and fix links
7+
for dir in code-based configuration-based; do
8+
echo "Processing $dir directory..."
9+
cd "features/$dir" || exit 1
10+
11+
# Create lowercase versions of all uppercase files
12+
for file in *.md; do
13+
if [[ "$file" == *[A-Z]* ]]; then
14+
lowercase=$(echo "$file" | tr '[:upper:]' '[:lower:]')
15+
echo " Creating lowercase copy: $lowercase"
16+
cp "$file" "$lowercase"
17+
18+
# Fix the Liquid templates in both files
19+
for target in "$file" "$lowercase"; do
20+
# Replace {{ with {% raw %}{{ and }} with }}{% endraw %}
21+
sed -i.bak -E 's/\{\{([^}]*)\}\}/\{% raw %\}\{\{\1\}\}\{% endraw %\}/g' "$target"
22+
rm -f "$target.bak"
23+
done
24+
fi
25+
done
26+
27+
# Fix links to uppercase files
28+
for file in *.md; do
29+
# Update links to other docs to use lowercase
30+
sed -i.bak -E 's/\(([^)]*)(PAGE_[A-Z_]+)(\.md)?\)/(\1\L\2\E\3)/g' "$file"
31+
sed -i.bak -E 's/\(\.\.\/([^)]*)(PAGE_[A-Z_]+)(\.md)?\)/(\.\.\1\L\2\E\3)/g' "$file"
32+
rm -f "$file.bak"
33+
done
34+
35+
cd ../.. || exit 1
36+
done
37+
38+
echo "✅ Documentation files fixed!"

.github/workflows/test-docs-generation.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ jobs:
9090
../.github/scripts/docs/fix-schema-links.sh
9191
cd ..
9292
93+
- name: Fix Liquid templates and create lowercase files
94+
run: |
95+
echo "🔄 Fixing Liquid templates and creating lowercase files..."
96+
cd site-src
97+
chmod +x ../.github/scripts/docs/fix-docs.sh
98+
../.github/scripts/docs/fix-docs.sh
99+
cd ..
100+
93101
- name: Create Jekyll configuration
94102
run: |
95103
echo "🔄 Creating Jekyll configuration files..."

docs/features/code-based/CUSTOM_SERVICES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
layout: default
3+
title: Custom Services
4+
parent: Code-based Features
5+
grand_parent: Features
6+
---
7+
18
# Overriding DXT logic with custom services
29

310
## Customising where forms are loaded from

docs/features/code-based/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
layout: default
3+
title: Code-based Features
4+
parent: Features
5+
has_children: true
6+
---
7+
8+
# Code-based Features
9+
10+
- [Custom Services](custom_services)
11+
- [Page Views](page_views)

docs/features/configuration-based/PAGE_EVENTS.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
---
2+
layout: default
3+
title: Page Events
4+
parent: Configuration-based Features
5+
grand_parent: Features
6+
---
7+
18
# Page events
29

310
Page events are a configuration-based way of triggering an action on an event trigger. For example, when a page loads, call an API and retrieve the data from it.
411

512
DXT's forms engine is a frontend service, which should remain as lightweight as possible with business logic being implemented in a backend/BFF API. Using page events, DXT can call your API and use the tailored response downstream, such a page templates to display the response value.
613

7-
The downstream API response becomes available under the `{{ context.data }}` view model attribute for view templates, so it can be used when rendering a page. This attribute is directly accessible by our [page templates](./../configuration-based/PAGE_TEMPLATES.md) feature and our Nunjucks-based views.
14+
The downstream API response becomes available under the `{% raw %}{{ context.data }}{% endraw %}` view model attribute for view templates, so it can be used when rendering a page. This attribute is directly accessible by our [page templates](./../configuration-based/PAGE_TEMPLATES.md) feature and our Nunjucks-based views.
815

916
## Architecture
1017

docs/features/configuration-based/PAGE_TEMPLATES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
layout: default
3+
title: Page Templates
4+
parent: Configuration-based Features
5+
grand_parent: Features
6+
---
7+
18
# Page templates
29

310
Page templates are a configuration-based way of adding dynamic content to the form UI, such as displaying the answer to a question, or some data from your API. This feature is only used for presentation purposes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
layout: default
3+
title: Configuration-based Features
4+
parent: Features
5+
has_children: true
6+
---
7+
8+
# Configuration-based Features
9+
10+
- [Page Events](page_events)
11+
- [Page Templates](page_templates)

docs/features/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
layout: default
3+
title: Features
4+
nav_order: 4
5+
has_children: true
6+
permalink: /features/
7+
---
8+
9+
# DXT Features
10+
11+
- [Configuration-based Features](configuration-based/)
12+
- [Code-based Features](code-based/)

0 commit comments

Comments
 (0)