diff options
Diffstat (limited to 'osurl')
-rwxr-xr-x | osurl | 41 |
1 files changed, 21 insertions, 20 deletions
@@ -1,33 +1,34 @@ #!/usr/bin/lua local lpeg = require 'lpeg' -local P,C,Cs,Cf,R = lpeg.P, lpeg.C, lpeg.Cs, lpeg.Cf, lpeg.R +local P,C,Cs,Cf,R,S = lpeg.P, lpeg.C, lpeg.Cs, lpeg.Cf, lpeg.R, lpeg.S local tokens = { NONHASH = C((1 - P("#"))^1), -- any nonempty string not containing # + SEP = S("#-"), -- separators, can be # or - NUM = C(R("09")^1), -- nonempty digit string WORD = C(R("AZ","az","09","__")^1), -- nonempty word - JIRID = C(R("AZ","az","09","--")^1) -- nonempty word + JIRID = C(R("AZ","az","09","--")^1) -- nonempty word } local patterns = { - ["bgo#%NUM"] = "https://bugzilla.gnome.org/show_bug.cgi?id=%1", - ["bpo#%NUM"] = "https://bugs.python.org/issue%1", - ["bko#%NUM"] = "https://bugzilla.kernel.org/show_bug.cgi?id=%1", - ["bmo#%NUM"] = "https://bugzilla.mozilla.org/show_bug.cgi?id=%1", - ["boo#%NUM"] = "https://bugzilla.opensuse.org/show_bug.cgi?id=%1", - ["bnc#%NUM"] = "https://bugzilla.novell.com/show_bug.cgi?id=%1", - ["bsc#%NUM"] = "https://bugzilla.suse.com/show_bug.cgi?id=%1", - ["bds#%NUM"] = "https://build.suse.de/request/show/%1", - ["bdo#%NUM"] = "https://build.opensuse.org/request/show/%1", - ["jsc#%JIRID"] = "https://jira.suse.com/browse/%1", - ["gh#%NONHASH#%WORD"] = "https://github.com/%1/issues/%2", - ["gl#%NONHASH#%WORD"] = "https://gitlab.com/%1/issues/%2", - ["bt#%NONHASH#%WORD"] = "https://bitbucket.org/%1/issues/%2", - ["sh#%NUM"] = "http://sourecforge.net/support/tracker.php?aid=%1", - ["shb#%NONHASH#%NUM"] = "https://sourceforge.net/p/%1/bugs/%2/", - ["shp#%NONHASH#%NUM"] = "https://sourceforge.net/p/%1/patches/%2/", - ["lp#%NUM"] = "https://launchpad.net/bugs/%1", - ["rh#%NUM"] = "https://bugzilla.redhat.com/show_bug.cgi?id=%1", + ["bgo%SEP%NUM"] = "https://bugzilla.gnome.org/show_bug.cgi?id=%1", + ["bpo%SEP%NUM"] = "https://bugs.python.org/issue%1", + ["bko%SEP%NUM"] = "https://bugzilla.kernel.org/show_bug.cgi?id=%1", + ["bmo%SEP%NUM"] = "https://bugzilla.mozilla.org/show_bug.cgi?id=%1", + ["boo%SEP%NUM"] = "https://bugzilla.opensuse.org/show_bug.cgi?id=%1", + ["bnc%SEP%NUM"] = "https://bugzilla.novell.com/show_bug.cgi?id=%1", + ["bsc%SEP%NUM"] = "https://bugzilla.suse.com/show_bug.cgi?id=%1", + ["bds%SEP%NUM"] = "https://build.suse.de/request/show/%1", + ["bdo%SEP%NUM"] = "https://build.opensuse.org/request/show/%1", + ["jsc%SEP%JIRID"] = "https://jira.suse.com/browse/%1", + ["gh%SEP%NONHASH%SEP%WORD"] = "https://github.com/%1/issues/%2", + ["gl%SEP%NONHASH%SEP%WORD"] = "https://gitlab.com/%1/issues/%2", + ["bt%SEP%NONHASH%SEP%WORD"] = "https://bitbucket.org/%1/issues/%2", + ["sh%SEP%NUM"] = "http://sourecforge.net/support/tracker.php?aid=%1", + ["shb%SEP%NONHASH%SEP%NUM"] = "https://sourceforge.net/p/%1/bugs/%2/", + ["shp%SEP%NONHASH%SEP%NUM"] = "https://sourceforge.net/p/%1/patches/%2/", + ["lp%SEP%NUM"] = "https://launchpad.net/bugs/%1", + ["rh%SEP%NUM"] = "https://bugzilla.redhat.com/show_bug.cgi?id=%1", } -- turn "foo#%BLAH" into a pattern that matches everything literally except |