diff --git a/doc/example/animation.md b/doc/example/animation.md index f26065d2..cbd15118 100644 --- a/doc/example/animation.md +++ b/doc/example/animation.md @@ -86,7 +86,7 @@ contains case (-5) print *, "ERROR: Failed to generate animation frames." case (-6) - print *, "✗ Pipe write failed - enhanced recovery attempted (Issue #186: exponential backoff exhausted)" + print *, " Pipe write failed - enhanced recovery attempted (Issue #186: exponential backoff exhausted)" case (-7) print *, "ERROR: Generated video failed validation. Check ffmpeg version." case default diff --git a/doc/example/basic_plots.md b/doc/example/basic_plots.md index a0984cff..18672d35 100644 --- a/doc/example/basic_plots.md +++ b/doc/example/basic_plots.md @@ -30,7 +30,7 @@ contains print *, "=== Basic Plots ===" - ! Generate simple sine data - show 2 complete periods (0 to 4π) + ! Generate simple sine data - show 2 complete periods (0 to 4pi) x = [(real(i-1, wp) * 4.0_wp * 3.141592653589793_wp / 49.0_wp, i=1, 50)] y = sin(x) diff --git a/doc/example/smart_show_demo.md b/doc/example/smart_show_demo.md index 5ec1e45a..f4417097 100644 --- a/doc/example/smart_show_demo.md +++ b/doc/example/smart_show_demo.md @@ -42,7 +42,7 @@ program smart_show_demo call title('Smart Show Demo - Damped Oscillation') call xlabel('Time') call ylabel('Amplitude') - call plot(x, y, label='exp(-t)*cos(2πt)', linestyle='b-o') + call plot(x, y, label='exp(-t)*cos(2t)', linestyle='b-o') call legend() ! Display using intelligent show() @@ -75,9 +75,9 @@ end program smart_show_demo - SSH session detection 2. **Select backend**: - - GUI available → PNG viewer - - Terminal only → ASCII output - - File output → User specified + - GUI available PNG viewer + - Terminal only ASCII output + - File output User specified 3. **Fallback chain**: - Try PNG viewer @@ -109,5 +109,5 @@ Smart Plot Display | * -1.0 | ** +--------------- - 0 2π + 0 2 ``` diff --git a/scripts/clean_example_docs_utf8.sh b/scripts/clean_example_docs_utf8.sh new file mode 100755 index 00000000..d7621481 --- /dev/null +++ b/scripts/clean_example_docs_utf8.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Clean all non-ASCII characters from example documentation files +# This ensures FORD can parse them correctly in all CI environments + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +EXAMPLE_DIR="$PROJECT_ROOT/doc/example" + +echo "=== Cleaning UTF-8 non-ASCII characters from example documentation ===" +echo "Project root: $PROJECT_ROOT" +echo "Example directory: $EXAMPLE_DIR" +echo "" + +if [[ ! -d "$EXAMPLE_DIR" ]]; then + echo "ERROR: Example directory not found: $EXAMPLE_DIR" + exit 1 +fi + +# Function to clean a single file +clean_file() { + local file="$1" + local basename=$(basename "$file") + + echo "Processing: $basename" + + # Check current encoding + local encoding=$(file -bi "$file" | cut -d'=' -f2) + echo " Current encoding: $encoding" + + # Create backup + cp "$file" "${file}.backup" + + # Use tr to remove all non-ASCII characters (safer than sed with complex UTF-8) + # Keep only printable ASCII characters: tab(9), newline(10), carriage return(13), space(32) through tilde(126) + tr -cd '\11\12\15\40-\176' < "$file" > "${file}.temp" + mv "${file}.temp" "$file" + + # Check final encoding + local new_encoding=$(file -bi "$file" | cut -d'=' -f2) + echo " New encoding: $new_encoding" + + # Show what changed + if ! cmp -s "$file" "${file}.backup"; then + echo " Changes made to file" + # Show diff but limit output + diff -u "${file}.backup" "$file" | head -20 || true + echo " ..." + else + echo " No changes needed" + fi + + echo "" +} + +# Find and process all markdown files +echo "Finding markdown files in $EXAMPLE_DIR..." +find "$EXAMPLE_DIR" -name "*.md" -type f | while read -r file; do + clean_file "$file" +done + +echo "=== Summary ===" +echo "Processed files:" +find "$EXAMPLE_DIR" -name "*.md" -type f | while read -r file; do + basename=$(basename "$file") + encoding=$(file -bi "$file" | cut -d'=' -f2) + echo " $basename: $encoding" +done + +echo "" +echo "Backup files created with .backup extension" +echo "To remove backups: find $EXAMPLE_DIR -name '*.backup' -delete" +echo "" +echo "=== Cleaning completed ===" \ No newline at end of file