readmd.md update5

This commit is contained in:
Hamidreza 2025-04-30 08:37:17 +03:30
parent 20c94398a9
commit 701baf09e6
2 changed files with 39 additions and 72 deletions

View File

@ -86,80 +86,48 @@ jobs:
fi fi
done done
# Process HTML img tags separately # Process HTML img tags separately using grep and sed instead of perl
echo "Processing HTML image references..." echo "Processing HTML image references..."
# Create temporary files # Extract all HTML img tags with their src attributes
temp_file=$(mktemp) img_tags=$(grep -o '<img [^>]*src="[^"]*"[^>]*>' "./$rel_path" || echo "")
echo "$content" > "$temp_file"
# Create perl script file if [ ! -z "$img_tags" ]; then
perl_script=$(mktemp) # For each image tag
echo "$img_tags" | while read -r img_tag; do
# Write perl script content - using proper YAML block scalar syntax # Extract the src attribute
cat > "$perl_script" << EOL img_src=$(echo "$img_tag" | sed -E 's/.*src="([^"]*)".*/\1/')
#!/usr/bin/perl
use strict; # Skip URLs
use warnings; if [[ $img_src == http* ]]; then
continue
my \$content = do { local \$/; <STDIN> }; fi
# Process HTML img tags # Determine the absolute path of the image
while (\$content =~ m|(<img\\s+[^>]*?src=")([^"]+)("[^>]*?>)|g) { if [[ $img_src == /* ]]; then
my \$prefix = \$1; abs_img_path="./$img_src"
my \$src = \$2; else
my \$suffix = \$3; abs_img_path="$base_dir/$img_src"
my \$tag = \$prefix . \$src . \$suffix; fi
# Skip URLs # Extract just the filename
next if \$src =~ /^http/; img_filename=$(basename "$img_src")
wiki_img_path="images/$img_filename"
# Get just the filename
my \$filename = \$src; # Copy the image to wiki repository if it exists
\$filename =~ s/.*\\///; if [ -f "$abs_img_path" ]; then
my \$new_path = "images/" . \$filename; echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path"
cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image"
# Replace in content
my \$new_tag = \$prefix . \$new_path . \$suffix; # Safely replace the image reference in content
\$content =~ s/\\Q\$tag\\E/\$new_tag/g; escaped_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g')
} escaped_wiki_path=$(echo "$wiki_img_path" | sed 's/[\/&]/\\&/g')
content=$(echo "$content" | sed "s|src=\"$escaped_src\"|src=\"$escaped_wiki_path\"|g")
print \$content; else
EOL echo "Warning: HTML image file not found: $abs_img_path"
fi
# Process content with perl script done
cat "$temp_file" | perl "$perl_script" > "${temp_file}.new" fi
content=$(cat "${temp_file}.new")
# Clean up temporary files
rm "$temp_file" "${temp_file}.new" "$perl_script"
# Now copy all the images referenced in HTML tags
for img_src in $(grep -o '<img [^>]*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 # 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">