Mercurial > vim
annotate runtime/autoload/tohtml.vim @ 2432:80229a724a11 vim73
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 29 Jul 2010 20:43:36 +0200 |
parents | e7751177126b |
children | a29075150aee |
rev | line source |
---|---|
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
1 " Vim autoload file for the tohtml plugin. |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
2 " Maintainer: Ben Fritz <fritzophrenic@gmail.com> |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
3 " Last Change: 2010 Jul 29 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
4 " |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
5 " Additional contributors: |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
6 " |
2334
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
7 " Original by Bram Moolenaar <Bram@vim.org> |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
8 " Diff2HTML() added by Christian Brabandt <cb@256bit.org> |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
9 " |
2334
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
10 " See Mercurial change logs for more! |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
11 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
12 " this file uses line continuations |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
13 let s:cpo_sav = &cpo |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
14 set cpo-=C |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
15 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
16 func! tohtml#Convert2HTML(line1, line2) |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
17 let old_vals = tohtml#OverrideUserSettings() |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
18 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
19 if !&diff || exists("g:html_diff_one_file") |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
20 if a:line2 >= a:line1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
21 let g:html_start_line = a:line1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
22 let g:html_end_line = a:line2 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
23 else |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
24 let g:html_start_line = a:line2 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
25 let g:html_end_line = a:line1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
26 endif |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
27 runtime syntax/2html.vim |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
28 else |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
29 let win_list = [] |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
30 let buf_list = [] |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
31 windo | if &diff | call add(win_list, winbufnr(0)) | endif |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
32 let save_hwf = exists("g:html_whole_filler") |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
33 let g:html_whole_filler = 1 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
34 let g:html_diff_win_num = 0 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
35 for window in win_list |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
36 exe ":" . bufwinnr(window) . "wincmd w" |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
37 let g:html_start_line = 1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
38 let g:html_end_line = line('$') |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
39 let g:html_diff_win_num += 1 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
40 runtime syntax/2html.vim |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
41 call add(buf_list, bufnr('%')) |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
42 endfor |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
43 unlet g:html_diff_win_num |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
44 if !save_hwf |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
45 unlet g:html_whole_filler |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
46 endif |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
47 call tohtml#Diff2HTML(win_list, buf_list) |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
48 endif |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
49 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
50 call tohtml#RestoreUserSettings(old_vals) |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
51 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
52 unlet g:html_start_line |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
53 unlet g:html_end_line |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
54 endfunc |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
55 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
56 func! tohtml#Diff2HTML(win_list, buf_list) |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
57 " TODO: add logic for xhtml |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
58 let style = ['-->'] |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
59 let body_line = '' |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
60 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
61 let html = [] |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
62 call add(html, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
63 call add(html, ' "http://www.w3.org/TR/html4/loose.dtd">') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
64 call add(html, '<html>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
65 call add(html, '<head>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
66 call add(html, '<title>diff</title>') |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
67 call add(html, '<meta name="Generator" content="Vim/'.v:version/100.'.'.v:version%100.'">') |
2401
e7751177126b
Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2334
diff
changeset
|
68 call add(html, '<meta name="plugin-version" content="'.g:loaded_2html_plugin.'">') |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
69 " TODO: copy or move encoding logic from 2html.vim so generated markup can |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
70 " validate without warnings about encoding |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
71 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
72 call add(html, '</head>') |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
73 let body_line_num = len(html) |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
74 call add(html, '<body>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
75 call add(html, '<table border="1" width="100%">') |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
76 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
77 call add(html, '<tr>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
78 for buf in a:win_list |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
79 call add(html, '<th>'.bufname(buf).'</th>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
80 endfor |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
81 call add(html, '</tr><tr>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
82 |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
83 let diff_style_start = 0 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
84 let insert_index = 0 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
85 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
86 for buf in a:buf_list |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
87 let temp = [] |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
88 exe bufwinnr(buf) . 'wincmd w' |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
89 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
90 " If text is folded because of user foldmethod settings, etc. we don't want |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
91 " to act on everything in a fold by mistake. |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
92 setlocal nofoldenable |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
93 |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
94 " When not using CSS or when using xhtml, the <body> line can be important. |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
95 " Assume it will be the same for all buffers and grab it from the first |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
96 " buffer. Similarly, need to grab the body end line as well. |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
97 if body_line == '' |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
98 1 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
99 call search('<body') |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
100 let body_line = getline('.') |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
101 $ |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
102 call search('</body>', 'b') |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
103 let s:body_end_line = getline('.') |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
104 endif |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
105 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
106 " Grab the style information. Some of this will be duplicated... |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
107 1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
108 let style_start = search('^<style type="text/css">') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
109 1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
110 let style_end = search('^</style>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
111 if style_start > 0 && style_end > 0 |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
112 let buf_styles = getline(style_start + 1, style_end - 1) |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
113 for a_style in buf_styles |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
114 if index(style, a_style) == -1 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
115 if diff_style_start == 0 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
116 if a_style =~ '\<Diff\(Change\|Text\|Add\|Delete\)' |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
117 let diff_style_start = len(style)-1 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
118 endif |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
119 endif |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
120 call insert(style, a_style, insert_index) |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
121 let insert_index += 1 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
122 endif |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
123 endfor |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
124 endif |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
125 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
126 if diff_style_start != 0 |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
127 let insert_index = diff_style_start |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
128 endif |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
129 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
130 " Delete those parts that are not needed so |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
131 " we can include the rest into the resulting table |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
132 1,/^<body/d_ |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
133 $ |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
134 ?</body>?,$d_ |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
135 let temp = getline(1,'$') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
136 " undo deletion of start and end part |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
137 " so we can later save the file as valid html |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
138 " TODO: restore using grabbed lines if undolevel is 1? |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
139 normal 2u |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
140 call add(html, '<td nowrap valign="top"><div>') |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
141 let html += temp |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
142 call add(html, '</div></td>') |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
143 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
144 " Close this buffer |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
145 " TODO: the comment above says we're going to allow saving the file |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
146 " later...but here we discard it? |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
147 quit! |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
148 endfor |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
149 |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
150 let html[body_line_num] = body_line |
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
151 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
152 call add(html, '</tr>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
153 call add(html, '</table>') |
2432
80229a724a11
Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents:
2401
diff
changeset
|
154 call add(html, s:body_end_line) |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
155 call add(html, '</html>') |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
156 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
157 let i = 1 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
158 let name = "Diff" . ".html" |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
159 " Find an unused file name if current file name is already in use |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
160 while filereadable(name) |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
161 let name = substitute(name, '\d*\.html$', '', '') . i . ".html" |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
162 let i += 1 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
163 endwhile |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
164 exe "topleft new " . name |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
165 setlocal modifiable |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
166 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
167 " just in case some user autocmd creates content in the new buffer, make sure |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
168 " it is empty before proceeding |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
169 %d |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
170 call append(0, html) |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
171 |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
172 if len(style) > 0 |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
173 1 |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
174 let style_start = search('^</head>')-1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
175 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
176 " Insert javascript to toggle matching folds open and closed in all windows, |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
177 " if dynamic folding is active. |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
178 if exists("g:html_dynamic_folds") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
179 call append(style_start, [ |
2334
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
180 \ "<script type='text/javascript'>", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
181 \ " <!--", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
182 \ " function toggleFold(objID)", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
183 \ " {", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
184 \ " for (win_num = 1; win_num <= ".len(a:buf_list)."; win_num++)", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
185 \ " {", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
186 \ " var fold;", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
187 \ ' fold = document.getElementById("win"+win_num+objID);', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
188 \ " if(fold.className == 'closed-fold')", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
189 \ " {", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
190 \ " fold.className = 'open-fold';", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
191 \ " }", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
192 \ " else if (fold.className == 'open-fold')", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
193 \ " {", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
194 \ " fold.className = 'closed-fold';", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
195 \ " }", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
196 \ " }", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
197 \ " }", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
198 \ " -->", |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
199 \ "</script>" |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
200 \ ]) |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
201 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
202 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
203 " Insert styles from all the generated html documents and additional styles |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
204 " for the table-based layout of the side-by-side diff. The diff should take |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
205 " up the full browser window (but not more), and be static in size, |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
206 " horizontally scrollable when the lines are too long. Otherwise, the diff |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
207 " is pretty useless for really long lines. |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
208 if exists("g:html_use_css") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
209 call append(style_start, [ |
2334
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
210 \ '<style type="text/css">']+ |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
211 \ style+[ |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
212 \ '<!--', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
213 \ 'table { table-layout: fixed; }', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
214 \ 'html, body, table, tbody { width: 100%; margin: 0; padding: 0; }', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
215 \ 'th, td { width: '.printf("%.1f",100.0/len(a:win_list)).'%; }', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
216 \ 'td div { overflow: auto; }', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
217 \ '-->', |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
218 \ '</style>' |
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
219 \ ]) |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
220 endif |
2304
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
221 endif |
a59e6ac5ed28
When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
222 endfunc |
2321
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
223 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
224 func! tohtml#OverrideUserSettings() |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
225 let old_settings = {} |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
226 " make copies of the user-defined settings that we may overrule |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
227 let old_settings.html_dynamic_folds = exists("g:html_dynamic_folds") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
228 let old_settings.html_hover_unfold = exists("g:html_hover_unfold") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
229 let old_settings.html_use_css = exists("g:html_use_css") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
230 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
231 " hover opening implies dynamic folding |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
232 if exists("g:html_hover_unfold") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
233 let g:html_dynamic_folds = 1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
234 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
235 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
236 " dynamic folding with no foldcolumn implies hover opens |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
237 if exists("g:html_dynamic_folds") && exists("g:html_no_foldcolumn") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
238 let g:html_hover_unfold = 1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
239 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
240 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
241 " ignore folding overrides dynamic folding |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
242 if exists("g:html_ignore_folding") && exists("g:html_dynamic_folds") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
243 unlet g:html_dynamic_folds |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
244 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
245 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
246 " dynamic folding implies css |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
247 if exists("g:html_dynamic_folds") |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
248 let g:html_use_css = 1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
249 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
250 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
251 return old_settings |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
252 endfunc |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
253 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
254 func! tohtml#RestoreUserSettings(old_settings) |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
255 " restore any overridden user options |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
256 if a:old_settings.html_dynamic_folds |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
257 let g:html_dynamic_folds = 1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
258 else |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
259 unlet! g:html_dynamic_folds |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
260 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
261 if a:old_settings.html_hover_unfold |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
262 let g:html_hover_unfold = 1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
263 else |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
264 unlet! g:html_hover_unfold |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
265 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
266 if a:old_settings.html_use_css |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
267 let g:html_use_css = 1 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
268 else |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
269 unlet! g:html_use_css |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
270 endif |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
271 endfunc |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
272 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
273 let &cpo = s:cpo_sav |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
274 unlet s:cpo_sav |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
275 |
1902913f2049
Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents:
2304
diff
changeset
|
276 " Make sure any patches will probably use consistent indent |
2334
3c9324c0800e
Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents:
2321
diff
changeset
|
277 " vim: ts=8 sw=2 sts=2 noet |