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
This commit is contained in:
EinfachToll 2017-07-08 22:06:18 +02:00
parent 2369fd73aa
commit f6437ebdf5
2 changed files with 11 additions and 11 deletions

View File

@ -1203,7 +1203,7 @@ function! s:parse_line(line, state) " {{{
" nohtml -- placeholder " nohtml -- placeholder
if !processed if !processed
if line =~# '^\s*%nohtml' if line =~# '\m^\s*%nohtml\s*$'
let processed = 1 let processed = 1
let state.placeholder = ['nohtml'] let state.placeholder = ['nohtml']
endif endif
@ -1211,27 +1211,27 @@ function! s:parse_line(line, state) " {{{
" title -- placeholder " title -- placeholder
if !processed if !processed
if line =~# '^\s*%title' if line =~# '\m^\s*%title\%(\s.*\)\?$'
let processed = 1 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] let state.placeholder = ['title', param]
endif endif
endif endif
" date -- placeholder " date -- placeholder
if !processed if !processed
if line =~# '^\s*%date' if line =~# '\m^\s*%date\%(\s.*\)\?$'
let processed = 1 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] let state.placeholder = ['date', param]
endif endif
endif endif
" html template -- placeholder "{{{ " html template -- placeholder "{{{
if !processed if !processed
if line =~# '^\s*%template' if line =~# '\m^\s*%template\%(\s.*\)\?$'
let processed = 1 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] let state.placeholder = ['template', param]
endif endif
endif endif

View File

@ -459,10 +459,10 @@ execute 'syntax region VimwikiMath start=/'.g:vimwiki_rxMathStart.
" placeholders " placeholders
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/ syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
syntax match VimwikiPlaceholder /^\s*%title\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam syntax match VimwikiPlaceholder /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
syntax match VimwikiPlaceholder /^\s*%date\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam syntax match VimwikiPlaceholder /^\s*%date\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
syntax match VimwikiPlaceholder /^\s*%template\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam syntax match VimwikiPlaceholder /^\s*%template\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
syntax match VimwikiPlaceholderParam /\s.*/ contained syntax match VimwikiPlaceholderParam /.*/ contained
" html tags " html tags
if g:vimwiki_valid_html_tags != '' if g:vimwiki_valid_html_tags != ''