From 8b324bc2b6eaf3f411f014c93ff735c2d27432ba Mon Sep 17 00:00:00 2001 From: Hamidreza Date: Wed, 30 Apr 2025 08:18:29 +0330 Subject: [PATCH] readmd.md update1 --- .github/workflows/sync-wiki.yml | 105 +++++++++++++++--------------- benchmarks/rotatingDrum/readme.md | 1 - 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml index fdb0f9c5..595bf731 100644 --- a/.github/workflows/sync-wiki.yml +++ b/.github/workflows/sync-wiki.yml @@ -88,59 +88,62 @@ jobs: # Process HTML img tags separately - preserving all attributes echo "Processing HTML image references..." - # Store the file content in a temporary variable to process with awk - readme_content=$(cat "./$rel_path") - # Use awk to find all img tags and process them - img_tags=$(echo "$readme_content" | grep -o ']*>' || echo "") - if [ -n "$img_tags" ]; then - echo "Found HTML img tags to process" - echo "$img_tags" | while read -r img_tag; do - # Extract src attribute - img_src=$(echo "$img_tag" | grep -o 'src="[^"]*"' | sed 's/src="\([^"]*\)"/\1/') + # Use a more robust method to process HTML img tags + # Create a temporary file for processing + temp_file=$(mktemp) + echo "$content" > "$temp_file" + + # Process each img tag properly with perl + perl -i -0777 -pe ' + while (s/(]*?src=")([^"]+)("[^>]*?>)/) { + my $prefix = $1; + my $src = $2; + my $suffix = $3; - # 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 - # Absolute path within repository - abs_img_path="./$img_src" - else - # Relative path to the README - 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" - - # Escape special characters in the path for sed - escaped_img_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g') - escaped_img_tag=$(echo "$img_tag" | sed 's/[\/&]/\\&/g') - - # Create the new tag with the updated src but preserving all other attributes - new_img_tag=$(echo "$img_tag" | sed "s|src=\"$escaped_img_src\"|src=\"$wiki_img_path\"|g") - - # Replace the entire img tag in content - content=$(echo "$content" | sed "s|$escaped_img_tag|$new_img_tag|g") - echo "Replaced HTML image tag while preserving all attributes" - 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 - done - fi + # Skip URLs + if ($src =~ /^http/) { + # Do nothing, keep as is + } else { + # Path to be replaced + my $filename = $src; + $filename =~ s/.*\///; # Extract filename + my $new_path = "images/" . $filename; + $_ = $` . $prefix . $new_path . $suffix . $`; + } + } + ' "$temp_file" + + # Read back the processed content + content=$(cat "$temp_file") + rm "$temp_file" # Clean up + + # Now copy all the images referenced in HTML tags + for img_src in $(grep -o ']*src="[^"]*"' "./$rel_path" | sed -E 's/.*src="([^"]*)".*/\1/'); do + # Skip URLs + if [[ $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" + else + echo "Warning: HTML image file not found: $abs_img_path" + fi + done # 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 -