summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2014-02-04 13:13:36 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-02-04 13:13:36 (GMT)
commitf487fd80dbc8b15c9a7072abd0c167ac58675bcc (patch)
treeb655ab6cf20e36df3d57a3752cd79dbdb766aa36
parentb5104da9e9204469565e96b7ccac29eeddc18216 (diff)
downloadsite-f487fd80dbc8b15c9a7072abd0c167ac58675bcc.tar.gz
filter-github-emails: Rewrap more carefully
Wrap individual lines instead of formatting whole paragraphs, so that lists such as * first item * second item aren't rewrapped.
-rwxr-xr-xlibexec/filter-github-emails20
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
121sub 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}