readmd.md update7

This commit is contained in:
Hamidreza 2025-04-30 08:45:28 +03:30
parent 253d6fbaf7
commit c6725625b3
2 changed files with 52 additions and 55 deletions

View File

@ -86,65 +86,63 @@ jobs:
fi fi
done 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..." echo "Processing HTML image references..."
# Save original content for processing # First, find and copy all images referenced in HTML tags
original_content="$content" img_tags_file=$(mktemp)
# Capture complete HTML img tags with all attributes into a file
grep -o '<img[^>]*>' "./$rel_path" > "$img_tags_file" || true
# Extract all HTML img tags with their src attributes # Create a file to store all image source paths
# Use a temporary file to store unique img tags since they might be multi-line img_src_file=$(mktemp)
temp_file=$(mktemp)
grep -o '<img[^>]*>' "./$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 while IFS= read -r img_tag; do
# Skip if empty img_src=$(echo "$img_tag" | grep -o 'src="[^"]*"' | sed 's/src="//;s/"$//')
if [ -z "$img_tag" ]; then if [ -n "$img_src" ] && [[ $img_src != http* ]]; then
echo "$img_src" >> "$img_src_file"
fi
done < "$img_tags_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 continue
fi fi
# Extract the src attribute # Determine image path
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 if [[ $img_src == /* ]]; then
abs_img_path="./$img_src" abs_img_path="./$img_src"
else else
abs_img_path="$base_dir/$img_src" abs_img_path="$base_dir/$img_src"
fi fi
# Extract just the filename # Extract filename
img_filename=$(basename "$img_src") img_filename=$(basename "$img_src")
wiki_img_path="images/$img_filename" wiki_img_path="images/$img_filename"
# Copy the image to wiki repository if it exists # Copy image to wiki
if [ -f "$abs_img_path" ]; then if [ -f "$abs_img_path" ]; then
echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path" echo "Copying HTML image: $abs_img_path -> ./wiki/$wiki_img_path"
cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image" 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 # Prepare for replacement
new_img_tag=$(echo "$img_tag" | sed "s|src=\"$img_src\"|src=\"$wiki_img_path\"|g") escaped_img_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g')
escaped_wiki_path=$(echo "$wiki_img_path" | sed 's/[\/&]/\\&/g')
# Escape special characters for sed replacement # Update src path while preserving ALL other attributes
escaped_img_tag=$(echo "$img_tag" | sed 's/[\/&]/\\&/g') content=$(echo "$content" | sed "s|src=\"$escaped_img_src\"|src=\"$escaped_wiki_path\"|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 else
echo "Warning: HTML image file not found: $abs_img_path" echo "Warning: HTML image file not found: $abs_img_path"
fi fi
done < "$temp_file" done
fi
# Clean up temporary file # Clean up temporary files
rm "$temp_file" rm -f "$img_tags_file" "$img_src_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,7 +13,6 @@ 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">