@@ -86,47 +86,48 @@ jobs:
86
86
fi
87
87
done
88
88
89
- # Process HTML img tags separately - preserving all attributes
89
+ # Process HTML img tags separately
90
90
echo "Processing HTML image references..."
91
91
92
- # Use a more reliable approach with temporary files and simpler perl commands
92
+ # Create temporary files
93
93
temp_file=$(mktemp)
94
94
echo "$content" > "$temp_file"
95
95
96
- # Create a simpler perl script file instead of inline perl
96
+ # Create perl script file
97
97
perl_script=$(mktemp)
98
- # Write the perl script with proper escaping for YAML
99
- cat > "$perl_script" << 'PERLSCRIPT'
98
+
99
+ # Write perl script content - using proper YAML block scalar syntax
100
+ cat > "$perl_script" << EOL
100
101
# !/usr/bin/perl
101
102
use strict;
102
103
use warnings;
103
104
104
- my $content = do { local $/; <STDIN> };
105
+ my \ $content = do { local \ $/; <STDIN> };
105
106
106
107
# Process HTML img tags
107
- while ($content =~ m|(<img\s+[^>]*?src=")([^"]+)("[^>]*?>)|g) {
108
- my $prefix = $1;
109
- my $src = $2;
110
- my $suffix = $3;
111
- my $tag = $prefix . $src . $suffix;
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;
112
113
113
114
# Skip URLs
114
- next if $src =~ /^http/;
115
+ next if \ $src =~ /^http/;
115
116
116
117
# Get just the filename
117
- my $filename = $src;
118
- $filename =~ s/.*\///;
119
- my $new_path = "images/" . $filename;
118
+ my \ $filename = \ $src;
119
+ \ $filename =~ s/.*\ \///;
120
+ my \ $new_path = "images/" . \ $filename;
120
121
121
122
# Replace in content
122
- my $new_tag = $prefix . $new_path . $suffix;
123
- $content =~ s/\Q $tag\E/ $new_tag/g;
123
+ my \ $new_tag = \ $prefix . \ $new_path . \ $suffix;
124
+ \ $content =~ s/\\Q\ $tag\\E/\ $new_tag/g;
124
125
}
125
126
126
- print $content;
127
- PERLSCRIPT
127
+ print \ $content;
128
+ EOL
128
129
129
- # Process content with the perl script
130
+ # Process content with perl script
130
131
cat "$temp_file" | perl "$perl_script" > "${temp_file}.new"
131
132
content=$(cat "${temp_file}.new")
132
133
0 commit comments