From f6437ebdf56eb8e680f31c62c6cd6699dcfc903d Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Sat, 8 Jul 2017 22:06:18 +0200 Subject: [PATCH] Fix regexps of placeholders - the highlighting was wrong when the placeholder is indented - %titleBla was wrongly recongnized as placeholder - make them more robust by prepending \m --- autoload/vimwiki/html.vim | 14 +++++++------- syntax/vimwiki.vim | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index 8ef07bb..35ed259 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -1203,7 +1203,7 @@ function! s:parse_line(line, state) " {{{ " nohtml -- placeholder if !processed - if line =~# '^\s*%nohtml' + if line =~# '\m^\s*%nohtml\s*$' let processed = 1 let state.placeholder = ['nohtml'] endif @@ -1211,27 +1211,27 @@ function! s:parse_line(line, state) " {{{ " title -- placeholder if !processed - if line =~# '^\s*%title' + if line =~# '\m^\s*%title\%(\s.*\)\?$' let processed = 1 - let param = matchstr(line, '^\s*%title\s\zs.*') + let param = matchstr(line, '\m^\s*%title\s\+\zs.*') let state.placeholder = ['title', param] endif endif " date -- placeholder if !processed - if line =~# '^\s*%date' + if line =~# '\m^\s*%date\%(\s.*\)\?$' let processed = 1 - let param = matchstr(line, '^\s*%date\s\zs.*') + let param = matchstr(line, '\m^\s*%date\s\+\zs.*') let state.placeholder = ['date', param] endif endif " html template -- placeholder "{{{ if !processed - if line =~# '^\s*%template' + if line =~# '\m^\s*%template\%(\s.*\)\?$' let processed = 1 - let param = matchstr(line, '^\s*%template\s\zs.*') + let param = matchstr(line, '\m^\s*%template\s\+\zs.*') let state.placeholder = ['template', param] endif endif diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 1a8b67f..81094fa 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -459,10 +459,10 @@ execute 'syntax region VimwikiMath start=/'.g:vimwiki_rxMathStart. " placeholders syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/ -syntax match VimwikiPlaceholder /^\s*%title\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam -syntax match VimwikiPlaceholder /^\s*%date\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam -syntax match VimwikiPlaceholder /^\s*%template\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam -syntax match VimwikiPlaceholderParam /\s.*/ contained +syntax match VimwikiPlaceholder /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite +syntax match VimwikiPlaceholder /^\s*%date\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite +syntax match VimwikiPlaceholder /^\s*%template\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite +syntax match VimwikiPlaceholderParam /.*/ contained " html tags if g:vimwiki_valid_html_tags != ''