" Vim autoload file for the tohtml plugin. " Maintainer: Bram Moolenaar " Last Change: 2010 Jul 11 " " Diff2HTML() added by Christian Brabandt func! tohtml#Convert2HTML(line1, line2) if !&diff || exists("g:diff_one_file") if a:line2 >= a:line1 let g:html_start_line = a:line1 let g:html_end_line = a:line2 else let g:html_start_line = a:line2 let g:html_end_line = a:line1 endif runtime syntax/2html.vim else let win_list = [] let buf_list = [] windo | if (&diff) | call add(win_list, winbufnr(0)) | endif let save_hwf = exists("g:html_whole_filler") let g:html_whole_filler = 1 for window in win_list exe ":" . bufwinnr(window) . "wincmd w" let g:html_start_line = 1 let g:html_end_line = line('$') runtime syntax/2html.vim call add(buf_list, bufnr('%')) endfor if !save_hwf unlet g:html_whole_filler endif call tohtml#Diff2HTML(win_list, buf_list) endif unlet g:html_start_line unlet g:html_end_line endfunc func! tohtml#Diff2HTML(win_list, buf_list) let style = [] let html = [] call add(html, '') call add(html, '') call add(html, '') call add(html, 'diff') call add(html, '') "call add(html, '') call add(html, '') call add(html, '') call add(html, '') "call add(html, '') call add(html, '') for buf in a:win_list call add(html, '') endfor call add(html, '') for buf in a:buf_list let temp = [] exe bufwinnr(buf) . 'wincmd w' " Grab the style information. Some of this will be duplicated... 1 let style_start = search('^') if style_start > 0 && style_end > 0 let style += getline(style_start + 1, style_end - 1) endif " Delete those parts that are not needed so " we can include the rest into the resulting table 1,/^?,$d_ let temp = getline(1,'$') " undo deletion of start and end part " so we can later save the file as valid html normal 2u call add(html, '') " Close this buffer quit! endfor call add(html, '') call add(html, '
'.bufname(buf).'
') let html += temp call add(html, '
') call add(html, '') call add(html, '') let i = 1 let name = "Diff" . ".html" while filereadable(name) let name = substitute(name, '\d*\.html$', '', '') . i . ".html" let i += 1 endw exe "new " . name set modifiable call append(0, html) if len(style) > 0 1 let style_start = search('^') call append(style_start, '') call append(style_start, style) call append(style_start, '