From c126f9a8a3f4411dc5a5aa5e2cea3e475a3bd301 Mon Sep 17 00:00:00 2001 From: Hamidreza Date: Tue, 29 Apr 2025 20:19:25 +0330 Subject: [PATCH] rr --- .github/workflows/sync-wiki.yml | 44 +++++++++++++++++++++++++++++-- benchmarks/rotatingDrum/readme.md | 2 +- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml index 6d40b600..0b950a89 100644 --- a/.github/workflows/sync-wiki.yml +++ b/.github/workflows/sync-wiki.yml @@ -47,7 +47,7 @@ jobs: # Process image references line by line for more reliable detection while IFS= read -r line; do - # Fix the regex syntax for bash + # Check for Markdown style image references if [[ "$line" =~ !\[(.*)\]\((.*)\) ]]; then img_path="${BASH_REMATCH[2]}" @@ -56,7 +56,7 @@ jobs: continue fi - # Determine the absolute path of the image + # Handle Markdown image syntax if [[ $img_path == /* ]]; then # Absolute path within repository abs_img_path="./$img_path" @@ -87,6 +87,46 @@ jobs: echo "Files in $base_dir:" ls -la "$base_dir" fi + # Check for HTML style image tags - look for ]*src=\"([^\"]+)\"[^>]*\> ]]; then + img_path="${BASH_REMATCH[1]}" + + # Skip URLs + if [[ $img_path == http* ]]; then + continue + fi + + # Determine the absolute path of the image + if [[ $img_path == /* ]]; then + # Absolute path within repository + abs_img_path="./$img_path" + else + # Relative path to the README + abs_img_path="$base_dir/$img_path" + fi + + # Extract just the filename + img_filename=$(basename "$img_path") + wiki_img_path="images/$img_filename" + + # Copy the image to wiki repository if it exists + if [ -f "$abs_img_path" ]; then + echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path" + cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image" + + # Escape special characters in the path for sed + escaped_img_path=$(echo "$img_path" | sed 's/[\/&]/\\&/g') + + # Replace the HTML image reference in content + content=$(echo "$content" | sed "s|src=\"$escaped_img_path\"|src=\"$wiki_img_path\"|g") + echo "Replaced HTML image reference: $img_path → $wiki_img_path" + else + echo "Warning: HTML image file not found: $abs_img_path" + # Add more debug info + echo "Current directory: $(pwd)" + echo "Files in $base_dir:" + ls -la "$base_dir" + fi fi done < "./$rel_path" diff --git a/benchmarks/rotatingDrum/readme.md b/benchmarks/rotatingDrum/readme.md index 9d019b66..fa8dd26b 100644 --- a/benchmarks/rotatingDrum/readme.md +++ b/benchmarks/rotatingDrum/readme.md @@ -13,7 +13,7 @@ This benchmark compares the performance of phasicFlow with a well-stablished com -.. +.