aboutsummaryrefslogtreecommitdiffstats
path: root/hipchat-stfu.pl
diff options
context:
space:
mode:
authorTeddy Wing2015-06-14 05:11:11 -0400
committerTeddy Wing2015-06-14 05:11:11 -0400
commitf2049b7251a12eb44b1788382900afa10de76b78 (patch)
treefccf1417fc5d86897ca00222270da871b6c04935 /hipchat-stfu.pl
parentca365d9b018d5efccfb639a6fa95581c843e2231 (diff)
downloadirssi-hipchat-stfu-f2049b7251a12eb44b1788382900afa10de76b78.tar.bz2
Construct start message
Make the start message to correspond to the test expectation. Grab the issue link first because that should tip us off that this is the text that will give us the starter data. Also chomp the newline from the test string to match the function result.
Diffstat (limited to 'hipchat-stfu.pl')
-rw-r--r--hipchat-stfu.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/hipchat-stfu.pl b/hipchat-stfu.pl
index 413380a..95bd0d4 100644
--- a/hipchat-stfu.pl
+++ b/hipchat-stfu.pl
@@ -15,6 +15,9 @@ $VERSION = '1.00';
sub prettify_hipchat {
my ($input) = @_;
+ # Grab browse link
+ my ($link) = $input =~ /"([^"]+\/browse\/[^"]+)"/;
+
# Remove HTML tags
$input =~ s/<.+?>//g;
@@ -24,6 +27,11 @@ sub prettify_hipchat {
# Trim whitespace between words
$input =~ s/(\s| ){2,}/ /g;
+ # Construct start message
+ if ($link) {
+ $input =~ s/ Created by/\n$link\nCreated by/g;
+ }
+
return $input;
};