From c6725625b33d8d19af32dd1801c386c5fc7ff8a6 Mon Sep 17 00:00:00 2001 From: Hamidreza Date: Wed, 30 Apr 2025 08:45:28 +0330 Subject: [PATCH] readmd.md update7 --- .github/workflows/sync-wiki.yml | 106 +++++++++++++++--------------- benchmarks/rotatingDrum/readme.md | 1 - 2 files changed, 52 insertions(+), 55 deletions(-) diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml index f403fd30..b5fb31dc 100644 --- a/.github/workflows/sync-wiki.yml +++ b/.github/workflows/sync-wiki.yml @@ -85,66 +85,64 @@ jobs: ls -la "$base_dir" fi done - - # Process HTML img tags separately using grep and sed instead of perl + + # Process HTML img tags by finding all images and copying them echo "Processing HTML image references..." + + # First, find and copy all images referenced in HTML tags + img_tags_file=$(mktemp) + # Capture complete HTML img tags with all attributes into a file + grep -o ']*>' "./$rel_path" > "$img_tags_file" || true - # Save original content for processing - original_content="$content" + # Create a file to store all image source paths + img_src_file=$(mktemp) - # Extract all HTML img tags with their src attributes - # Use a temporary file to store unique img tags since they might be multi-line - temp_file=$(mktemp) - grep -o ']*>' "./$rel_path" > "$temp_file" || echo "" > "$temp_file" - - # Process each img tag from the file + # Extract src attributes from img tags while IFS= read -r img_tag; do - # Skip if empty - if [ -z "$img_tag" ]; then - continue + img_src=$(echo "$img_tag" | grep -o 'src="[^"]*"' | sed 's/src="//;s/"$//') + if [ -n "$img_src" ] && [[ $img_src != http* ]]; then + echo "$img_src" >> "$img_src_file" fi - - # Extract the src attribute - img_src=$(echo "$img_tag" | sed -n 's/.*src="\([^"]*\)".*/\1/p') - - # Skip if no src or if it's a URL - if [ -z "$img_src" ] || [[ $img_src == http* ]]; then - continue - fi - - # Determine the absolute path of the image - if [[ $img_src == /* ]]; then - abs_img_path="./$img_src" - else - abs_img_path="$base_dir/$img_src" - fi - - # Extract just the filename - img_filename=$(basename "$img_src") - 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" - - # Create a new img tag with the updated src but preserving all other attributes - new_img_tag=$(echo "$img_tag" | sed "s|src=\"$img_src\"|src=\"$wiki_img_path\"|g") - - # Escape special characters for sed replacement - escaped_img_tag=$(echo "$img_tag" | sed 's/[\/&]/\\&/g') - escaped_new_img_tag=$(echo "$new_img_tag" | sed 's/[\/&]/\\&/g') - - # Replace the img tag in content - content=$(echo "$content" | sed "s|$escaped_img_tag|$escaped_new_img_tag|g") - echo "Replaced HTML image tag with new src path while preserving style attributes" - else - echo "Warning: HTML image file not found: $abs_img_path" - fi - done < "$temp_file" + done < "$img_tags_file" - # Clean up temporary file - rm "$temp_file" + # Process each unique image source + if [ -s "$img_src_file" ]; then + sort -u "$img_src_file" | while read -r img_src; do + # Skip empty lines + if [ -z "$img_src" ]; then + continue + fi + + # Determine image path + if [[ $img_src == /* ]]; then + abs_img_path="./$img_src" + else + abs_img_path="$base_dir/$img_src" + fi + + # Extract filename + img_filename=$(basename "$img_src") + wiki_img_path="images/$img_filename" + + # Copy image to wiki + if [ -f "$abs_img_path" ]; then + echo "Copying HTML image: $abs_img_path -> ./wiki/$wiki_img_path" + cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image" + + # Prepare for replacement + escaped_img_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g') + escaped_wiki_path=$(echo "$wiki_img_path" | sed 's/[\/&]/\\&/g') + + # Update src path while preserving ALL other attributes + content=$(echo "$content" | sed "s|src=\"$escaped_img_src\"|src=\"$escaped_wiki_path\"|g") + else + echo "Warning: HTML image file not found: $abs_img_path" + fi + done + fi + + # Clean up temporary files + rm -f "$img_tags_file" "$img_src_file" # Debug output echo "Wiki page content preview (first 100 chars): ${content:0:100}" diff --git a/benchmarks/rotatingDrum/readme.md b/benchmarks/rotatingDrum/readme.md index 7476acfb..12c36fab 100644 --- a/benchmarks/rotatingDrum/readme.md +++ b/benchmarks/rotatingDrum/readme.md @@ -13,7 +13,6 @@ This benchmark compares the performance of phasicFlow with a well-stablished com -