Skip to content

Commit 701baf0

Browse files
readmd.md update5
1 parent 20c9439 commit 701baf0

File tree

2 files changed

+39
-72
lines changed

2 files changed

+39
-72
lines changed

.github/workflows/sync-wiki.yml

Lines changed: 39 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -86,80 +86,48 @@ jobs:
8686
fi
8787
done
8888
89-
# Process HTML img tags separately
89+
# Process HTML img tags separately using grep and sed instead of perl
9090
echo "Processing HTML image references..."
9191
92-
# Create temporary files
93-
temp_file=$(mktemp)
94-
echo "$content" > "$temp_file"
92+
# Extract all HTML img tags with their src attributes
93+
img_tags=$(grep -o '<img [^>]*src="[^"]*"[^>]*>' "./$rel_path" || echo "")
9594
96-
# Create perl script file
97-
perl_script=$(mktemp)
98-
99-
# Write perl script content - using proper YAML block scalar syntax
100-
cat > "$perl_script" << EOL
101-
#!/usr/bin/perl
102-
use strict;
103-
use warnings;
104-
105-
my \$content = do { local \$/; <STDIN> };
106-
107-
# Process HTML img tags
108-
while (\$content =~ m|(<img\\s+[^>]*?src=")([^"]+)("[^>]*?>)|g) {
109-
my \$prefix = \$1;
110-
my \$src = \$2;
111-
my \$suffix = \$3;
112-
my \$tag = \$prefix . \$src . \$suffix;
113-
114-
# Skip URLs
115-
next if \$src =~ /^http/;
116-
117-
# Get just the filename
118-
my \$filename = \$src;
119-
\$filename =~ s/.*\\///;
120-
my \$new_path = "images/" . \$filename;
121-
122-
# Replace in content
123-
my \$new_tag = \$prefix . \$new_path . \$suffix;
124-
\$content =~ s/\\Q\$tag\\E/\$new_tag/g;
125-
}
126-
127-
print \$content;
128-
EOL
129-
130-
# Process content with perl script
131-
cat "$temp_file" | perl "$perl_script" > "${temp_file}.new"
132-
content=$(cat "${temp_file}.new")
133-
134-
# Clean up temporary files
135-
rm "$temp_file" "${temp_file}.new" "$perl_script"
136-
137-
# Now copy all the images referenced in HTML tags
138-
for img_src in $(grep -o '<img [^>]*src="[^"]*"' "./$rel_path" | sed -E 's/.*src="([^"]*)".*/\1/'); do
139-
# Skip URLs
140-
if [[ $img_src == http* ]]; then
141-
continue
142-
fi
143-
144-
# Determine the absolute path of the image
145-
if [[ $img_src == /* ]]; then
146-
abs_img_path="./$img_src"
147-
else
148-
abs_img_path="$base_dir/$img_src"
149-
fi
150-
151-
# Extract just the filename
152-
img_filename=$(basename "$img_src")
153-
wiki_img_path="images/$img_filename"
154-
155-
# Copy the image to wiki repository if it exists
156-
if [ -f "$abs_img_path" ]; then
157-
echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path"
158-
cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image"
159-
else
160-
echo "Warning: HTML image file not found: $abs_img_path"
161-
fi
162-
done
95+
if [ ! -z "$img_tags" ]; then
96+
# For each image tag
97+
echo "$img_tags" | while read -r img_tag; do
98+
# Extract the src attribute
99+
img_src=$(echo "$img_tag" | sed -E 's/.*src="([^"]*)".*/\1/')
100+
101+
# Skip URLs
102+
if [[ $img_src == http* ]]; then
103+
continue
104+
fi
105+
106+
# Determine the absolute path of the image
107+
if [[ $img_src == /* ]]; then
108+
abs_img_path="./$img_src"
109+
else
110+
abs_img_path="$base_dir/$img_src"
111+
fi
112+
113+
# Extract just the filename
114+
img_filename=$(basename "$img_src")
115+
wiki_img_path="images/$img_filename"
116+
117+
# Copy the image to wiki repository if it exists
118+
if [ -f "$abs_img_path" ]; then
119+
echo "Copying image: $abs_img_path -> ./wiki/$wiki_img_path"
120+
cp -v "$abs_img_path" "./wiki/$wiki_img_path" || echo "Error copying image"
121+
122+
# Safely replace the image reference in content
123+
escaped_src=$(echo "$img_src" | sed 's/[\/&]/\\&/g')
124+
escaped_wiki_path=$(echo "$wiki_img_path" | sed 's/[\/&]/\\&/g')
125+
content=$(echo "$content" | sed "s|src=\"$escaped_src\"|src=\"$escaped_wiki_path\"|g")
126+
else
127+
echo "Warning: HTML image file not found: $abs_img_path"
128+
fi
129+
done
130+
fi
163131
164132
# Debug output
165133
echo "Wiki page content preview (first 100 chars): ${content:0:100}"

benchmarks/rotatingDrum/readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ This benchmark compares the performance of phasicFlow with a well-stablished com
1313
</div>
1414
</div>
1515

16-
1716
<div align="center">
1817
<img src="./images/phasicFlow_snapshot.png" style="width: 400px;" />
1918
<div align="center">

0 commit comments

Comments
 (0)