HTML converter: trim strings correctly

The old version didn't remove trailing spaces.
This commit is contained in:
EinfachToll 2018-11-25 17:56:43 +01:00
parent 349d551181
commit a653e2d8c2

View File

@ -366,7 +366,7 @@ endfunction
function! s:linkify_link(src, descr) function! s:linkify_link(src, descr)
let src_str = ' href="'.s:escape_html_attribute(a:src).'"' 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 = (descr == "" ? a:src : descr)
let descr_str = (descr =~# vimwiki#vars#get_global('rxWikiIncl') let descr_str = (descr =~# vimwiki#vars#get_global('rxWikiIncl')
\ ? s:tag_wikiincl(descr) \ ? s:tag_wikiincl(descr)
@ -438,7 +438,8 @@ function! s:tag_wikilink(value)
let str = a:value let str = a:value
let url = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl')) let url = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
let descr = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr')) 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) let line = VimwikiLinkConverter(url, s:current_wiki_file, s:current_html_file)
if line == '' if line == ''