readmd.md update1

This commit is contained in:
Hamidreza 2025-04-30 08:18:29 +03:30
parent c7f790a1fa
commit 8b324bc2b6
2 changed files with 54 additions and 52 deletions

View File

@ -88,59 +88,62 @@ jobs:
# Process HTML img tags separately - preserving all attributes # Process HTML img tags separately - preserving all attributes
echo "Processing HTML image references..." 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 # Use a more robust method to process HTML img tags
img_tags=$(echo "$readme_content" | grep -o '<img[^>]*>' || echo "") # Create a temporary file for processing
if [ -n "$img_tags" ]; then temp_file=$(mktemp)
echo "Found HTML img tags to process" echo "$content" > "$temp_file"
echo "$img_tags" | while read -r img_tag; do
# Extract src attribute # Process each img tag properly with perl
img_src=$(echo "$img_tag" | grep -o 'src="[^"]*"' | sed 's/src="\([^"]*\)"/\1/') perl -i -0777 -pe '
while (s/(<img\s+[^>]*?src=")([^"]+)("[^>]*?>)/) {
my $prefix = $1;
my $src = $2;
my $suffix = $3;
# Skip if no src or if it's a URL # Skip URLs
if [ -z "$img_src" ] || [[ $img_src == http* ]]; then if ($src =~ /^http/) {
continue # Do nothing, keep as is
fi } else {
# Path to be replaced
# Determine the absolute path of the image my $filename = $src;
if [[ $img_src == /* ]]; then $filename =~ s/.*\///; # Extract filename
# Absolute path within repository my $new_path = "images/" . $filename;
abs_img_path="./$img_src" $_ = $` . $prefix . $new_path . $suffix . $`;
else }
# Relative path to the README }
abs_img_path="$base_dir/$img_src" ' "$temp_file"
fi
# Read back the processed content
# Extract just the filename content=$(cat "$temp_file")
img_filename=$(basename "$img_src") rm "$temp_file" # Clean up
wiki_img_path="images/$img_filename"
# Now copy all the images referenced in HTML tags
# Copy the image to wiki repository if it exists for img_src in $(grep -o '<img [^>]*src="[^"]*"' "./$rel_path" | sed -E 's/.*src="([^"]*)".*/\1/'); do
if [ -f "$abs_img_path" ]; then # Skip URLs
echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path" if [[ $img_src == http* ]]; then
cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image" continue
fi
# Escape special characters in the path for sed
escaped_img_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g') # Determine the absolute path of the image
escaped_img_tag=$(echo "$img_tag" | sed 's/[\/&]/\\&/g') if [[ $img_src == /* ]]; then
abs_img_path="./$img_src"
# Create the new tag with the updated src but preserving all other attributes else
new_img_tag=$(echo "$img_tag" | sed "s|src=\"$escaped_img_src\"|src=\"$wiki_img_path\"|g") abs_img_path="$base_dir/$img_src"
fi
# Replace the entire img tag in content
content=$(echo "$content" | sed "s|$escaped_img_tag|$new_img_tag|g") # Extract just the filename
echo "Replaced HTML image tag while preserving all attributes" img_filename=$(basename "$img_src")
else wiki_img_path="images/$img_filename"
echo "Warning: HTML image file not found: $abs_img_path"
# Add more debug info # Copy the image to wiki repository if it exists
echo "Current directory: $(pwd)" if [ -f "$abs_img_path" ]; then
echo "Files in $base_dir:" echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path"
ls -la "$base_dir" cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image"
fi else
done echo "Warning: HTML image file not found: $abs_img_path"
fi 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">