Skip to content

Commit

Permalink
fix: dash in repo name (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Jul 12, 2023
1 parent 80a6154 commit 47c822f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ in `setup()` function.

## Configuration

```lua
````lua
require('gitlinker').setup({
-- print message in command line
message = true,
Expand All @@ -116,16 +116,16 @@ require('gitlinker').setup({
-- regex pattern based rules
pattern_rules = {
{
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
},
{
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
},
},

Expand Down Expand Up @@ -171,4 +171,4 @@ require('gitlinker').setup({
-- write logs to file
file_log = false,
})
```
````
10 changes: 10 additions & 0 deletions lua/gitlinker/test/test_rules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ local test_cases = {
"https://gitlab.com/ruifm/gitlinker.nvim",
"https://gitlab.com/ruifm/gitlinker.nvim/blob/",
},
-- [13]
{
"git@github.enterprise.io:organization/repository_with_single_dash1",
"https://github.enterprise.io/organization/repository_with_single_dash1/blob/",
},
-- [14]
{
"https://github.enterprise.io/organization/repository____multiple___dash2.git",
"https://github.enterprise.io/organization/repository____multiple___dash2/blob/",
},
}

for i, case in ipairs(test_cases) do
Expand Down

0 comments on commit 47c822f

Please sign in to comment.