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
done
# Process HTML img tags separately
# Process HTML img tags separately using grep and sed instead of perl
echo "Processing HTML image references..."
# Create temporary files
temp_file=$(mktemp)
echo "$content" > "$temp_file"
# Extract all HTML img tags with their src attributes
img_tags=$(grep -o '<img [^>]*src="[^"]*"[^>]*>' "./$rel_path" || echo "")
# Create perl script file
perl_script=$(mktemp)
# Write perl script content - using proper YAML block scalar syntax
cat > "$perl_script" << EOL
#!/usr/bin/perl
use strict;
use warnings;
my \$content = do { local \$/; <STDIN> };
# Process HTML img tags
while (\$content =~ m|(<img\\s+[^>]*?src=")([^"]+)("[^>]*?>)|g) {
my \$prefix = \$1;
my \$src = \$2;
my \$suffix = \$3;
my \$tag = \$prefix . \$src . \$suffix;
# Skip URLs
next if \$src =~ /^http/;
# Get just the filename
my \$filename = \$src;
\$filename =~ s/.*\\///;
my \$new_path = "images/" . \$filename;
# Replace in content
my \$new_tag = \$prefix . \$new_path . \$suffix;
\$content =~ s/\\Q\$tag\\E/\$new_tag/g;
}
print \$content;
EOL
# Process content with perl script
cat "$temp_file" | perl "$perl_script" > "${temp_file}.new"
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
if [ ! -z "$img_tags" ]; then
# For each image tag
echo "$img_tags" | while read -r img_tag; do
# Extract the src attribute
img_src=$(echo "$img_tag" | sed -E 's/.*src="([^"]*)".*/\1/')
# 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"
# Safely replace the image reference in content
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")
else
echo "Warning: HTML image file not found: $abs_img_path"
fi
done
fi
# Debug output
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 align="center">
<img src="./images/phasicFlow_snapshot.png" style="width: 400px;" />
<div align="center">