From b54fa1312cbfed4f65a5a2c0a6357629c35a8a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Sat, 30 May 2020 15:04:22 +0200 Subject: [PATCH] Bugfix: file extension for markdown is syntax wide --- autoload/vimwiki/base.vim | 16 ++++++++++------ autoload/vimwiki/vars.vim | 14 +++++++------- syntax/vimwiki.vim | 20 ++++++++++---------- syntax/vimwiki_markdown_custom.vim | 16 ++++++++-------- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 4a13da8..3fc0c5b 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1023,8 +1023,8 @@ function! s:update_wiki_links(wiki_nr, dir, old_url, new_url) abort let old_url_r = '\%(\.[/\\]\)\?' . old_url_r " Compute old url regex with filename between \zs and \ze let old_url_r = vimwiki#base#apply_template( - \ vimwiki#vars#get_syntaxlocal('WikiLinkMatchUrlTemplate', - \ vimwiki#vars#get_wikilocal('syntax', a:wiki_nr)), old_url_r, '', '') + \ vimwiki#vars#get_syntaxlocal('WikiLinkMatchUrlTemplate', vimwiki#vars#get_wikilocal('syntax', a:wiki_nr)) + \, old_url_r, '', '', vimwiki#vars#get_wikilocal('ext', a:wiki_nr)) return old_url_r endfunction @@ -2110,10 +2110,11 @@ endfunction " Construct a regular expression matching from template (with special " characters properly escaped), by substituting rxUrl for __LinkUrl__, rxDesc -" for __LinkDescription__, and rxStyle for __LinkStyle__. The three -" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any -" special character escapes or substitutions. -function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) abort +" for __LinkDescription__, rxStyle for __LinkStyle__ and rxExtension for +" __FileExtention__. The four arguments rxUrl, rxDesc, rxStyle and +" rxExtension are copied verbatim, without any special character escapes or +" substitutions. +function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle, rxExtension) abort let lnk = a:template if a:rxUrl !=? '' let lnk = s:safesubstitute(lnk, '__LinkUrl__', a:rxUrl, 'g') @@ -2124,6 +2125,9 @@ function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) abort if a:rxStyle !=? '' let lnk = s:safesubstitute(lnk, '__LinkStyle__', a:rxStyle, 'g') endif + if a:rxExtension !=? '' + let lnk = s:safesubstitute(lnk, '__FileExtention__', a:rxExtension, 'g') + endif return lnk endfunction diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index f98ddef..4087710 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -787,20 +787,20 @@ function! s:populate_extra_markdown_vars() abort let mkd_syntax.rxWeblink1Suffix = ')' let mkd_syntax.rxWeblink1EscapeCharsSuffix = '\(\\\)\@