diff options
Diffstat (limited to 'libexec/filter-github-emails')
-rwxr-xr-x | libexec/filter-github-emails | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libexec/filter-github-emails b/libexec/filter-github-emails index 7a05a05..38c2168 100755 --- a/libexec/filter-github-emails +++ b/libexec/filter-github-emails | |||
@@ -115,6 +115,18 @@ sub bye { | |||
115 | } | 115 | } |
116 | 116 | ||
117 | # | 117 | # |
118 | # Wrap overlong lines. | ||
119 | # | ||
120 | |||
121 | sub rewrap { | ||
122 | my @lines = split(/\n/, shift); | ||
123 | my @wrapped = map { wrap('', '', $_) } @lines; | ||
124 | |||
125 | debug('Rewrapping text'); | ||
126 | return join("\n", @wrapped); | ||
127 | } | ||
128 | |||
129 | # | ||
118 | # Look up MIME parts. | 130 | # Look up MIME parts. |
119 | # | 131 | # |
120 | 132 | ||
@@ -154,11 +166,11 @@ sub edit_text_body { | |||
154 | 166 | ||
155 | debug('Editing text/plain body'); | 167 | debug('Editing text/plain body'); |
156 | 168 | ||
157 | $body = fill('', '', $body); # While at it, wrap the text. | 169 | $body = rewrap($body); # While at it, wrap overlong lines. |
158 | 170 | ||
159 | $s = '^--- Reply to this email directly or view it on GitHub:'; | 171 | $s = "\n---\nReply to this email directly or view it on GitHub:"; |
160 | $r = "-- \nReply to this email on GitHub:"; | 172 | $r = "\n-- \nReply to this email on GitHub:"; |
161 | $body =~ s/$s/$r/m; | 173 | $body =~ s/$s/$r/; |
162 | 174 | ||
163 | return $body; | 175 | return $body; |
164 | } | 176 | } |