Copy CSS file also with :Vimwiki2HTML

This commit is contained in:
EinfachToll 2016-03-19 22:01:25 +01:00
parent 68cdfe36df
commit 0001b3cda9

View File

@ -80,9 +80,10 @@ function! s:create_default_CSS(path) " {{{
if default_css != '' if default_css != ''
let lines = readfile(default_css) let lines = readfile(default_css)
call writefile(lines, css_full_name) call writefile(lines, css_full_name)
echomsg 'Vimwiki: Default style.css has been created' return 1
endif endif
endif endif
return 0
endfunction "}}} endfunction "}}}
function! s:template_full_name(name) "{{{ function! s:template_full_name(name) "{{{
@ -1366,7 +1367,7 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
\ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-')) \ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-'))
endfunction " }}} endfunction " }}}
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{ function! s:convert_file(path_html, wikifile) "{{{
let done = 0 let done = 0
let wikifile = fnamemodify(a:wikifile, ":p") let wikifile = fnamemodify(a:wikifile, ":p")
@ -1456,13 +1457,13 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
if nohtml if nohtml
echon "\r"."%nohtml placeholder found" echon "\r"."%nohtml placeholder found"
return return ''
endif endif
call s:remove_blank_lines(ldest) call s:remove_blank_lines(ldest)
"" process end of file " process end of file
"" close opened tags if any " close opened tags if any
let lines = [] let lines = []
call s:close_tag_quote(state.quote, lines) call s:close_tag_quote(state.quote, lines)
call s:close_tag_para(state.para, lines) call s:close_tag_para(state.para, lines)
@ -1494,7 +1495,6 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
let html_lines = s:html_insert_contents(html_lines, ldest) " %contents% let html_lines = s:html_insert_contents(html_lines, ldest) " %contents%
"" make html file.
call writefile(html_lines, path_html.htmlfile) call writefile(html_lines, path_html.htmlfile)
let done = 1 let done = 1
@ -1502,12 +1502,19 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
if done == 0 if done == 0
echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax' echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
return return ''
endif endif
return path_html.htmlfile return path_html.htmlfile
endfunction "}}} endfunction "}}}
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
let result = s:convert_file(a:path_html, a:wikifile)
if result != ''
call s:create_default_CSS(a:path_html)
endif
return result
endfunction "}}}
function! vimwiki#html#WikiAll2HTML(path_html) "{{{ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
if !s:syntax_supported() && !s:use_custom_wiki2html() if !s:syntax_supported() && !s:use_custom_wiki2html()
@ -1549,7 +1556,7 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
if !s:is_html_uptodate(wikifile) if !s:is_html_uptodate(wikifile)
echomsg 'Vimwiki: Processing '.wikifile echomsg 'Vimwiki: Processing '.wikifile
call vimwiki#html#Wiki2HTML(path_html, wikifile) call s:convert_file(path_html, wikifile)
else else
echomsg 'Vimwiki: Skipping '.wikifile echomsg 'Vimwiki: Skipping '.wikifile
endif endif
@ -1558,7 +1565,10 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
call VimwikiSet('subdir', current_subdir) call VimwikiSet('subdir', current_subdir)
call VimwikiSet('invsubdir', current_invsubdir) call VimwikiSet('invsubdir', current_invsubdir)
call s:create_default_CSS(path_html) let created = s:create_default_CSS(path_html)
if created
echomsg 'Vimwiki: Default style.css has been created'
endif
echomsg 'Vimwiki: HTML exported to '.path_html echomsg 'Vimwiki: HTML exported to '.path_html
echomsg 'Vimwiki: Done!' echomsg 'Vimwiki: Done!'