fix regexes for bug and launchpad linking

use \b (word boundary) to ensure we don't randomly start
generating a link if the characters end up at the end of an
unrelated word.

Change \s to ' \t' to drop \n so we don't link across paragraph
boundaries.

Both of these issues have been found in gerrit reviews, and cause
for some really weird linking.

Fix proper escaping of \b

Change-Id: Ic0f27775459fe48487b287c6dec63605999d293a
Reviewed-on: https://review.openstack.org/17958
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Sean Dague 2012-12-12 13:19:43 -05:00 committed by Jenkins
parent 9400630408
commit 82232d747a

View File

@ -101,12 +101,12 @@ class openstack_project::gerrit (
},
{
name => 'launchpad',
match => '([Bb]ug|[Ll][Pp])[\\s#:]*(\\d+)',
match => '(\\b[Bb]ug|[Ll][Pp]\\b)[ \\t#:]*(\\d+)',
link => 'https://code.launchpad.net/bugs/$2',
},
{
name => 'blueprint',
match => '([Bb]lue[Pp]rint|[Bb][Pp])[\\s#:]*([A-Za-z0-9\\-]+)',
match => '(\\b[Bb]lue[Pp]rint|[Bb][Pp]\\b)[ \\t#:]*([A-Za-z0-9\\-]+)',
link => 'https://blueprints.launchpad.net/openstack/?searchtext=$2',
},
],