diff options
author | Yorhel <git@yorhel.nl> | 2015-01-28 13:03:41 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-01-28 13:03:41 +0100 |
commit | c3ef0a575b06ff7ce11108b3137dee4104874db7 (patch) | |
tree | 4aeb4396339e7f60e7d70aba308e6fd9ceb6aa02 | |
parent | 98e6d1a8eb593007d34175b273d23d0fb8fff622 (diff) |
bbSubstLinks: Replace staff IDs with names
-rw-r--r-- | lib/VNDB/Util/Misc.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index 2ffd7827..9917f7fc 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -149,7 +149,7 @@ sub bbSubstLinks { # pre-parse vndb links within message body my (%lookup, %links); - while ($msg =~ m/(?:^|\s)\K([vcpgi])([1-9][0-9]*)\b/g) { + while ($msg =~ m/(?:^|\s)\K([vcpgis])([1-9][0-9]*)\b/g) { $lookup{$1}{$2} = 1; } return $msg unless %lookup; @@ -170,13 +170,16 @@ sub bbSubstLinks { if ($lookup{i}) { $links{"i$_->{id}"} = $_->{name} for (@{$self->dbTraitGet(id => [keys %{$lookup{i}}], @opt)}); } + if ($lookup{s}) { + $links{"s$_->{id}"} = $_->{name} for (@{$self->dbStaffGet(id => [keys %{$lookup{s}}], @opt)}); + } return $msg unless %links; my($result, @open) = ('', 'first'); while($msg =~ m{ - (?:\b([tdvprcugi][1-9]\d*)(?:\.[1-9]\d*)?\b) | # 1. id - (\[[^\s\]]+\]) | # 2. tag - ((?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-]) # 3. url + (?:\b([tdvprcugis][1-9]\d*)(?:\.[1-9]\d*)?\b) | # 1. id + (\[[^\s\]]+\]) | # 2. tag + ((?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-]) # 3. url }x) { my($match, $id, $tag) = ($&, $1, $2); $result .= $`; |