From a653e2d8c2992867f1a28e55529df9b4d6da2ed7 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Sun, 25 Nov 2018 17:56:43 +0100 Subject: [PATCH] HTML converter: trim strings correctly The old version didn't remove trailing spaces. --- autoload/vimwiki/html.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index 0fd68d6..4d44510 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -366,7 +366,7 @@ endfunction function! s:linkify_link(src, descr) let src_str = ' href="'.s:escape_html_attribute(a:src).'"' - let descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','') + let descr = vimwiki#u#trim(a:descr) let descr = (descr == "" ? a:src : descr) let descr_str = (descr =~# vimwiki#vars#get_global('rxWikiIncl') \ ? s:tag_wikiincl(descr) @@ -438,7 +438,8 @@ function! s:tag_wikilink(value) let str = a:value let url = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl')) let descr = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr')) - let descr = (substitute(descr,'^\s*\(.*\)\s*$','\1','') != '' ? descr : url) + let descr = vimwiki#u#trim(descr) + let descr = (descr != '' ? descr : url) let line = VimwikiLinkConverter(url, s:current_wiki_file, s:current_html_file) if line == '' @@ -836,7 +837,7 @@ function! s:process_tag_math(line, math) " environment properly let s:current_math_env = matchstr(class, '^%\zs\S\+\ze%') if s:current_math_env != "" - call add(lines, substitute(class, '^%\(\S\+\)%','\\begin{\1}', '')) + call add(lines, substitute(class, '^%\(\S\+\)%', '\\begin{\1}', '')) elseif class != "" call add(lines, "\\\[".class) else