fixed s:get_links so that it finds both link styles when using markdown syntax

This commit is contained in:
Brennen Bearnes
2022-07-18 17:44:04 -06:00
parent 2a8775c21d
commit 3ac8e1ae14
2 changed files with 12 additions and 4 deletions
+10 -4
View File
@@ -947,10 +947,10 @@ function! s:get_links(wikifile, idx) abort
endif
let syntax = vimwiki#vars#get_wikilocal('syntax', a:idx)
let rx_link = vimwiki#vars#get_syntaxlocal('wikilink', syntax)
if syntax ==# 'markdown'
let rx_link = vimwiki#vars#get_syntaxlocal('rxWeblink1MatchUrl', syntax)
else
let rx_link = vimwiki#vars#get_syntaxlocal('wikilink', syntax)
let md_rx_link = vimwiki#vars#get_syntaxlocal('rxWeblink1MatchUrl', syntax)
endif
let links = []
@@ -963,9 +963,15 @@ function! s:get_links(wikifile, idx) abort
while 1
let col = match(line, rx_link, 0, link_count)+1
let link_text = matchstr(line, rx_link, 0, link_count)
" if a link wasn't found, also try markdown syntax (if enabled)
if link_text ==? '' && syntax ==# 'markdown'
let link_text = matchstr(line, md_rx_link, 0, link_count)
endif
if link_text ==? ''
break
endif
let link_count += 1
let target = vimwiki#base#resolve_link(link_text, a:wikifile)
if target.filename !=? '' && target.scheme =~# '\mwiki\d\+\|diary\|file\|local'
@@ -1523,7 +1529,7 @@ function! vimwiki#base#update_listing_in_buffer(Generator, start_header,
" them right back.
let foldenable_save = &l:foldenable
setlocal nofoldenable
" Clause: don't update file if there are no changes
if (join(getline(start_lnum + 2, end_lnum - 1), '') == join(a_list, ''))
return
+2
View File
@@ -3973,6 +3973,7 @@ Contributors and their Github usernames in roughly chronological order:
- Jean-Luc Bastarache (@jlbas)
- Youssof Taha (@ysftaha)
- Thomas Leyh (@leyhline)
- nebulaeandstars (@nebulaeandstars)
==============================================================================
16. Changelog *vimwiki-changelog*
@@ -4046,6 +4047,7 @@ Changed:~
Removed:~
Fixed:~
* PR #1245 / issue #1244: Fix VimwikiBacklinks handling of bracketed links
* Issue #1193: Fix wildcard expansion in |find_autoload_file|
* PR #1108: Fix resolution of leading-slash page links, add link tests
* Allow title values with quotes