summaryrefslogtreecommitdiffstats
path: root/libexec/filter-github-emails
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2014-02-18 22:04:28 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-02-18 22:04:28 (GMT)
commit309e885a592a8d2d21b2b7ae5c1a28c5c89ce1fc (patch)
treefe042eb5a0757f5516a928cbb5322e297ebaec3b /libexec/filter-github-emails
parentdd86a25716364718cbac4b9ea4ee19415408eb77 (diff)
downloadsite-309e885a592a8d2d21b2b7ae5c1a28c5c89ce1fc.tar.gz
filter-github-emails: Rewrap blockquotes properly
When wrapping a line that begins with a ">", let all resulting lines begin with a ">". (Properly handle nested blockquotes, too.)
Diffstat (limited to 'libexec/filter-github-emails')
-rwxr-xr-xlibexec/filter-github-emails14
1 files changed, 13 insertions, 1 deletions
diff --git a/libexec/filter-github-emails b/libexec/filter-github-emails
index 6f1f3a6..326495d 100755
--- a/libexec/filter-github-emails
+++ b/libexec/filter-github-emails
@@ -119,7 +119,19 @@ sub bye {
119# 119#
120 120
121sub rewrap { 121sub rewrap {
122 my $wrap = sub { /^(?: {4}|\t)/ ? $_ : wrap('', '', $_) }; 122 my $wrap = sub {
123 my $line = shift;
124 my $indent;
125
126 if ($line =~ /^(?: {4}|\t)/) {
127 return $line;
128 } elsif (/^([> ]+)/) {
129 $indent = $1;
130 } else {
131 $indent = '';
132 }
133 return wrap('', $indent, $line);
134 };
123 my @lines = split(/\n/, shift); 135 my @lines = split(/\n/, shift);
124 my @wrapped = map { $wrap->($_) } @lines; 136 my @wrapped = map { $wrap->($_) } @lines;
125 137