fix(nvim): add Gitlinker support for gitea
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 1m6s
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 1m6s
This commit is contained in:
parent
873b17f69e
commit
5f35a2bdc0
@ -48,12 +48,13 @@ return {
|
|||||||
return string.len(s) >= string.len(t) and string.sub(s, #s - #t + 1) == t
|
return string.len(s) >= string.len(t) and string.sub(s, #s - #t + 1) == t
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param lk gitlinker.Linker
|
local gitea_router = function(type)
|
||||||
local gitlab_orion_router = function(type)
|
|
||||||
return function(lk)
|
return function(lk)
|
||||||
local builder = "https://"
|
local builder = "https://"
|
||||||
.. lk.host
|
.. lk.host
|
||||||
.. "/"
|
.. "/"
|
||||||
|
.. lk.org
|
||||||
|
.. "/"
|
||||||
.. (string_endswith(lk.repo, ".git") and lk.repo:sub(1, #lk.repo - 4) or lk.repo)
|
.. (string_endswith(lk.repo, ".git") and lk.repo:sub(1, #lk.repo - 4) or lk.repo)
|
||||||
.. "/"
|
.. "/"
|
||||||
.. type
|
.. type
|
||||||
@ -65,7 +66,7 @@ return {
|
|||||||
.. lk.lstart
|
.. lk.lstart
|
||||||
|
|
||||||
if lk.lend > lk.lstart then
|
if lk.lend > lk.lstart then
|
||||||
builder = builder .. "-" .. lk.lend
|
builder = builder .. "-L" .. lk.lend
|
||||||
end
|
end
|
||||||
return builder
|
return builder
|
||||||
end
|
end
|
||||||
@ -73,10 +74,10 @@ return {
|
|||||||
return {
|
return {
|
||||||
router = {
|
router = {
|
||||||
browse = {
|
browse = {
|
||||||
["^gitlab%.orion%-technologies%.io"] = gitlab_orion_router("blob"),
|
["^git%.orion%-technologies%.io"] = gitea_router("src"),
|
||||||
},
|
},
|
||||||
blame = {
|
blame = {
|
||||||
["^gitlab%.orion%-technologies%.io"] = gitlab_orion_router("blame"),
|
["^git%.orion%-technologies%.io"] = gitea_router("blame/commit"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user