Skip to content

Commit

Permalink
feat: allow plus and colon in cites
Browse files Browse the repository at this point in the history
refer: #341
  • Loading branch information
lervag committed Apr 4, 2024
1 parent 34c82a6 commit 9242087
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion autoload/wiki/link/class.vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function! wiki#link#class#new(link_definition, match) abort " {{{1

" Add scheme to URL if it is missing
if has_key(a:link_definition, '__scheme')
let l:link.scheme = a:link_definition.__scheme
let l:link.scheme = type(a:link_definition.__scheme) == v:t_func
\ ? a:link_definition.__scheme()
\ : a:link_definition.__scheme
let l:link.url = l:link.scheme . ':' . l:link.url
else
let l:link.scheme = matchstr(l:link.url, '^\w\+\ze:')
Expand Down
1 change: 1 addition & 0 deletions autoload/wiki/link/definitions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ let g:wiki#link#definitions#cite = {
\ 'type': 'cite',
\ 'rx': wiki#rx#link_cite,
\ 'rx_url': wiki#rx#link_cite_url,
\ '__scheme': { -> wiki#link#get_scheme('cite') },
\}

let g:wiki#link#definitions#date = {
Expand Down
4 changes: 2 additions & 2 deletions autoload/wiki/rx.vim
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ let wiki#rx#link_ref_full =
\ . '[\]\[]\@!'
let wiki#rx#link_ref_target =
\ '^\s*\[' . wiki#rx#reflabel . '\]:\s\+' . wiki#rx#url
let wiki#rx#link_cite = '\%(\s\|^\|\[\)\zs@[-_.a-zA-Z0-9]\+[-_a-zA-Z0-9]'
let wiki#rx#link_cite_url = '\%(\s\|^\|\[\)@\zs[-_.a-zA-Z0-9]\+[-_a-zA-Z0-9]'
let wiki#rx#link_cite = '\%(\s\|^\|\[\)\zs@[-_.+:a-zA-Z0-9]\+[-_a-zA-Z0-9]'
let wiki#rx#link_cite_url = '\%(\s\|^\|\[\)@\zs[-_.+:a-zA-Z0-9]\+[-_a-zA-Z0-9]'
let wiki#rx#link_wiki = '\[\[\/\?[^\\\]]\{-}\%(|[^\\\]]\{-}\)\?\]\]'
let wiki#rx#link = join([
\ wiki#rx#link_wiki,
Expand Down

0 comments on commit 9242087

Please sign in to comment.