annotate runtime/autoload/tohtml.vim @ 32214:a4dafbd8b7d5 v9.0.1438

patch 9.0.1438: .fs files are falsely recognized as forth files Commit: https://github.com/vim/vim/commit/065088d5549e7711668321cc5a77c9a9b684b142 Author: Johan Kotlinski <kotlinski@gmail.com> Date: Sun Apr 2 20:29:38 2023 +0100 patch 9.0.1438: .fs files are falsely recognized as forth files Problem: .fs files are falsely recognized as forth files. Solution: Check 100 lines for something that looks like forth. (Johan Kotlinski, closes #12219, closes #11988)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Apr 2023 21:30:05 +0200
parents cc751d944b7e
children d77a9aab91ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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>
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
3 " Last Change: 2023 Jan 01
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
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
14 set cpo&vim
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
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
16 " Automatically find charsets from all encodings supported natively by Vim. With
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
17 " the 8bit- and 2byte- prefixes, Vim can actually support more encodings than
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
18 " this. Let the user specify these however since they won't be supported on
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
19 " every system.
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
20 "
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
21 " Note, not all of Vim's supported encodings have a charset to use.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
22 "
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
23 " Names in this list are from:
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
24 " http://www.iana.org/assignments/character-sets
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
25 " g:tohtml#encoding_to_charset: {{{
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
26 let g:tohtml#encoding_to_charset = {
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
27 \ 'latin1' : 'ISO-8859-1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
28 \ 'iso-8859-2' : 'ISO-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
29 \ 'iso-8859-3' : 'ISO-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
30 \ 'iso-8859-4' : 'ISO-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
31 \ 'iso-8859-5' : 'ISO-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
32 \ 'iso-8859-6' : 'ISO-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
33 \ 'iso-8859-7' : 'ISO-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
34 \ 'iso-8859-8' : 'ISO-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
35 \ 'iso-8859-9' : 'ISO-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
36 \ 'iso-8859-10' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
37 \ 'iso-8859-13' : 'ISO-8859-13',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
38 \ 'iso-8859-14' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
39 \ 'iso-8859-15' : 'ISO-8859-15',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
40 \ 'koi8-r' : 'KOI8-R',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
41 \ 'koi8-u' : 'KOI8-U',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
42 \ 'macroman' : 'macintosh',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
43 \ 'cp437' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
44 \ 'cp775' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
45 \ 'cp850' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
46 \ 'cp852' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
47 \ 'cp855' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
48 \ 'cp857' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
49 \ 'cp860' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
50 \ 'cp861' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
51 \ 'cp862' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
52 \ 'cp863' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
53 \ 'cp865' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
54 \ 'cp866' : 'IBM866',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
55 \ 'cp869' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
56 \ 'cp874' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
57 \ 'cp1250' : 'windows-1250',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
58 \ 'cp1251' : 'windows-1251',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
59 \ 'cp1253' : 'windows-1253',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
60 \ 'cp1254' : 'windows-1254',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
61 \ 'cp1255' : 'windows-1255',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
62 \ 'cp1256' : 'windows-1256',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
63 \ 'cp1257' : 'windows-1257',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
64 \ 'cp1258' : 'windows-1258',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
65 \ 'euc-jp' : 'EUC-JP',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
66 \ 'sjis' : 'Shift_JIS',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
67 \ 'cp932' : 'Shift_JIS',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
68 \ 'cp949' : '',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
69 \ 'euc-kr' : 'EUC-KR',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
70 \ 'cp936' : 'GBK',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
71 \ 'euc-cn' : 'GB2312',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
72 \ 'big5' : 'Big5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
73 \ 'cp950' : 'Big5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
74 \ 'utf-8' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
75 \ 'ucs-2' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
76 \ 'ucs-2le' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
77 \ 'utf-16' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
78 \ 'utf-16le' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
79 \ 'ucs-4' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
80 \ 'ucs-4le' : 'UTF-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
81 \ }
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
82 lockvar g:tohtml#encoding_to_charset
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
83 " Notes:
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
84 " 1. All UCS/UTF are converted to UTF-8 because it is much better supported
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
85 " 2. Any blank spaces are there because Vim supports it but at least one major
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
86 " web browser does not according to http://wiki.whatwg.org/wiki/Web_Encodings.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
87 " }}}
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
88
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
89 " Only automatically find encodings supported natively by Vim, let the user
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
90 " specify the encoding if it's not natively supported. This function is only
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
91 " used when the user specifies the charset, they better know what they are
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
92 " doing!
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
93 "
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
94 " Names in this list are from:
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
95 " http://www.iana.org/assignments/character-sets
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
96 " g:tohtml#charset_to_encoding: {{{
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
97 let g:tohtml#charset_to_encoding = {
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
98 \ 'iso_8859-1:1987' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
99 \ 'iso-ir-100' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
100 \ 'iso_8859-1' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
101 \ 'iso-8859-1' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
102 \ 'latin1' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
103 \ 'l1' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
104 \ 'ibm819' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
105 \ 'cp819' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
106 \ 'csisolatin1' : 'latin1',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
107 \ 'iso_8859-2:1987' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
108 \ 'iso-ir-101' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
109 \ 'iso_8859-2' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
110 \ 'iso-8859-2' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
111 \ 'latin2' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
112 \ 'l2' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
113 \ 'csisolatin2' : 'iso-8859-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
114 \ 'iso_8859-3:1988' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
115 \ 'iso-ir-109' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
116 \ 'iso_8859-3' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
117 \ 'iso-8859-3' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
118 \ 'latin3' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
119 \ 'l3' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
120 \ 'csisolatin3' : 'iso-8859-3',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
121 \ 'iso_8859-4:1988' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
122 \ 'iso-ir-110' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
123 \ 'iso_8859-4' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
124 \ 'iso-8859-4' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
125 \ 'latin4' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
126 \ 'l4' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
127 \ 'csisolatin4' : 'iso-8859-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
128 \ 'iso_8859-5:1988' : 'iso-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
129 \ 'iso-ir-144' : 'iso-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
130 \ 'iso_8859-5' : 'iso-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
131 \ 'iso-8859-5' : 'iso-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
132 \ 'cyrillic' : 'iso-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
133 \ 'csisolatincyrillic' : 'iso-8859-5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
134 \ 'iso_8859-6:1987' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
135 \ 'iso-ir-127' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
136 \ 'iso_8859-6' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
137 \ 'iso-8859-6' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
138 \ 'ecma-114' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
139 \ 'asmo-708' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
140 \ 'arabic' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
141 \ 'csisolatinarabic' : 'iso-8859-6',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
142 \ 'iso_8859-7:1987' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
143 \ 'iso-ir-126' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
144 \ 'iso_8859-7' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
145 \ 'iso-8859-7' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
146 \ 'elot_928' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
147 \ 'ecma-118' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
148 \ 'greek' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
149 \ 'greek8' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
150 \ 'csisolatingreek' : 'iso-8859-7',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
151 \ 'iso_8859-8:1988' : 'iso-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
152 \ 'iso-ir-138' : 'iso-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
153 \ 'iso_8859-8' : 'iso-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
154 \ 'iso-8859-8' : 'iso-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
155 \ 'hebrew' : 'iso-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
156 \ 'csisolatinhebrew' : 'iso-8859-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
157 \ 'iso_8859-9:1989' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
158 \ 'iso-ir-148' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
159 \ 'iso_8859-9' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
160 \ 'iso-8859-9' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
161 \ 'latin5' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
162 \ 'l5' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
163 \ 'csisolatin5' : 'iso-8859-9',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
164 \ 'iso-8859-10' : 'iso-8859-10',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
165 \ 'iso-ir-157' : 'iso-8859-10',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
166 \ 'l6' : 'iso-8859-10',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
167 \ 'iso_8859-10:1992' : 'iso-8859-10',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
168 \ 'csisolatin6' : 'iso-8859-10',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
169 \ 'latin6' : 'iso-8859-10',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
170 \ 'iso-8859-13' : 'iso-8859-13',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
171 \ 'iso-8859-14' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
172 \ 'iso-ir-199' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
173 \ 'iso_8859-14:1998' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
174 \ 'iso_8859-14' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
175 \ 'latin8' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
176 \ 'iso-celtic' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
177 \ 'l8' : 'iso-8859-14',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
178 \ 'iso-8859-15' : 'iso-8859-15',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
179 \ 'iso_8859-15' : 'iso-8859-15',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
180 \ 'latin-9' : 'iso-8859-15',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
181 \ 'koi8-r' : 'koi8-r',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
182 \ 'cskoi8r' : 'koi8-r',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
183 \ 'koi8-u' : 'koi8-u',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
184 \ 'macintosh' : 'macroman',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
185 \ 'mac' : 'macroman',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
186 \ 'csmacintosh' : 'macroman',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
187 \ 'ibm437' : 'cp437',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
188 \ 'cp437' : 'cp437',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
189 \ '437' : 'cp437',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
190 \ 'cspc8codepage437' : 'cp437',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
191 \ 'ibm775' : 'cp775',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
192 \ 'cp775' : 'cp775',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
193 \ 'cspc775baltic' : 'cp775',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
194 \ 'ibm850' : 'cp850',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
195 \ 'cp850' : 'cp850',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
196 \ '850' : 'cp850',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
197 \ 'cspc850multilingual' : 'cp850',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
198 \ 'ibm852' : 'cp852',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
199 \ 'cp852' : 'cp852',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
200 \ '852' : 'cp852',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
201 \ 'cspcp852' : 'cp852',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
202 \ 'ibm855' : 'cp855',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
203 \ 'cp855' : 'cp855',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
204 \ '855' : 'cp855',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
205 \ 'csibm855' : 'cp855',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
206 \ 'ibm857' : 'cp857',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
207 \ 'cp857' : 'cp857',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
208 \ '857' : 'cp857',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
209 \ 'csibm857' : 'cp857',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
210 \ 'ibm860' : 'cp860',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
211 \ 'cp860' : 'cp860',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
212 \ '860' : 'cp860',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
213 \ 'csibm860' : 'cp860',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
214 \ 'ibm861' : 'cp861',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
215 \ 'cp861' : 'cp861',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
216 \ '861' : 'cp861',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
217 \ 'cp-is' : 'cp861',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
218 \ 'csibm861' : 'cp861',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
219 \ 'ibm862' : 'cp862',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
220 \ 'cp862' : 'cp862',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
221 \ '862' : 'cp862',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
222 \ 'cspc862latinhebrew' : 'cp862',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
223 \ 'ibm863' : 'cp863',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
224 \ 'cp863' : 'cp863',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
225 \ '863' : 'cp863',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
226 \ 'csibm863' : 'cp863',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
227 \ 'ibm865' : 'cp865',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
228 \ 'cp865' : 'cp865',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
229 \ '865' : 'cp865',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
230 \ 'csibm865' : 'cp865',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
231 \ 'ibm866' : 'cp866',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
232 \ 'cp866' : 'cp866',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
233 \ '866' : 'cp866',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
234 \ 'csibm866' : 'cp866',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
235 \ 'ibm869' : 'cp869',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
236 \ 'cp869' : 'cp869',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
237 \ '869' : 'cp869',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
238 \ 'cp-gr' : 'cp869',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
239 \ 'csibm869' : 'cp869',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
240 \ 'windows-1250' : 'cp1250',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
241 \ 'windows-1251' : 'cp1251',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
242 \ 'windows-1253' : 'cp1253',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
243 \ 'windows-1254' : 'cp1254',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
244 \ 'windows-1255' : 'cp1255',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
245 \ 'windows-1256' : 'cp1256',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
246 \ 'windows-1257' : 'cp1257',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
247 \ 'windows-1258' : 'cp1258',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
248 \ 'extended_unix_code_packed_format_for_japanese' : 'euc-jp',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
249 \ 'cseucpkdfmtjapanese' : 'euc-jp',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
250 \ 'euc-jp' : 'euc-jp',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
251 \ 'shift_jis' : 'sjis',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
252 \ 'ms_kanji' : 'sjis',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
253 \ 'sjis' : 'sjis',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
254 \ 'csshiftjis' : 'sjis',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
255 \ 'ibm-thai' : 'cp874',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
256 \ 'csibmthai' : 'cp874',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
257 \ 'ks_c_5601-1987' : 'cp949',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
258 \ 'iso-ir-149' : 'cp949',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
259 \ 'ks_c_5601-1989' : 'cp949',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
260 \ 'ksc_5601' : 'cp949',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
261 \ 'korean' : 'cp949',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
262 \ 'csksc56011987' : 'cp949',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
263 \ 'euc-kr' : 'euc-kr',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
264 \ 'cseuckr' : 'euc-kr',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
265 \ 'gbk' : 'cp936',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
266 \ 'cp936' : 'cp936',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
267 \ 'ms936' : 'cp936',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
268 \ 'windows-936' : 'cp936',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
269 \ 'gb_2312-80' : 'euc-cn',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
270 \ 'iso-ir-58' : 'euc-cn',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
271 \ 'chinese' : 'euc-cn',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
272 \ 'csiso58gb231280' : 'euc-cn',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
273 \ 'big5' : 'big5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
274 \ 'csbig5' : 'big5',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
275 \ 'utf-8' : 'utf-8',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
276 \ 'iso-10646-ucs-2' : 'ucs-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
277 \ 'csunicode' : 'ucs-2',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
278 \ 'utf-16' : 'utf-16',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
279 \ 'utf-16be' : 'utf-16',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
280 \ 'utf-16le' : 'utf-16le',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
281 \ 'utf-32' : 'ucs-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
282 \ 'utf-32be' : 'ucs-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
283 \ 'utf-32le' : 'ucs-4le',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
284 \ 'iso-10646-ucs-4' : 'ucs-4',
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
285 \ 'csucs4' : 'ucs-4'
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
286 \ }
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
287 lockvar g:tohtml#charset_to_encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
288 "}}}
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
289
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
290 func! tohtml#Convert2HTML(line1, line2) "{{{
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
291 let s:settings = tohtml#GetUserSettings()
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
292
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
293 if !&diff || s:settings.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
294 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
295 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
296 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
297 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
298 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
299 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
300 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
301 runtime syntax/2html.vim "}}}
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
302 else "{{{
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
303 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
304 let buf_list = []
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents: 5003
diff changeset
305 windo if &diff | call add(win_list, winbufnr(0)) | endif
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
306 let s:settings.whole_filler = 1
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
307 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
308 for window in win_list
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
309 " switch to the next buffer to convert
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
310 exe ":" . bufwinnr(window) . "wincmd w"
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
311
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
312 " figure out whether current charset and encoding will work, if not
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
313 " default to UTF-8
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
314 if !exists('g:html_use_encoding') &&
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
315 \ (((&l:fileencoding=='' || (&l:buftype!='' && &l:buftype!=?'help'))
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
316 \ && &encoding!=?s:settings.vim_encoding)
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
317 \ || &l:fileencoding!='' && &l:fileencoding!=?s:settings.vim_encoding)
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
318 echohl WarningMsg
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
319 echomsg "TOhtml: mismatched file encodings in Diff buffers, using UTF-8"
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
320 echohl None
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
321 let s:settings.vim_encoding = 'utf-8'
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
322 let s:settings.encoding = 'UTF-8'
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
323 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
324
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
325 " set up for diff-mode conversion
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
326 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
327 let g:html_end_line = line('$')
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
328 let g:html_diff_win_num += 1
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
329
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
330 " convert this 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
331 runtime syntax/2html.vim
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
332
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
333 " remember the HTML buffer for later combination
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
334 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
335 endfor
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
336 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
337 call tohtml#Diff2HTML(win_list, buf_list)
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
338 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
339
a59e6ac5ed28 When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
340 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
341 unlet g:html_end_line
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
342 unlet s:settings
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
343 endfunc "}}}
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
344
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
345 func! tohtml#Diff2HTML(win_list, buf_list) "{{{
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
346 let xml_line = ""
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
347 let tag_close = '>'
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
348
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
349 let s:old_paste = &paste
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
350 set paste
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
351 let s:old_magic = &magic
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
352 set magic
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
353
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
354 let html = []
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
355 if !s:settings.no_doc
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
356 if s:settings.use_xhtml
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
357 if s:settings.encoding != ""
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
358 let xml_line = "<?xml version=\"1.0\" encoding=\"" . s:settings.encoding . "\"?>"
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
359 else
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
360 let xml_line = "<?xml version=\"1.0\"?>"
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
361 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
362 let tag_close = ' />'
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
363 endif
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
364
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
365 let style = [s:settings.use_xhtml ? "" : '-->']
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
366 let body_line = ''
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
367
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
368 let s:html5 = 0
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
369 if s:settings.use_xhtml
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
370 call add(html, xml_line)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
371 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
372 if s:settings.use_xhtml
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
373 call add(html, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
374 call add(html, '<html xmlns="http://www.w3.org/1999/xhtml">')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
375 elseif s:settings.use_css && !s:settings.no_pre
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
376 call add(html, "<!DOCTYPE html>")
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
377 call add(html, '<html>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
378 let s:html5 = 1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
379 else
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
380 call add(html, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
381 call add(html, ' "http://www.w3.org/TR/html4/loose.dtd">')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
382 call add(html, '<html>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
383 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
384 call add(html, '<head>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
385
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
386 " include encoding as close to the top as possible, but only if not already
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
387 " contained in XML information
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
388 if s:settings.encoding != "" && !s:settings.use_xhtml
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
389 if s:html5
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
390 call add(html, '<meta charset="' . s:settings.encoding . '"' . tag_close)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
391 else
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
392 call add(html, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.encoding . '"' . tag_close)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
393 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
394 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
395
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
396 call add(html, '<title>diff</title>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
397 call add(html, '<meta name="Generator" content="Vim/'.v:version/100.'.'.v:version%100.'"'.tag_close)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
398 call add(html, '<meta name="plugin-version" content="'.g:loaded_2html_plugin.'"'.tag_close)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
399 call add(html, '<meta name="settings" content="'.
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
400 \ join(filter(keys(s:settings),'s:settings[v:val]'),',').
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
401 \ ',prevent_copy='.s:settings.prevent_copy.
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
402 \ ',use_input_for_pc='.s:settings.use_input_for_pc.
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
403 \ '"'.tag_close)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
404 call add(html, '<meta name="colorscheme" content="'.
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
405 \ (exists('g:colors_name')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
406 \ ? g:colors_name
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
407 \ : 'none'). '"'.tag_close)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
408
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
409 call add(html, '</head>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
410 let body_line_num = len(html)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
411 call add(html, '<body'.(s:settings.line_ids ? ' onload="JumpToLine();"' : '').'>')
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
412 endif
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
413 call add(html, "<table ".(s:settings.use_css? "" : "border='1' width='100%' ")."id='vimCodeElement".s:settings.id_suffix."'>")
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
414
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
415 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
416 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
417 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
418 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
419 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
420
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
421 let diff_style_start = 0
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
422 let insert_index = 0
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
423
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
424 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
425 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
426 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
427
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
428 " 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
429 " to act on everything in a fold by mistake.
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
430 setlocal nofoldenable
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
431
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
432 " 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
433 " 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
434 " buffer. Similarly, need to grab the body end line as well.
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
435 if !s:settings.no_doc
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
436 if body_line == ''
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
437 1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
438 call search('<body')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
439 let body_line = getline('.')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
440 $
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
441 call search('</body>', 'b')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
442 let s:body_end_line = getline('.')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
443 endif
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
444
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
445 " Grab the style information. Some of this will be duplicated so only insert
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
446 " it if it's not already there. {{{
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
447 1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
448 let style_start = search('^<style\( type="text/css"\)\?>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
449 1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
450 let style_end = search('^</style>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
451 if style_start > 0 && style_end > 0
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
452 let buf_styles = getline(style_start + 1, style_end - 1)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
453 for a_style in buf_styles
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
454 if index(style, a_style) == -1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
455 if diff_style_start == 0
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
456 if a_style =~ '\<Diff\(Change\|Text\|Add\|Delete\)'
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
457 let diff_style_start = len(style)-1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
458 endif
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
459 endif
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
460 call insert(style, a_style, insert_index)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
461 let insert_index += 1
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
462 endif
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
463 endfor
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
464 endif " }}}
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
465
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
466 " everything new will get added before the diff styles so diff highlight
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
467 " properly overrides normal highlight
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
468 if diff_style_start != 0
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
469 let insert_index = diff_style_start
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
470 endif
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
471
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
472 " Delete those parts that are not needed so we can include the rest into the
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
473 " resulting table.
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
474 1,/^<body.*\%(\n<!--.*-->\_s\+.*id='oneCharWidth'.*\_s\+.*id='oneInputWidth'.*\_s\+.*id='oneEmWidth'\)\?\zs/d_
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
475 $
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
476 ?</body>?,$d_
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
477 elseif !s:settings.no_modeline
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
478 " remove modeline from source files if it is included and we haven't deleted
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
479 " due to removing html footer already
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
480 $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
481 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
482 let temp = getline(1,'$')
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
483 " clean out id on the main content container because we already set it on
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
484 " the table
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
485 let temp[0] = substitute(temp[0], " id='vimCodeElement[^']*'", "", "")
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
486 " 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
487 " 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
488 " TODO: restore using grabbed lines if undolevel is 1?
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
489 if !s:settings.no_doc
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
490 normal! 2u
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
491 elseif !s:settings.no_modeline
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
492 normal! u
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
493 endif
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
494 if s:settings.use_css
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
495 call add(html, '<td><div>')
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
496 elseif s:settings.use_xhtml
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
497 call add(html, '<td nowrap="nowrap" valign="top"><div>')
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
498 else
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
499 call add(html, '<td nowrap valign="top"><div>')
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
500 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
501 let html += temp
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
502 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
503
a59e6ac5ed28 When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
504 " Close this buffer
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
505 " 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
506 " 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
507 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
508 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
509
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
510 if !s:settings.no_doc
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
511 let html[body_line_num] = body_line
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
512 endif
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
513
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
514 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
515 call add(html, '</table>')
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
516 if !s:settings.no_doc
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
517 call add(html, s:body_end_line)
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
518 call add(html, '</html>')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
519 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
520
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
521 " The generated HTML is admittedly ugly and takes a LONG time to fold.
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
522 " Make sure the user doesn't do syntax folding when loading a generated file,
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
523 " using a modeline.
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
524 if !s:settings.no_modeline
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
525 call add(html, '<!-- vim: set foldmethod=manual : -->')
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
526 endif
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
527
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
528 let i = 1
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
529 let name = "Diff" . (s:settings.use_xhtml ? ".xhtml" : ".html")
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
530 " 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
531 while filereadable(name)
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
532 let name = substitute(name, '\d*\.x\?html$', '', '') . i . '.' . fnamemodify(copy(name), ":t:e")
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
533 let i += 1
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
534 endwhile
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
535
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
536 let s:ei_sav = &eventignore
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
537 set eventignore+=FileType
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
538 exe "topleft new " . name
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
539 let &eventignore=s:ei_sav
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
540 unlet s:ei_sav
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
541
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
542 setlocal modifiable
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
543
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
544 " 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
545 " it is empty before proceeding
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
546 %d
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
547
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
548 " set the fileencoding to match the charset we'll be using
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
549 let &l:fileencoding=s:settings.vim_encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
550
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
551 " According to http://www.w3.org/TR/html4/charset.html#doc-char-set, the byte
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
552 " order mark is highly recommend on the web when using multibyte encodings. But,
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
553 " it is not a good idea to include it on UTF-8 files. Otherwise, let Vim
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
554 " determine when it is actually inserted.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
555 if s:settings.vim_encoding == 'utf-8'
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
556 setlocal nobomb
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
557 else
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
558 setlocal bomb
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
559 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
560
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
561 call append(0, html)
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
562
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
563 if !s:settings.no_doc
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
564 if len(style) > 0
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
565 1
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
566 let style_start = search('^</head>')-1
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
567
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
568 " add required javascript in reverse order so we can just call append again
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
569 " and again without adjusting {{{
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
570
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
571 let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
572
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
573 " insert script closing tag if needed
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
574 if s:uses_script
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
575 call append(style_start, [
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
576 \ '',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
577 \ s:settings.use_xhtml ? '//]]>' : '-->',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
578 \ "</script>"
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
579 \ ])
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
580 endif
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
581
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
582 " insert javascript to get IDs from line numbers, and to open a fold before
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
583 " jumping to any lines contained therein
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
584 if s:settings.line_ids
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
585 call append(style_start, [
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
586 \ " /* Always jump to new location even if the line was hidden inside a fold, or",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
587 \ " * we corrected the raw number to a line ID.",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
588 \ " */",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
589 \ " if (lineElem) {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
590 \ " lineElem.scrollIntoView(true);",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
591 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
592 \ " return true;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
593 \ "}",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
594 \ "if ('onhashchange' in window) {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
595 \ " window.onhashchange = JumpToLine;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
596 \ "}"
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
597 \ ])
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
598
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
599 if s:settings.dynamic_folds
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
600 call append(style_start, [
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
601 \ "",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
602 \ " /* navigate upwards in the DOM tree to open all folds containing the line */",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
603 \ " var node = lineElem;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
604 \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
605 \ " {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
606 \ " if (node.className == 'closed-fold')",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
607 \ " {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
608 \ " /* toggle open the fold ID (remove window ID) */",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
609 \ " toggleFold(node.id.substr(4));",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
610 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
611 \ " node = node.parentNode;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
612 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
613 \ ])
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
614 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
615 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
616
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
617 if s:settings.line_ids
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
618 call append(style_start, [
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
619 \ "",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
620 \ "/* function to open any folds containing a jumped-to line before jumping to it */",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
621 \ "function JumpToLine()",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
622 \ "{",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
623 \ " var lineNum;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
624 \ " lineNum = window.location.hash;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
625 \ " lineNum = lineNum.substr(1); /* strip off '#' */",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
626 \ "",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
627 \ " if (lineNum.indexOf('L') == -1) {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
628 \ " lineNum = 'L'+lineNum;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
629 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
630 \ " if (lineNum.indexOf('W') == -1) {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
631 \ " lineNum = 'W1'+lineNum;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
632 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
633 \ " var lineElem = document.getElementById(lineNum);"
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
634 \ ])
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
635 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
636
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
637 " Insert javascript to toggle matching folds open and closed in all windows,
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
638 " if dynamic folding is active.
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
639 if s:settings.dynamic_folds
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
640 call append(style_start, [
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
641 \ " function toggleFold(objID)",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
642 \ " {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
643 \ " for (win_num = 1; win_num <= ".len(a:buf_list)."; win_num++)",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
644 \ " {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
645 \ " var fold;",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
646 \ ' fold = document.getElementById("win"+win_num+objID);',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
647 \ " if(fold.className == 'closed-fold')",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
648 \ " {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
649 \ " fold.className = 'open-fold';",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
650 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
651 \ " else if (fold.className == 'open-fold')",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
652 \ " {",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
653 \ " fold.className = 'closed-fold';",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
654 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
655 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
656 \ " }",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
657 \ ])
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
658 endif
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
659
31885
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
660 if s:uses_script
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
661 " insert script tag if needed
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
662 call append(style_start, [
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
663 \ "<script" . (s:html5 ? "" : " type='text/javascript'") . ">",
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
664 \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
665 endif
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
666
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
667 " Insert styles from all the generated html documents and additional styles
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
668 " for the table-based layout of the side-by-side diff. The diff should take
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
669 " up the full browser window (but not more), and be static in size,
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
670 " horizontally scrollable when the lines are too long. Otherwise, the diff
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
671 " is pretty useless for really long lines. {{{
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
672 if s:settings.use_css
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
673 call append(style_start,
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
674 \ ['<style' . (s:html5 ? '' : 'type="text/css"') . '>']+
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
675 \ style+
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
676 \ [ s:settings.use_xhtml ? '' : '<!--',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
677 \ 'table { table-layout: fixed; }',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
678 \ 'html, body, table, tbody { width: 100%; margin: 0; padding: 0; }',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
679 \ 'table, td, th { border: 1px solid; }',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
680 \ 'td { vertical-align: top; }',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
681 \ 'th, td { width: '.printf("%.1f",100.0/len(a:win_list)).'%; }',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
682 \ 'td div { overflow: auto; }',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
683 \ s:settings.use_xhtml ? '' : '-->',
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
684 \ '</style>'
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
685 \])
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
686 endif "}}}
cc751d944b7e Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
687 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
688 endif
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
689
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
690 let &paste = s:old_paste
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
691 let &magic = s:old_magic
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
692 endfunc "}}}
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
693
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
694 " Gets a single user option and sets it in the passed-in Dict, or gives it the
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
695 " default value if the option doesn't actually exist.
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
696 func! tohtml#GetOption(settings, option, default) "{{{
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
697 if exists('g:html_'.a:option)
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
698 let a:settings[a:option] = g:html_{a:option}
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
699 else
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
700 let a:settings[a:option] = a:default
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
701 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
702 endfunc "}}}
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
703
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
704 " returns a Dict containing the values of all user options for 2html, including
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
705 " default values for those not given an explicit value by the user. Discards the
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
706 " html_ prefix of the option for nicer looking code.
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
707 func! tohtml#GetUserSettings() "{{{
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
708 if exists('s:settings')
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
709 " just restore the known options if we've already retrieved them
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
710 return s:settings
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
711 else
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
712 " otherwise figure out which options are set
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
713 let user_settings = {}
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
714
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
715 " Define the correct option if the old option name exists and we haven't
25773
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18639
diff changeset
716 " already defined the correct one. Maybe I'll put out a warning message about
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
717 " this sometime and remove the old option entirely at some even later time,
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
718 " but for now just silently accept the old option.
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
719 if exists('g:use_xhtml') && !exists("g:html_use_xhtml")
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
720 let g:html_use_xhtml = g:use_xhtml
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
721 endif
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
722
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
723 " get current option settings with appropriate defaults {{{
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
724 call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
725 call tohtml#GetOption(user_settings, 'diff_one_file', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
726 call tohtml#GetOption(user_settings, 'number_lines', &number )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
727 call tohtml#GetOption(user_settings, 'pre_wrap', &wrap )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
728 call tohtml#GetOption(user_settings, 'use_css', 1 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
729 call tohtml#GetOption(user_settings, 'ignore_conceal', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
730 call tohtml#GetOption(user_settings, 'ignore_folding', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
731 call tohtml#GetOption(user_settings, 'dynamic_folds', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
732 call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding)
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
733 call tohtml#GetOption(user_settings, 'hover_unfold', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
734 call tohtml#GetOption(user_settings, 'no_pre', 0 )
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
735 call tohtml#GetOption(user_settings, 'no_doc', 0 )
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
736 call tohtml#GetOption(user_settings, 'no_links', 0 )
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
737 call tohtml#GetOption(user_settings, 'no_modeline', 0 )
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
738 call tohtml#GetOption(user_settings, 'no_invalid', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
739 call tohtml#GetOption(user_settings, 'whole_filler', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
740 call tohtml#GetOption(user_settings, 'use_xhtml', 0 )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
741 call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines )
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
742 call tohtml#GetOption(user_settings, 'use_input_for_pc', 'fallback')
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
743 " }}}
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
744
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
745 " override those settings that need it {{{
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
746
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
747 " hover opening implies dynamic folding
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
748 if user_settings.hover_unfold
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
749 let user_settings.dynamic_folds = 1
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
750 endif
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
751
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
752 " ignore folding overrides dynamic folding
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
753 if user_settings.ignore_folding && user_settings.dynamic_folds
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
754 let user_settings.dynamic_folds = 0
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
755 let user_settings.hover_unfold = 0
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
756 endif
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
757
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
758 " dynamic folding with no foldcolumn implies hover opens
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
759 if user_settings.dynamic_folds && user_settings.no_foldcolumn
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
760 let user_settings.hover_unfold = 1
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
761 endif
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
762
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
763 " dynamic folding implies css
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
764 if user_settings.dynamic_folds
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
765 let user_settings.use_css = 1
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
766 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
767 let user_settings.no_foldcolumn = 1 " won't do anything but for consistency and for the test suite
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
768 endif
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
769
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
770 " if we're not using CSS we cannot use a pre section because <font> tags
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
771 " aren't allowed inside a <pre> block
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
772 if !user_settings.use_css
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
773 let user_settings.no_pre = 1
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
774 endif
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
775
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
776 " pre_wrap doesn't do anything if not using pre or not using CSS
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
777 if user_settings.no_pre || !user_settings.use_css
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
778 let user_settings.pre_wrap = 0
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
779 endif
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
780 "}}}
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
781
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
782 " set up expand_tabs option after all the overrides so we know the
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
783 " appropriate defaults {{{
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
784 if user_settings.no_pre == 0
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
785 call tohtml#GetOption(user_settings,
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
786 \ 'expand_tabs',
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
787 \ &expandtab || &ts != 8 || &vts != '' || user_settings.number_lines ||
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
788 \ (user_settings.dynamic_folds && !user_settings.no_foldcolumn))
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
789 else
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
790 let user_settings.expand_tabs = 1
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
791 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
792 " }}}
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
793
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
794 " textual options
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
795 if exists("g:html_use_encoding") "{{{
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
796 " user specified the desired MIME charset, figure out proper
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
797 " 'fileencoding' from it or warn the user if we cannot
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
798 let user_settings.encoding = g:html_use_encoding
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
799 let user_settings.vim_encoding = tohtml#EncodingFromCharset(g:html_use_encoding)
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
800 if user_settings.vim_encoding == ''
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
801 echohl WarningMsg
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
802 echomsg "TOhtml: file encoding for"
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
803 \ g:html_use_encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
804 \ "unknown, please set 'fileencoding'"
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
805 echohl None
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
806 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
807 else
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
808 " Figure out proper MIME charset from 'fileencoding' if possible
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
809 if &l:fileencoding != ''
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
810 " If the buffer is not a "normal" type, the 'fileencoding' value may not
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
811 " be trusted; since the buffer should not be written the fileencoding is
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
812 " not intended to be used.
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
813 if &l:buftype=='' || &l:buftype==?'help'
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
814 let user_settings.vim_encoding = &l:fileencoding
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
815 call tohtml#CharsetFromEncoding(user_settings)
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
816 else
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
817 let user_settings.encoding = '' " trigger detection using &encoding
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
818 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
819 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
820
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
821 " else from 'encoding' if possible
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
822 if &l:fileencoding == '' || user_settings.encoding == ''
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
823 let user_settings.vim_encoding = &encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
824 call tohtml#CharsetFromEncoding(user_settings)
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
825 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
826
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
827 " else default to UTF-8 and warn user
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
828 if user_settings.encoding == ''
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
829 let user_settings.vim_encoding = 'utf-8'
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
830 let user_settings.encoding = 'UTF-8'
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
831 echohl WarningMsg
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
832 echomsg "TOhtml: couldn't determine MIME charset, using UTF-8"
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
833 echohl None
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
834 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
835 endif "}}}
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
836
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
837 " Default to making nothing uncopyable, because we default to
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
838 " not-standards way of doing things, and also because Microsoft Word and
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
839 " others paste the <input> elements anyway.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
840 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
841 " html_prevent_copy only has an effect when using CSS.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
842 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
843 " All options:
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
844 " f - fold column
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
845 " n - line numbers (also within fold text)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
846 " t - fold text
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
847 " d - diff filler
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
848 " c - concealed text (reserved future)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
849 " l - listchars (reserved possible future)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
850 " s - signs (reserved possible future)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
851 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
852 " Normal text is always selectable.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
853 let user_settings.prevent_copy = ""
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
854 if user_settings.use_css
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
855 if exists("g:html_prevent_copy")
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
856 if user_settings.dynamic_folds && !user_settings.no_foldcolumn && g:html_prevent_copy =~# 'f'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
857 let user_settings.prevent_copy .= 'f'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
858 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
859 if user_settings.number_lines && g:html_prevent_copy =~# 'n'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
860 let user_settings.prevent_copy .= 'n'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
861 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
862 if &diff && g:html_prevent_copy =~# 'd'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
863 let user_settings.prevent_copy .= 'd'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
864 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
865 if !user_settings.ignore_folding && g:html_prevent_copy =~# 't'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
866 let user_settings.prevent_copy .= 't'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
867 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
868 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
869 let user_settings.prevent_copy = ""
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
870 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
871 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
872 if empty(user_settings.prevent_copy)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
873 let user_settings.no_invalid = 0
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
874 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
875
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
876 " enforce valid values for use_input_for_pc
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
877 if user_settings.use_input_for_pc !~# 'fallback\|none\|all'
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
878 let user_settings.use_input_for_pc = 'fallback'
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
879 echohl WarningMsg
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
880 echomsg '2html: "' . g:html_use_input_for_pc . '" is not valid for g:html_use_input_for_pc'
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
881 echomsg '2html: defaulting to "' . user_settings.use_input_for_pc . '"'
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
882 echohl None
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
883 sleep 3
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
884 endif
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
885
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
886 if exists('g:html_id_expr')
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
887 let user_settings.id_suffix = eval(g:html_id_expr)
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
888 if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$'
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
889 echohl WarningMsg
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
890 echomsg '2html: g:html_id_expr evaluated to invalid string for HTML id attributes'
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
891 echomsg '2html: Omitting user-specified suffix'
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
892 echohl None
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
893 sleep 3
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
894 let user_settings.id_suffix=""
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
895 endif
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
896 else
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
897 let user_settings.id_suffix=""
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
898 endif
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
899
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
900 " TODO: font
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
901
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
902 return user_settings
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
903 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
904 endfunc "}}}
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
905
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
906 " get the proper HTML charset name from a Vim encoding option.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
907 function! tohtml#CharsetFromEncoding(settings) "{{{
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
908 let l:vim_encoding = a:settings.vim_encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
909 if exists('g:html_charset_override') && has_key(g:html_charset_override, l:vim_encoding)
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
910 let a:settings.encoding = g:html_charset_override[l:vim_encoding]
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
911 else
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
912 if l:vim_encoding =~ '^8bit\|^2byte'
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
913 " 8bit- and 2byte- prefixes are to indicate encodings available on the
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
914 " system that Vim will convert with iconv(), look up just the encoding name,
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
915 " not Vim's prefix.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
916 let l:vim_encoding = substitute(l:vim_encoding, '^8bit-\|^2byte-', '', '')
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
917 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
918 if has_key(g:tohtml#encoding_to_charset, l:vim_encoding)
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
919 let a:settings.encoding = g:tohtml#encoding_to_charset[l:vim_encoding]
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
920 else
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
921 let a:settings.encoding = ""
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
922 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
923 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
924 if a:settings.encoding != ""
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
925 let l:vim_encoding = tohtml#EncodingFromCharset(a:settings.encoding)
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
926 if l:vim_encoding != ""
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
927 " if the Vim encoding to HTML encoding conversion is set up (by default or
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
928 " by the user) to convert to a different encoding, we need to also change
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
929 " the Vim encoding of the new buffer
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
930 let a:settings.vim_encoding = l:vim_encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
931 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
932 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
933 endfun "}}}
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
934
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
935 " Get the proper Vim encoding option setting from an HTML charset name.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
936 function! tohtml#EncodingFromCharset(encoding) "{{{
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
937 if exists('g:html_encoding_override') && has_key(g:html_encoding_override, a:encoding)
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
938 return g:html_encoding_override[a:encoding]
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
939 elseif has_key(g:tohtml#charset_to_encoding, tolower(a:encoding))
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
940 return g:tohtml#charset_to_encoding[tolower(a:encoding)]
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
941 else
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
942 return ""
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
943 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
944 endfun "}}}
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
945
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
946 let &cpo = s:cpo_sav
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
947 unlet s:cpo_sav
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
948
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
949 " Make sure any patches will probably use consistent indent
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
950 " vim: ts=8 sw=2 sts=2 noet fdm=marker