readmd.md update6

This commit is contained in:
Hamidreza 2025-04-30 08:40:46 +03:30
parent 701baf09e6
commit 253d6fbaf7
2 changed files with 53 additions and 35 deletions

View File

@ -89,45 +89,62 @@ jobs:
# Process HTML img tags separately using grep and sed instead of perl # Process HTML img tags separately using grep and sed instead of perl
echo "Processing HTML image references..." echo "Processing HTML image references..."
# Save original content for processing
original_content="$content"
# Extract all HTML img tags with their src attributes # Extract all HTML img tags with their src attributes
img_tags=$(grep -o '<img [^>]*src="[^"]*"[^>]*>' "./$rel_path" || echo "") # Use a temporary file to store unique img tags since they might be multi-line
temp_file=$(mktemp)
grep -o '<img[^>]*>' "./$rel_path" > "$temp_file" || echo "" > "$temp_file"
if [ ! -z "$img_tags" ]; then # Process each img tag from the file
# For each image tag while IFS= read -r img_tag; do
echo "$img_tags" | while read -r img_tag; do # Skip if empty
# Extract the src attribute if [ -z "$img_tag" ]; then
img_src=$(echo "$img_tag" | sed -E 's/.*src="([^"]*)".*/\1/') continue
fi
# Skip URLs # Extract the src attribute
if [[ $img_src == http* ]]; then img_src=$(echo "$img_tag" | sed -n 's/.*src="\([^"]*\)".*/\1/p')
continue
fi
# Determine the absolute path of the image # Skip if no src or if it's a URL
if [[ $img_src == /* ]]; then if [ -z "$img_src" ] || [[ $img_src == http* ]]; then
abs_img_path="./$img_src" continue
else fi
abs_img_path="$base_dir/$img_src"
fi
# Extract just the filename # Determine the absolute path of the image
img_filename=$(basename "$img_src") if [[ $img_src == /* ]]; then
wiki_img_path="images/$img_filename" abs_img_path="./$img_src"
else
abs_img_path="$base_dir/$img_src"
fi
# Copy the image to wiki repository if it exists # Extract just the filename
if [ -f "$abs_img_path" ]; then img_filename=$(basename "$img_src")
echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path" wiki_img_path="images/$img_filename"
cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image"
# Safely replace the image reference in content # Copy the image to wiki repository if it exists
escaped_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g') if [ -f "$abs_img_path" ]; then
escaped_wiki_path=$(echo "$wiki_img_path" | sed 's/[\/&]/\\&/g') echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path"
content=$(echo "$content" | sed "s|src=\"$escaped_src\"|src=\"$escaped_wiki_path\"|g") cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image"
else
echo "Warning: HTML image file not found: $abs_img_path" # Create a new img tag with the updated src but preserving all other attributes
fi new_img_tag=$(echo "$img_tag" | sed "s|src=\"$img_src\"|src=\"$wiki_img_path\"|g")
done
fi # 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"
# Clean up temporary file
rm "$temp_file"
# Debug output # Debug output
echo "Wiki page content preview (first 100 chars): ${content:0:100}" echo "Wiki page content preview (first 100 chars): ${content:0:100}"

View File

@ -13,6 +13,7 @@ This benchmark compares the performance of phasicFlow with a well-stablished com
</div> </div>
</div> </div>
<div align="center"> <div align="center">
<img src="./images/phasicFlow_snapshot.png" style="width: 400px;" /> <img src="./images/phasicFlow_snapshot.png" style="width: 400px;" />
<div align="center"> <div align="center">