blob: 34454dbead8577888039a41e1824b8381ec79e45 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/luajit
local re = require 're'
local pat = re.compile([[
str <- {~ (bug / .)* ~} !.
num <- { %d+ }
bug <- (("bgo#" num) -> BGO)
/ (("bko#" num) -> BKO)
/ (("bmo#" num) -> BMO)
/ (("boo#" num) -> BOO)
/ (("bsc#" num) -> BSC)
/ (("gh#" { (!"#" .)+ } "#" { %w+ }) -> GH)
/ (("lp#" num) -> LP)
/ (("rh#" num) -> RH)
]],{
BGO = "http://bugzilla.gnome.org/show_bug.cgi?id=%1",
BKO = "http://bugzilla.kernel.org/show_bug.cgi?id=%1",
BMO = "http://bugzilla.mozilla.org/show_bug.cgi?id=%1",
BOO = "http://bugzilla.opensuse.org/show_bug.cgi?id=%1",
BSC = "http://bugzilla.suse.com/show_bug.cgi?id=%1",
GH = "https://github.com/%1/issues/%2",
LP = "https://launchpad.net/bugs/%1",
RH = "http://bugzilla.redhat.com/show_bug.cgi?id=%1"
});
print(pat:match("gh#python/cpython#123"))
print(pat:match("lp#123456"))
print(pat:match("bramboříček"))
|