annotate runtime/syntax/2html.vim @ 34264:cce6b834635c v9.1.0071

patch 9.1.0071: Need a diff() Vim script function Commit: https://github.com/vim/vim/commit/fa37835b8c0ed0f83952978fca4c332335ca7c46 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Feb 1 22:05:27 2024 +0100 patch 9.1.0071: Need a diff() Vim script function Problem: Need a diff() Vim script function Solution: Add the diff() Vim script function using the xdiff internal diff library, add support for "unified" and "indices" mode. (Yegappan Lakshmanan) fixes: #4241 closes: #12321 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Feb 2024 22:30:03 +0100
parents d77a9aab91ad
children 02d9b7497d7c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax support file
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2 " Maintainer: Ben Fritz <fritzophrenic@gmail.com>
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
3 " Last Change: 2023 Sep 05
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:
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
6 "
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
7 " Original by Bram Moolenaar <Bram@vim.org>
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
8 " Modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
9 " XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
10 " Made w3 compliant by Edd Barrett <vext01@gmail.com>
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
11 " Added html_font. Edd Barrett <vext01@gmail.com>
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
12 " Progress bar based off code from "progressbar widget" plugin by
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
13 " Andreas Politz, heavily modified:
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
14 " http://www.vim.org/scripts/script.php?script_id=2006
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
15 "
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
16 " See Mercurial change logs for more!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " Transform a file into HTML, using the current syntax highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
20 " this file uses line continuations
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
21 let s:cpo_sav = &cpo
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
22 let s:ls = &ls
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
23 let s:ei_sav = &eventignore
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
24 set cpo&vim
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
25
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
26 " HTML filetype can take a while to load/highlight if the destination file
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
27 " already exists.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
28 set eventignore+=FileType
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
29
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
30 let s:end=line('$')
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
31
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
32 " Font
2304
a59e6ac5ed28 When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
33 if exists("g:html_font")
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents: 5161
diff changeset
34 if type(g:html_font) == type([])
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
35 let s:htmlfont = "'".. join(g:html_font,"','") .. "', monospace"
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents: 5161
diff changeset
36 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
37 let s:htmlfont = "'".. g:html_font .. "', monospace"
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents: 5161
diff changeset
38 endif
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
39 else
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
40 let s:htmlfont = "monospace"
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
41 endif
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
42
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
43 let s:settings = tohtml#GetUserSettings()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
44
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
45 if s:settings.use_xhtml
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
46 let s:html5 = 0
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
47 elseif s:settings.use_css && !s:settings.no_pre
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
48 let s:html5 = 1
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
49 else
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
50 let s:html5 = 0
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
51 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
52
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
53 if !exists('s:FOLDED_ID')
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
54 let s:FOLDED_ID = hlID("Folded") | lockvar s:FOLDED_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
55 let s:FOLD_C_ID = hlID("FoldColumn") | lockvar s:FOLD_C_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
56 let s:LINENR_ID = hlID('LineNr') | lockvar s:LINENR_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
57 let s:DIFF_D_ID = hlID("DiffDelete") | lockvar s:DIFF_D_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
58 let s:DIFF_A_ID = hlID("DiffAdd") | lockvar s:DIFF_A_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
59 let s:DIFF_C_ID = hlID("DiffChange") | lockvar s:DIFF_C_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
60 let s:DIFF_T_ID = hlID("DiffText") | lockvar s:DIFF_T_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
61 let s:CONCEAL_ID = hlID('Conceal') | lockvar s:CONCEAL_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
62 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
63
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
64 " Whitespace
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
65 if s:settings.pre_wrap
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
66 let s:whitespace = "white-space: pre-wrap; "
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
67 else
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
68 let s:whitespace = ""
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
69 endif
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
70
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
71 if !empty(s:settings.prevent_copy)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
72 if s:settings.no_invalid
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
73 " User has decided they don't want invalid markup. Still works in
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
74 " OpenOffice, and for text editors, but when pasting into Microsoft Word the
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
75 " input elements get pasted too and they cannot be deleted (at least not
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
76 " easily).
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
77 let s:unselInputType = ""
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
78 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
79 " Prevent from copy-pasting the input elements into Microsoft Word where
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
80 " they cannot be deleted easily by deliberately inserting invalid markup.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
81 let s:unselInputType = " type='invalid_input_type'"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
82 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
83 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
84
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
85 " When gui colors are not supported, we can only guess the colors.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
86 " TODO - is this true anymore? Is there a way to ask the terminal what colors
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
87 " each number means or read them from some file?
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
88 if &termguicolors || has("gui_running")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 let s:whatterm = "gui"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 let s:whatterm = "cterm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 if &t_Co == 8
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
93 let s:cterm_color = {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
94 \ 0: "#808080", 1: "#ff6060", 2: "#00ff00", 3: "#ffff00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
95 \ 4: "#8080ff", 5: "#ff40ff", 6: "#00ffff", 7: "#ffffff"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
96 \ }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 else
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
98 let s:cterm_color = {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
99 \ 0: "#000000", 1: "#c00000", 2: "#008000", 3: "#804000",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
100 \ 4: "#0000c0", 5: "#c000c0", 6: "#008080", 7: "#c0c0c0",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
101 \ 8: "#808080", 9: "#ff6060", 10: "#00ff00", 11: "#ffff00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
102 \ 12: "#8080ff", 13: "#ff40ff", 14: "#00ffff", 15: "#ffffff"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
103 \ }
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
104
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
105 " Colors for 88 and 256 come from xterm.
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
106 if &t_Co == 88
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
107 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
108 \ 16: "#000000", 17: "#00008b", 18: "#0000cd", 19: "#0000ff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
109 \ 20: "#008b00", 21: "#008b8b", 22: "#008bcd", 23: "#008bff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
110 \ 24: "#00cd00", 25: "#00cd8b", 26: "#00cdcd", 27: "#00cdff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
111 \ 28: "#00ff00", 29: "#00ff8b", 30: "#00ffcd", 31: "#00ffff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
112 \ 32: "#8b0000", 33: "#8b008b", 34: "#8b00cd", 35: "#8b00ff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
113 \ 36: "#8b8b00", 37: "#8b8b8b", 38: "#8b8bcd", 39: "#8b8bff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
114 \ 40: "#8bcd00", 41: "#8bcd8b", 42: "#8bcdcd", 43: "#8bcdff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
115 \ 44: "#8bff00", 45: "#8bff8b", 46: "#8bffcd", 47: "#8bffff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
116 \ 48: "#cd0000", 49: "#cd008b", 50: "#cd00cd", 51: "#cd00ff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
117 \ 52: "#cd8b00", 53: "#cd8b8b", 54: "#cd8bcd", 55: "#cd8bff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
118 \ 56: "#cdcd00", 57: "#cdcd8b", 58: "#cdcdcd", 59: "#cdcdff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
119 \ 60: "#cdff00", 61: "#cdff8b", 62: "#cdffcd", 63: "#cdffff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
120 \ 64: "#ff0000"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
121 \ })
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
122 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
123 \ 65: "#ff008b", 66: "#ff00cd", 67: "#ff00ff", 68: "#ff8b00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
124 \ 69: "#ff8b8b", 70: "#ff8bcd", 71: "#ff8bff", 72: "#ffcd00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
125 \ 73: "#ffcd8b", 74: "#ffcdcd", 75: "#ffcdff", 76: "#ffff00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
126 \ 77: "#ffff8b", 78: "#ffffcd", 79: "#ffffff", 80: "#2e2e2e",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
127 \ 81: "#5c5c5c", 82: "#737373", 83: "#8b8b8b", 84: "#a2a2a2",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
128 \ 85: "#b9b9b9", 86: "#d0d0d0", 87: "#e7e7e7"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
129 \ })
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
130 elseif &t_Co == 256
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
131 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
132 \ 16: "#000000", 17: "#00005f", 18: "#000087", 19: "#0000af",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
133 \ 20: "#0000d7", 21: "#0000ff", 22: "#005f00", 23: "#005f5f",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
134 \ 24: "#005f87", 25: "#005faf", 26: "#005fd7", 27: "#005fff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
135 \ 28: "#008700", 29: "#00875f", 30: "#008787", 31: "#0087af",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
136 \ 32: "#0087d7", 33: "#0087ff", 34: "#00af00", 35: "#00af5f",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
137 \ 36: "#00af87", 37: "#00afaf", 38: "#00afd7", 39: "#00afff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
138 \ 40: "#00d700", 41: "#00d75f", 42: "#00d787", 43: "#00d7af",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
139 \ 44: "#00d7d7", 45: "#00d7ff", 46: "#00ff00", 47: "#00ff5f",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
140 \ 48: "#00ff87", 49: "#00ffaf", 50: "#00ffd7", 51: "#00ffff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
141 \ 52: "#5f0000", 53: "#5f005f", 54: "#5f0087", 55: "#5f00af",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
142 \ 56: "#5f00d7", 57: "#5f00ff", 58: "#5f5f00", 59: "#5f5f5f",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
143 \ 60: "#5f5f87", 61: "#5f5faf", 62: "#5f5fd7", 63: "#5f5fff",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
144 \ 64: "#5f8700"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
145 \ })
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
146 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
147 \ 65: "#5f875f", 66: "#5f8787", 67: "#5f87af", 68: "#5f87d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
148 \ 69: "#5f87ff", 70: "#5faf00", 71: "#5faf5f", 72: "#5faf87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
149 \ 73: "#5fafaf", 74: "#5fafd7", 75: "#5fafff", 76: "#5fd700",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
150 \ 77: "#5fd75f", 78: "#5fd787", 79: "#5fd7af", 80: "#5fd7d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
151 \ 81: "#5fd7ff", 82: "#5fff00", 83: "#5fff5f", 84: "#5fff87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
152 \ 85: "#5fffaf", 86: "#5fffd7", 87: "#5fffff", 88: "#870000",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
153 \ 89: "#87005f", 90: "#870087", 91: "#8700af", 92: "#8700d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
154 \ 93: "#8700ff", 94: "#875f00", 95: "#875f5f", 96: "#875f87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
155 \ 97: "#875faf", 98: "#875fd7", 99: "#875fff", 100: "#878700",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
156 \ 101: "#87875f", 102: "#878787", 103: "#8787af", 104: "#8787d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
157 \ 105: "#8787ff", 106: "#87af00", 107: "#87af5f", 108: "#87af87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
158 \ 109: "#87afaf", 110: "#87afd7", 111: "#87afff", 112: "#87d700"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
159 \ })
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
160 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
161 \ 113: "#87d75f", 114: "#87d787", 115: "#87d7af", 116: "#87d7d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
162 \ 117: "#87d7ff", 118: "#87ff00", 119: "#87ff5f", 120: "#87ff87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
163 \ 121: "#87ffaf", 122: "#87ffd7", 123: "#87ffff", 124: "#af0000",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
164 \ 125: "#af005f", 126: "#af0087", 127: "#af00af", 128: "#af00d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
165 \ 129: "#af00ff", 130: "#af5f00", 131: "#af5f5f", 132: "#af5f87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
166 \ 133: "#af5faf", 134: "#af5fd7", 135: "#af5fff", 136: "#af8700",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
167 \ 137: "#af875f", 138: "#af8787", 139: "#af87af", 140: "#af87d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
168 \ 141: "#af87ff", 142: "#afaf00", 143: "#afaf5f", 144: "#afaf87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
169 \ 145: "#afafaf", 146: "#afafd7", 147: "#afafff", 148: "#afd700",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
170 \ 149: "#afd75f", 150: "#afd787", 151: "#afd7af", 152: "#afd7d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
171 \ 153: "#afd7ff", 154: "#afff00", 155: "#afff5f", 156: "#afff87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
172 \ 157: "#afffaf", 158: "#afffd7"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
173 \ })
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
174 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
175 \ 159: "#afffff", 160: "#d70000", 161: "#d7005f", 162: "#d70087",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
176 \ 163: "#d700af", 164: "#d700d7", 165: "#d700ff", 166: "#d75f00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
177 \ 167: "#d75f5f", 168: "#d75f87", 169: "#d75faf", 170: "#d75fd7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
178 \ 171: "#d75fff", 172: "#d78700", 173: "#d7875f", 174: "#d78787",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
179 \ 175: "#d787af", 176: "#d787d7", 177: "#d787ff", 178: "#d7af00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
180 \ 179: "#d7af5f", 180: "#d7af87", 181: "#d7afaf", 182: "#d7afd7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
181 \ 183: "#d7afff", 184: "#d7d700", 185: "#d7d75f", 186: "#d7d787",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
182 \ 187: "#d7d7af", 188: "#d7d7d7", 189: "#d7d7ff", 190: "#d7ff00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
183 \ 191: "#d7ff5f", 192: "#d7ff87", 193: "#d7ffaf", 194: "#d7ffd7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
184 \ 195: "#d7ffff", 196: "#ff0000", 197: "#ff005f", 198: "#ff0087",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
185 \ 199: "#ff00af", 200: "#ff00d7", 201: "#ff00ff", 202: "#ff5f00",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
186 \ 203: "#ff5f5f", 204: "#ff5f87"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
187 \ })
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
188 call extend(s:cterm_color, {
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
189 \ 205: "#ff5faf", 206: "#ff5fd7", 207: "#ff5fff", 208: "#ff8700",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
190 \ 209: "#ff875f", 210: "#ff8787", 211: "#ff87af", 212: "#ff87d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
191 \ 213: "#ff87ff", 214: "#ffaf00", 215: "#ffaf5f", 216: "#ffaf87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
192 \ 217: "#ffafaf", 218: "#ffafd7", 219: "#ffafff", 220: "#ffd700",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
193 \ 221: "#ffd75f", 222: "#ffd787", 223: "#ffd7af", 224: "#ffd7d7",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
194 \ 225: "#ffd7ff", 226: "#ffff00", 227: "#ffff5f", 228: "#ffff87",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
195 \ 229: "#ffffaf", 230: "#ffffd7", 231: "#ffffff", 232: "#080808",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
196 \ 233: "#121212", 234: "#1c1c1c", 235: "#262626", 236: "#303030",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
197 \ 237: "#3a3a3a", 238: "#444444", 239: "#4e4e4e", 240: "#585858",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
198 \ 241: "#626262", 242: "#6c6c6c", 243: "#767676", 244: "#808080",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
199 \ 245: "#8a8a8a", 246: "#949494", 247: "#9e9e9e", 248: "#a8a8a8",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
200 \ 249: "#b2b2b2", 250: "#bcbcbc", 251: "#c6c6c6", 252: "#d0d0d0",
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
201 \ 253: "#dadada", 254: "#e4e4e4", 255: "#eeeeee"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
202 \ })
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
203 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 " Return good color specification: in GUI no transformation is done, in
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
208 " terminal return RGB values of known colors and empty string for unknown
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 if s:whatterm == "gui"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 function! s:HtmlColor(color)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 return a:color
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 function! s:HtmlColor(color)
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
215 if has_key(s:cterm_color, a:color)
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
216 return s:cterm_color[a:color]
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 return ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
223 " Find out the background and foreground color for use later
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
224 let s:fgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "fg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
225 let s:bgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "bg#", s:whatterm))
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
226 if s:fgc == ""
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
227 let s:fgc = ( &background == "dark" ? "#ffffff" : "#000000" )
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
228 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
229 if s:bgc == ""
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
230 let s:bgc = ( &background == "dark" ? "#000000" : "#ffffff" )
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
231 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
232
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
233 if !s:settings.use_css
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 " Return opening HTML tag for given highlight id
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
235 function! s:HtmlOpening(id, extra_attrs)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 let a = ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
237 let translated_ID = synIDtrans(a:id)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
238 if synIDattr(translated_ID, "inverse")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 " For inverse, we always must set both colors (and exchange them)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
240 let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
241 let a = a .. '<span '..a:extra_attrs..'style="background-color: ' .. ( x != "" ? x : s:fgc ) .. '">'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
242 let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
243 let a = a .. '<font color="' .. ( x != "" ? x : s:bgc ) .. '">'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
245 let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
246 if x != ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
247 let a = a .. '<span '..a:extra_attrs..'style="background-color: ' .. x .. '">'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
248 elseif !empty(a:extra_attrs)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
249 let a = a .. '<span '..a:extra_attrs..'>'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
250 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
251 let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
252 if x != "" | let a = a .. '<font color="' .. x .. '">' | endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
254 if synIDattr(translated_ID, "bold") | let a = a .. "<b>" | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
255 if synIDattr(translated_ID, "italic") | let a = a .. "<i>" | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
256 if synIDattr(translated_ID, "underline") | let a = a .. "<u>" | endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 return a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 " Return closing HTML tag for given highlight id
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
261 function! s:HtmlClosing(id, has_extra_attrs)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 let a = ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
263 let translated_ID = synIDtrans(a:id)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
264 if synIDattr(translated_ID, "underline") | let a = a .. "</u>" | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
265 if synIDattr(translated_ID, "italic") | let a = a .. "</i>" | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
266 if synIDattr(translated_ID, "bold") | let a = a .. "</b>" | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
267 if synIDattr(translated_ID, "inverse")
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
268 let a = a .. '</font></span>'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
270 let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
271 if x != "" | let a = a .. '</font>' | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
272 let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
273 if x != "" || a:has_extra_attrs | let a = a .. '</span>' | endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 return a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
279 " Use a different function for formatting based on user options. This way we
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
280 " can avoid a lot of logic during the actual execution.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
281 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
282 " Build the function line by line containing only what is needed for the options
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
283 " in use for maximum code sharing with minimal branch logic for greater speed.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
284 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
285 " Note, 'exec' commands do not recognize line continuations, so must concatenate
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
286 " lines rather than continue them.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
287 if s:settings.use_css
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
288 " save CSS to a list of rules to add to the output at the end of processing
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
289
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
290 " first, get the style names we need
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
291 let s:wrapperfunc_lines = []
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
292 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
293 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
294 function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, make_unselectable, unformatted)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
295
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
296 let l:style_name = synIDattr(a:style_id, "name", s:whatterm)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
297 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
298 if &diff
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
299 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
300 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
301 let l:diff_style_name = synIDattr(a:diff_style_id, "name", s:whatterm)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
302 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
303
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
304 " Add normal groups and diff groups to separate lists so we can order them to
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
305 " allow diff highlight to override normal highlight
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
306
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
307 " if primary style IS a diff style, grab it from the diff cache instead
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
308 " (always succeeds because we pre-populate it)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
309 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
310 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
311
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
312 if a:style_id == s:DIFF_D_ID || a:style_id == s:DIFF_A_ID || a:style_id == s:DIFF_C_ID || a:style_id == s:DIFF_T_ID
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
313 let l:saved_style = get(s:diffstylelist,a:style_id)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
314 else
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
315 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
316 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
317
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
318 " get primary style info from cache or build it on the fly if not found
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
319 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
320 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
321 let l:saved_style = get(s:stylelist,a:style_id)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
322 if type(l:saved_style) == type(0)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
323 unlet l:saved_style
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
324 let l:saved_style = s:CSS1(a:style_id)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
325 if l:saved_style != ""
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
326 let l:saved_style = "." .. l:style_name .. " { " .. l:saved_style .. "}"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
327 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
328 let s:stylelist[a:style_id] = l:saved_style
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
329 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
330 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
331 if &diff
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
332 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
333 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
334 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
335 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
336 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
337 " Ignore this comment, just bypassing a highlighting issue: if
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
338
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
339 " Build the wrapper tags around the text. It turns out that caching these
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
340 " gives pretty much zero performance gain and adds a lot of logic.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
341
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
342 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
343 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
344
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
345 if l:saved_style == "" && empty(a:extra_attrs)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
346 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
347 if &diff
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
348 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
349 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
350 if a:diff_style_id <= 0
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
351 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
352 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
353 " no surroundings if neither primary nor diff style has any info
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
354 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
355 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
356 return a:text
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
357 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
358 if &diff
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
359 " no primary style, but diff style
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
360 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
361 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
362 else
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
363 return '<span class="' ..l:diff_style_name .. '">'..a:text.."</span>"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
364 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
365 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
366 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
367 " Ignore this comment, just bypassing a highlighting issue: if
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
368
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
369 " open tag for non-empty primary style
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
370 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
371 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
372 else
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
373 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
374 " non-empty primary style. handle either empty or non-empty diff style.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
375 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
376 " separate the two classes by a space to apply them both if there is a diff
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
377 " style name, unless the primary style is empty, then just use the diff style
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
378 " name
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
379 let s:diffstyle =
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
380 \ (&diff ? '(a:diff_style_id <= 0 ? "" : " " .. l:diff_style_name)..'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
381 \ : '')
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
382 if s:settings.prevent_copy == ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
383 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
384 let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
385 return "<span "..a:extra_attrs..'class="' .. l:style_name ..{s:diffstyle}'">'..a:text.."</span>"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
386 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
387 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
388
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
389 " New method: use generated content in the CSS. The only thing needed here
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
390 " is a span with no content, with an attribute holding the desired text.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
391 "
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
392 " Old method: use an <input> element when text is unsectable. This is still
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
393 " used in conditional comments for Internet Explorer, where the new method
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
394 " doesn't work.
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
395 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
396 " Wrap the <input> in a <span> to allow fixing the stupid bug in some fonts
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
397 " which cause browsers to display a 1px gap between lines when these
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
398 " <input>s have a background color (maybe not really a bug, this isn't
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
399 " well-defined)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
400 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
401 " use strwidth, because we care only about how many character boxes are
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
402 " needed to size the input, we don't care how many characters (including
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
403 " separately counted composing chars, from strchars()) or bytes (from
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
404 " len())the string contains. strdisplaywidth() is not needed because none of
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
405 " the unselectable groups can contain tab characters (fold column, fold
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
406 " text, line number).
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
407 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
408 " Note, if maxlength property needs to be added in the future, it will need
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
409 " to use strchars(), because HTML specifies that the maxlength parameter
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
410 " uses the number of unique codepoints for its limit.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
411 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
412 let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
413 if a:make_unselectable
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
414 let return_span = "<span "..a:extra_attrs..'class="' .. l:style_name ..{s:diffstyle}'"'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
415 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
416 if s:settings.use_input_for_pc !=# 'all'
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
417 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
418 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
419 let return_span ..= " data-" .. l:style_name .. '-content="'..a:text..'"'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
420 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
421 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
422 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
423 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
424 let return_span ..= '>'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
425 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
426 if s:settings.use_input_for_pc !=# 'none'
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
427 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
428 let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
429 let return_span ..= '<input'..s:unselInputType..' class="' .. l:style_name ..{s:diffstyle}'"'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
430 let return_span ..= ' value="'..substitute(a:unformatted,'\s\+$',"","")..'"'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
431 let return_span ..= " onselect='this.blur(); return false;'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
432 let return_span ..= " onmousedown='this.blur(); return false;'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
433 let return_span ..= " onclick='this.blur(); return false;'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
434 let return_span ..= " readonly='readonly'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
435 let return_span ..= ' size="'..strwidth(a:unformatted)..'"'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
436 let return_span ..= (s:settings.use_xhtml ? '/>' : '>')
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
437 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
438 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
439 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
440 let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
441 return return_span..'</span>'
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
442 else
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
443 return "<span "..a:extra_attrs..'class="' .. l:style_name .. {s:diffstyle}'">'..a:text.."</span>"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
444 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
445 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
446 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
447 call add(s:wrapperfunc_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
448 let s:wrapperfunc_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
449 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
450 endfun
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
451 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
452 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
453 " Non-CSS method just needs the wrapper.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
454 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
455 " Functions used to get opening/closing automatically return null strings if
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
456 " no styles exist.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
457 if &diff
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
458 let s:wrapperfunc_lines =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
459 function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
460 if a:diff_style_id <= 0
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
461 let l:diff_opening = s:HtmlOpening(a:diff_style_id, "")
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
462 let l:diff_closing = s:HtmlClosing(a:diff_style_id, 0)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
463 else
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
464 let l:diff_opening = ""
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
465 let l:diff_closing = ""
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
466 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
467 return s:HtmlOpening(a:style_id, a:extra_attrs)..l:diff_opening..a:text..l:diff_closing..s:HtmlClosing(a:style_id, !empty(a:extra_attrs))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
468 endfun
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
469 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
470 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
471 let s:wrapperfunc_lines =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
472 function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
473 return s:HtmlOpening(a:style_id, a:extra_attrs)..a:text..s:HtmlClosing(a:style_id, !empty(a:extra_attrs))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
474 endfun
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
475 ENDLET
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
476 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
477 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
478
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
479 " create the function we built line by line above
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
480 exec join(flatten(s:wrapperfunc_lines), "\n")
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
481
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
482 let s:diff_mode = &diff
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
483
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
484 " Return HTML valid characters enclosed in a span of class style_name with
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
485 " unprintable characters expanded and double spaces replaced as necessary.
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
486 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
487 " TODO: eliminate unneeded logic like done for BuildStyleWrapper
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
488 function! s:HtmlFormat(text, style_id, diff_style_id, extra_attrs, make_unselectable)
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
489 " Replace unprintable characters
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
490 let unformatted = strtrans(a:text)
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
491
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
492 let formatted = unformatted
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
493
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
494 " Replace the reserved html characters
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
495 let formatted = substitute(formatted, '&', '\&amp;', 'g')
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
496 let formatted = substitute(formatted, '<', '\&lt;', 'g')
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
497 let formatted = substitute(formatted, '>', '\&gt;', 'g')
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
498 let formatted = substitute(formatted, '"', '\&quot;', 'g')
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
499 " &apos; is not valid in HTML but it is in XHTML, so just use the numeric
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
500 " reference for it instead. Needed because it could appear in quotes
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
501 " especially if unselectable regions is turned on.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
502 let formatted = substitute(formatted, '"', '\&#0039;', 'g')
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
503
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
504 " Replace a "form feed" character with HTML to do a page break
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
505 " TODO: need to prevent this in unselectable areas? Probably it should never
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
506 " BE in an unselectable area...
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
507 let formatted = substitute(formatted, "\x0c", '<hr class="PAGE-BREAK">', 'g')
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
508
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
509 " Replace double spaces, leading spaces, and trailing spaces if needed
856
8cd729851562 updated for version 7.0g
vimboss
parents: 837
diff changeset
510 if ' ' != s:HtmlSpace
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
511 let formatted = substitute(formatted, ' ', s:HtmlSpace .. s:HtmlSpace, 'g')
837
6bb1fa855dc9 updated for version 7.0e03
vimboss
parents: 836
diff changeset
512 let formatted = substitute(formatted, '^ ', s:HtmlSpace, 'g')
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
513 let formatted = substitute(formatted, ' \+$', s:HtmlSpace, 'g')
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
514 endif
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
515
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
516 " Enclose in the correct format
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
517 return s:BuildStyleWrapper(a:style_id, a:diff_style_id, a:extra_attrs, formatted, a:make_unselectable, unformatted)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
518 endfun
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
519
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
520 " set up functions to call HtmlFormat in certain ways based on whether the
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
521 " element is supposed to be unselectable or not
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
522 if s:settings.prevent_copy =~# 'n'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
523 if s:settings.number_lines
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
524 if s:settings.line_ids
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
525 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
526 if a:lnr > 0
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
527 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 1)
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
528 else
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
529 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
530 endif
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
531 endfun
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
532 else
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
533 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
534 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
535 endfun
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
536 endif
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
537 elseif s:settings.line_ids
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
538 " if lines are not being numbered the only reason this function gets called
25773
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19099
diff changeset
539 " is to put the line IDs on each line; "text" will be empty but lnr will
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
540 " always be non-zero, however we don't want to use the <input> because that
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
541 " won't work as nice for empty text
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
542 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
543 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 0)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
544 endfun
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
545 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
546 else
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
547 if s:settings.line_ids
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
548 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
549 if a:lnr > 0
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
550 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 0)
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
551 else
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
552 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
553 endif
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
554 endfun
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
555 else
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
556 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
557 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
558 endfun
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
559 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
560 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
561 if s:settings.prevent_copy =~# 'd'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
562 function! s:HtmlFormat_d(text, style_id, diff_style_id)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
563 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
564 endfun
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
565 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
566 function! s:HtmlFormat_d(text, style_id, diff_style_id)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
567 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
568 endfun
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
569 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
570 if s:settings.prevent_copy =~# 'f'
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
571 if s:settings.use_input_for_pc ==# 'none'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
572 " Simply space-pad to the desired width inside the generated content (note
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
573 " that the FoldColumn definition includes a whitespace:pre rule)
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
574 function! s:FoldColumn_build(char, len, numfill, char2, class, click)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
575 return "<a href='#' class='"..a:class.."' onclick='"..a:click.."' data-FoldColumn-content='".
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
576 \ repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill).
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
577 \ "'></a>"
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
578 endfun
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
579 function! s:FoldColumn_fill()
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
580 return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 1)
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
581 endfun
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
582 else
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
583 " Note the <input> elements for fill spaces will have a single space for
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
584 " content, to allow active cursor CSS selection to work.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
585 "
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
586 " Wrap the whole thing in a span for the 1px padding workaround for gaps.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
587 "
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
588 " Build the function line by line containing only what is needed for the
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
589 " options in use for maximum code sharing with minimal branch logic for
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
590 " greater speed.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
591 "
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
592 " Note, 'exec' commands do not recognize line continuations, so must
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
593 " concatenate lines rather than continue them.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
594 let s:build_fun_lines = []
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
595 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
596 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
597 function! s:FoldColumn_build(char, len, numfill, char2, class, click)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
598 let l:input_open = "<input readonly='readonly'"..s:unselInputType
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
599 let l:input_open ..= " onselect='this.blur(); return false;'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
600 let l:input_open ..= " onmousedown='this.blur(); "..a:click.." return false;'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
601 let l:input_open ..= " onclick='return false;' size='"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
602 let l:input_open ..= string(a:len + (empty(a:char2) ? 0 : 1) + a:numfill) .. "' "
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
603 let l:common_attrs = "class='FoldColumn' value='"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
604 let l:input_close = (s:settings.use_xhtml ? "' />" : "'>")
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
605 let l:return_span = "<span class='"..a:class.."'>"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
606 let l:return_span ..= l:input_open..l:common_attrs..repeat(a:char, a:len)..(a:char2)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
607 let l:return_span ..= l:input_close
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
608 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
609 if s:settings.use_input_for_pc ==# 'fallback'
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
610 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
611 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
612 let l:return_span ..= "<a href='#' class='FoldColumn' onclick='"..a:click.."'"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
613 let l:return_span ..= " data-FoldColumn-content='"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
614 let l:return_span ..= repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
615 let l:return_span ..= "'></a>"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
616 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
617 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
618 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
619 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
620 let l:return_span ..= "</span>"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
621 return l:return_span
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
622 endfun
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
623 ENDLET
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
624 " create the function we built line by line above
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
625 exec join(flatten(s:build_fun_lines), "\n")
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
626
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
627 function! s:FoldColumn_fill()
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
628 return s:FoldColumn_build(' ', s:foldcolumn, 0, '', 'FoldColumn', '')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
629 endfun
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
630 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
631 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
632 " For normal fold columns, simply space-pad to the desired width (note that
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
633 " the FoldColumn definition includes a whitespace:pre rule)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
634 function! s:FoldColumn_build(char, len, numfill, char2, class, click)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
635 return "<a href='#' class='"..a:class.."' onclick='"..a:click.."'>".
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
636 \ repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill).
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
637 \ "</a>"
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
638 endfun
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
639 function! s:FoldColumn_fill()
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
640 return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 0)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
641 endfun
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
642 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
643 if s:settings.prevent_copy =~# 't'
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
644 " put an extra empty span at the end for dynamic folds, so the linebreak can
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
645 " be surrounded. Otherwise do it as normal.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
646 "
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
647 " TODO: isn't there a better way to do this, than placing it here and using a
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
648 " substitute later?
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
649 if s:settings.dynamic_folds
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
650 function! s:HtmlFormat_t(text, style_id, diff_style_id)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
651 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) .
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
652 \ s:HtmlFormat("", a:style_id, 0, "", 0)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
653 endfun
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
654 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
655 function! s:HtmlFormat_t(text, style_id, diff_style_id)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
656 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
657 endfun
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
658 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
659 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
660 function! s:HtmlFormat_t(text, style_id, diff_style_id)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
661 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
662 endfun
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
663 endif
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
664
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 " Return CSS style describing given highlight id (can be empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 function! s:CSS1(id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 let a = ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
668 let translated_ID = synIDtrans(a:id)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
669 if synIDattr(translated_ID, "inverse")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 " For inverse, we always must set both colors (and exchange them)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
671 let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
672 let a = a .. "color: " .. ( x != "" ? x : s:bgc ) .. "; "
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
673 let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
674 let a = a .. "background-color: " .. ( x != "" ? x : s:fgc ) .. "; "
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
676 let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
677 if x != "" | let a = a .. "color: " .. x .. "; " | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
678 let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
679 if x != ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
680 let a = a .. "background-color: " .. x .. "; "
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
681 " stupid hack because almost every browser seems to have at least one font
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
682 " which shows 1px gaps between lines which have background
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
683 let a = a .. "padding-bottom: 1px; "
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
684 elseif (translated_ID == s:FOLDED_ID || translated_ID == s:LINENR_ID || translated_ID == s:FOLD_C_ID) && !empty(s:settings.prevent_copy)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
685 " input elements default to a different color than the rest of the page
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
686 let a = a .. "background-color: " .. s:bgc .. "; "
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
687 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
689 if synIDattr(translated_ID, "bold") | let a = a .. "font-weight: bold; " | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
690 if synIDattr(translated_ID, "italic") | let a = a .. "font-style: italic; " | endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
691 if synIDattr(translated_ID, "underline") | let a = a .. "text-decoration: underline; " | endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 return a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
695 if s:settings.dynamic_folds
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
696 " compares two folds as stored in our list of folds
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
697 " A fold is "less" than another if it starts at an earlier line number,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
698 " or ends at a later line number, ties broken by fold level
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
699 function! s:FoldCompare(f1, f2)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
700 if a:f1.firstline != a:f2.firstline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
701 " put it before if it starts earlier
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
702 return a:f1.firstline - a:f2.firstline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
703 elseif a:f1.lastline != a:f2.lastline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
704 " put it before if it ends later
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
705 return a:f2.lastline - a:f1.lastline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
706 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
707 " if folds begin and end on the same lines, put lowest fold level first
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
708 return a:f1.level - a:f2.level
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
709 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
710 endfunction
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
711
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
712 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
713
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 " Set some options to make it work faster.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 " Don't report changes for :substitute, there will be many of them.
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
717 " Don't change other windows; turn off scroll bind temporarily
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 let s:old_title = &title
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 let s:old_icon = &icon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 let s:old_et = &l:et
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
721 let s:old_bind = &l:scrollbind
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 let s:old_report = &report
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 let s:old_search = @/
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
724 let s:old_more = &more
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 set notitle noicon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 setlocal et
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
727 set nomore
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 set report=1000000
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
729 setlocal noscrollbind
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
731 if exists(':ownsyntax') && exists('w:current_syntax')
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
732 let s:current_syntax = w:current_syntax
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
733 elseif exists('b:current_syntax')
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
734 let s:current_syntax = b:current_syntax
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
735 else
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
736 let s:current_syntax = 'none'
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
737 endif
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
738
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
739 if s:current_syntax == ''
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
740 let s:current_syntax = 'none'
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
741 endif
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
742
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
743 " If the user is sourcing this script directly then the plugin version isn't
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
744 " known because the main plugin script didn't load. In the usual case where the
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
745 " user still has the full Vim runtime installed, or has this full plugin
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
746 " installed in a package or something, then we can extract the version from the
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
747 " main plugin file at it's usual spot relative to this file. Otherwise the user
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
748 " is assembling their runtime piecemeal and we have no idea what versions of
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
749 " other files may be present so don't even try to make a guess or assume the
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
750 " presence of other specific files with specific meaning.
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
751 "
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
752 " We don't want to actually source the main plugin file here because the user
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
753 " may have a good reason not to (e.g. they define their own TOhtml command or
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
754 " something).
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
755 "
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
756 " If this seems way too complicated and convoluted, it is. Probably I should
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
757 " have put the version information in the autoload file from the start. But the
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
758 " version has been in the global variable for so long that changing it could
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
759 " break a lot of user scripts.
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
760 if exists("g:loaded_2html_plugin")
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
761 let s:pluginversion = g:loaded_2html_plugin
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
762 else
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
763 if !exists("g:unloaded_tohtml_plugin")
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
764 let s:main_plugin_path = expand("<sfile>:p:h:h").."/plugin/tohtml.vim"
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
765 if filereadable(s:main_plugin_path)
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
766 let s:lines = readfile(s:main_plugin_path, "", 20)
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
767 call filter(s:lines, 'v:val =~ "loaded_2html_plugin = "')
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
768 if empty(s:lines)
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
769 let g:unloaded_tohtml_plugin = "unknown"
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
770 else
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
771 let g:unloaded_tohtml_plugin = substitute(s:lines[0], '.*loaded_2html_plugin = \([''"]\)\(\%(\1\@!.\)\+\)\1', '\2', '')
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
772 endif
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
773 unlet s:lines
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
774 else
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
775 let g:unloaded_tohtml_plugin = "unknown"
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
776 endif
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
777 unlet s:main_plugin_path
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
778 endif
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
779 let s:pluginversion = g:unloaded_tohtml_plugin
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
780 endif
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
781
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 " Split window to create a buffer with the HTML file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 let s:orgbufnr = winbufnr(0)
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
784 let s:origwin_stl = &l:stl
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 if expand("%") == ""
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
786 if exists('g:html_diff_win_num')
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
787 exec 'new Untitled_win'..g:html_diff_win_num..'.'.(s:settings.use_xhtml ? 'xhtml' : 'html')
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
788 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
789 exec 'new Untitled.'..(s:settings.use_xhtml ? 'xhtml' : 'html')
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
790 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
792 exec 'new %.'..(s:settings.use_xhtml ? 'xhtml' : 'html')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 endif
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
794
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
795 " Resize the new window to very small in order to make it draw faster
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
796 let s:old_winheight = winheight(0)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
797 let s:old_winfixheight = &l:winfixheight
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
798 if s:old_winheight > 2
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
799 resize 1 " leave enough room to view one line at a time
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
800 norm! G
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
801 norm! zt
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
802 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
803 setlocal winfixheight
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
804
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
805 let s:newwin_stl = &l:stl
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
806
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
807 " on the new window, set the least time-consuming fold method
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
808 let s:old_fen = &foldenable
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
809 setlocal foldmethod=manual
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
810 setlocal nofoldenable
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
811
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 let s:newwin = winnr()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 let s:orgwin = bufwinnr(s:orgbufnr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
815 setlocal modifiable
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 %d
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 let s:old_paste = &paste
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 set paste
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 let s:old_magic = &magic
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 set magic
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
822 " set the fileencoding to match the charset we'll be using
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
823 let &l:fileencoding=s:settings.vim_encoding
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
824
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
825 " 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
826 " 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
827 " 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
828 " determine when it is actually inserted.
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
829 if s:settings.vim_encoding == 'utf-8'
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
830 setlocal nobomb
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
831 else
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
832 setlocal bomb
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
833 endif
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
834
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
835 let s:lines = []
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
836
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
837 if s:settings.use_xhtml
2508
7e008c174cc3 Updates for :TOhtml. (Ben Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2496
diff changeset
838 if s:settings.encoding != ""
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
839 call add(s:lines, "<?xml version=\"1.0\" encoding=\"" .. s:settings.encoding .. "\"?>")
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 34
diff changeset
840 else
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
841 call add(s:lines, "<?xml version=\"1.0\"?>")
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 34
diff changeset
842 endif
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
843 let s:tag_close = ' />'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 else
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
845 let s:tag_close = '>'
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
846 endif
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
847
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
848 let s:HtmlSpace = ' '
836
5a7843c57316 updated for version 7.0e02
vimboss
parents: 575
diff changeset
849 let s:LeadingSpace = ' '
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
850 let s:HtmlEndline = ''
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
851 if s:settings.no_pre
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
852 let s:HtmlEndline = '<br' .. s:tag_close
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
853 let s:LeadingSpace = s:settings.use_xhtml ? '&#160;' : '&nbsp;'
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
854 let s:HtmlSpace = '\' .. s:LeadingSpace
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 " HTML header, with the title and generator ;-). Left free space for the CSS,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 " to be filled at the end.
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
859 if !s:settings.no_doc
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
860 call extend(s:lines, [
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
861 \ "<html>",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
862 \ "<head>"])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
863 " include encoding as close to the top as possible, but only if not already
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
864 " contained in XML information (to avoid haggling over content type)
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
865 if s:settings.encoding != "" && !s:settings.use_xhtml
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
866 if s:html5
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
867 call add(s:lines, '<meta charset="' .. s:settings.encoding .. '"' .. s:tag_close)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
868 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
869 call add(s:lines, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" .. s:settings.encoding .. '"' .. s:tag_close)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
870 endif
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
871 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
872 call extend(s:lines, [
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
873 \ ("<title>"..expand("%:p:~").."</title>"),
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
874 \ ("<meta name=\"Generator\" content=\"Vim/"..v:version/100.."."..v:version%100..'"'..s:tag_close),
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
875 \ ("<meta name=\"plugin-version\" content=\""..s:pluginversion..'"'..s:tag_close)
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
876 \ ])
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
877 call add(s:lines, '<meta name="syntax" content="'..s:current_syntax..'"'..s:tag_close)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
878 call add(s:lines, '<meta name="settings" content="'..
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
879 \ join(filter(keys(s:settings),'s:settings[v:val]'),',')..
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
880 \ ',prevent_copy='..s:settings.prevent_copy..
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
881 \ ',use_input_for_pc='..s:settings.use_input_for_pc..
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
882 \ '"'..s:tag_close)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
883 call add(s:lines, '<meta name="colorscheme" content="'..
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
884 \ (exists('g:colors_name')
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
885 \ ? g:colors_name
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
886 \ : 'none').. '"'..s:tag_close)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
887
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
888 if s:settings.use_css
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
889 call extend(s:lines, [
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
890 \ "<style" .. (s:html5 ? "" : " type=\"text/css\"") .. ">",
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
891 \ s:settings.use_xhtml ? "" : "<!--"])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
892 let s:ieonly = []
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
893 if s:settings.dynamic_folds
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
894 if s:settings.hover_unfold
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
895 " if we are doing hover_unfold, use css 2 with css 1 fallback for IE6
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
896 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
897 \ ".FoldColumn { text-decoration: none; white-space: pre; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
898 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
899 \ "body * { margin: 0; padding: 0; }", "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
900 \ ".open-fold > span.Folded { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
901 \ ".open-fold > .fulltext { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
902 \ ".closed-fold > .fulltext { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
903 \ ".closed-fold > span.Folded { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
904 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
905 \ ".open-fold > .toggle-open { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
906 \ ".open-fold > .toggle-closed { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
907 \ ".closed-fold > .toggle-open { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
908 \ ".closed-fold > .toggle-closed { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
909 \ "", "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
910 \ '/* opening a fold while hovering won''t be supported by IE6 and other',
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
911 \ "similar browsers, but it should fail gracefully. */",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
912 \ ".closed-fold:hover > .fulltext { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
913 \ ".closed-fold:hover > .toggle-filler { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
914 \ ".closed-fold:hover > .Folded { display: none; }"])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
915 " TODO: IE6 is REALLY old and I can't even test it anymore. Maybe we
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
916 " should remove this? Leave it in for now, it was working at one point,
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
917 " and doesn't affect any modern browsers. Even newer IE versions should
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
918 " support the above code and ignore the following.
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
919 let s:ieonly = [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
920 \ "<!--[if lt IE 7]><style type=\"text/css\">",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
921 \ ".open-fold .fulltext { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
922 \ ".open-fold span.Folded { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
923 \ ".open-fold .toggle-open { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
924 \ ".open-fold .toggle-closed { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
925 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
926 \ ".closed-fold .fulltext { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
927 \ ".closed-fold span.Folded { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
928 \ ".closed-fold .toggle-open { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
929 \ ".closed-fold .toggle-closed { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
930 \ "</style>",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
931 \ "<![endif]-->",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
932 \]
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
933 else
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
934 " if we aren't doing hover_unfold, use CSS 1 only
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
935 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
936 \ ".FoldColumn { text-decoration: none; white-space: pre; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
937 \ ".open-fold .fulltext { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
938 \ ".open-fold span.Folded { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
939 \ ".open-fold .toggle-open { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
940 \ ".open-fold .toggle-closed { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
941 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
942 \ ".closed-fold .fulltext { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
943 \ ".closed-fold span.Folded { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
944 \ ".closed-fold .toggle-open { display: inline; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
945 \ ".closed-fold .toggle-closed { display: none; }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
946 \])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
947 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
948 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
949 " else we aren't doing any dynamic folding, no need for any special rules
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
950
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
951 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
952 \ s:settings.use_xhtml ? "" : '-->',
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
953 \ "</style>",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
954 \])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
955 call extend(s:lines, s:ieonly)
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
956 unlet s:ieonly
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
957 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
958
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
959 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
960
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
961 " insert script tag if needed
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
962 if s:uses_script
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
963 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
964 \ "",
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
965 \ "<script" .. (s:html5 ? "" : " type='text/javascript'") .. ">",
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
966 \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
967 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
968
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
969 " insert javascript to toggle folds open and closed
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
970 if s:settings.dynamic_folds
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
971 call extend(s:lines, [
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
972 \ "",
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
973 \ "function toggleFold(objID)",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
974 \ "{",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
975 \ " var fold;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
976 \ " fold = document.getElementById(objID);",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
977 \ " if (fold.className == 'closed-fold')",
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
978 \ " {",
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
979 \ " fold.className = 'open-fold';",
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
980 \ " }",
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
981 \ " else if (fold.className == 'open-fold')",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
982 \ " {",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
983 \ " fold.className = 'closed-fold';",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
984 \ " }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
985 \ "}"
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
986 \ ])
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
987 endif
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
988
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
989 if s:settings.line_ids
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
990 " insert javascript to get IDs from line numbers, and to open a fold before
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
991 " jumping to any lines contained therein
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
992 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
993 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
994 \ "/* function to open any folds containing a jumped-to line before jumping to it */",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
995 \ "function JumpToLine()",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
996 \ "{",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
997 \ " var lineNum;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
998 \ " lineNum = window.location.hash;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
999 \ " lineNum = lineNum.substr(1); /* strip off '#' */",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1000 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1001 \ " if (lineNum.indexOf('L') == -1) {",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1002 \ " lineNum = 'L'+lineNum;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1003 \ " }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1004 \ " var lineElem = document.getElementById(lineNum);"
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1005 \ ])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1006
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1007 if s:settings.dynamic_folds
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1008 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1009 \ "",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1010 \ " /* navigate upwards in the DOM tree to open all folds containing the line */",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1011 \ " var node = lineElem;",
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1012 \ " while (node && node.id != 'vimCodeElement"..s:settings.id_suffix.."')",
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1013 \ " {",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1014 \ " if (node.className == 'closed-fold')",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1015 \ " {",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1016 \ " node.className = 'open-fold';",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1017 \ " }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1018 \ " node = node.parentNode;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1019 \ " }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1020 \ ])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1021 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1022 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1023 \ " /* Always jump to new location even if the line was hidden inside a fold, or",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1024 \ " * we corrected the raw number to a line ID.",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1025 \ " */",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1026 \ " if (lineElem) {",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1027 \ " lineElem.scrollIntoView(true);",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1028 \ " }",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1029 \ " return true;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1030 \ "}",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1031 \ "if ('onhashchange' in window) {",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1032 \ " window.onhashchange = JumpToLine;",
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1033 \ "}"
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1034 \ ])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1035 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1036
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1037 " insert script closing tag if needed
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1038 if s:uses_script
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1039 call extend(s:lines, [
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1040 \ '',
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1041 \ s:settings.use_xhtml ? '//]]>' : '-->',
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1042 \ "</script>"
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1043 \ ])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1044 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1045
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1046 call extend(s:lines, ["</head>",
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1047 \ "<body"..(s:settings.line_ids ? " onload='JumpToLine();'" : "")..">"])
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1048 endif
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1049
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1050 if s:settings.no_pre
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1051 " if we're not using CSS we use a font tag which can't have a div inside
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1052 if s:settings.use_css
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1053 call extend(s:lines, ["<div id='vimCodeElement" .. s:settings.id_suffix .. "'>"])
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1054 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 else
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1056 call extend(s:lines, ["<pre id='vimCodeElement" .. s:settings.id_suffix .. "'>"])
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1059 exe s:orgwin .. "wincmd w"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1061 " caches of style data
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1062 " initialize to include line numbers if using them
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1063 if s:settings.number_lines
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1064 let s:stylelist = { s:LINENR_ID : ".LineNr { " .. s:CSS1( s:LINENR_ID ) .. "}" }
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1065 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1066 let s:stylelist = {}
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1067 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1068 let s:diffstylelist = {
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1069 \ s:DIFF_A_ID : ".DiffAdd { " .. s:CSS1( s:DIFF_A_ID ) .. "}",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1070 \ s:DIFF_C_ID : ".DiffChange { " .. s:CSS1( s:DIFF_C_ID ) .. "}",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1071 \ s:DIFF_D_ID : ".DiffDelete { " .. s:CSS1( s:DIFF_D_ID ) .. "}",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1072 \ s:DIFF_T_ID : ".DiffText { " .. s:CSS1( s:DIFF_T_ID ) .. "}"
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1073 \ }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1075 " set up progress bar in the status line
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1076 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1077 " ProgressBar Indicator
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1078 let s:progressbar={}
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1079
25773
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19099
diff changeset
1080 " Progressbar specific functions
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1081
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1082 func! s:SetProgbarColor()
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1083 if hlID("TOhtmlProgress") != 0
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1084 hi! link TOhtmlProgress_auto TOhtmlProgress
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1085 elseif hlID("TOhtmlProgress_auto")==0 ||
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1086 \ !exists("s:last_colors_name") || !exists("g:colors_name") ||
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1087 \ g:colors_name != s:last_colors_name
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1088 let s:last_colors_name = exists("g:colors_name") ? g:colors_name : "none"
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1089
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1090 let l:diffatr = synIDattr(hlID("DiffDelete")->synIDtrans(), "reverse", s:whatterm) ? "fg#" : "bg#"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1091 let l:stlatr = synIDattr(hlID("StatusLine")->synIDtrans(), "reverse", s:whatterm) ? "fg#" : "bg#"
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1092
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1093 let l:progbar_color = synIDattr(hlID("DiffDelete")->synIDtrans(), l:diffatr, s:whatterm)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1094 let l:stl_color = synIDattr(hlID("StatusLine")->synIDtrans(), l:stlatr, s:whatterm)
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1095
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1096 if "" == l:progbar_color
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1097 let l:progbar_color = synIDattr(hlID("DiffDelete")->synIDtrans(), "reverse", s:whatterm) ? s:fgc : s:bgc
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1098 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1099 if "" == l:stl_color
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1100 let l:stl_color = synIDattr(hlID("StatusLine")->synIDtrans(), "reverse", s:whatterm) ? s:fgc : s:bgc
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1101 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1102
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1103 if l:progbar_color == l:stl_color
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1104 if s:whatterm == 'cterm'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1105 if l:progbar_color >= (&t_Co/2)
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1106 let l:progbar_color-=1
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1107 else
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1108 let l:progbar_color+=1
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1109 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1110 else
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1111 let l:rgb = map(matchlist(l:progbar_color, '#\zs\x\x\ze\(\x\x\)\(\x\x\)')[:2], 'str2nr(v:val, 16)')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1112 let l:avg = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1113 if l:avg >= 128
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1114 let l:avg_new = l:avg
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1115 while l:avg - l:avg_new < 0x15
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1116 let l:rgb = map(l:rgb, 'v:val * 3 / 4')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1117 let l:avg_new = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1118 endwhile
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1119 else
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1120 let l:avg_new = l:avg
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1121 while l:avg_new - l:avg < 0x15
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1122 let l:rgb = map(l:rgb, 'min([max([v:val, 4]) * 5 / 4, 255])')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1123 let l:avg_new = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1124 endwhile
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1125 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1126 let l:progbar_color = printf("#%02x%02x%02x", l:rgb[0], l:rgb[1], l:rgb[2])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1127 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1128 echomsg "diff detected progbar color set to" l:progbar_color
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1129 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1130 exe "hi TOhtmlProgress_auto" s:whatterm.."bg="..l:progbar_color
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1131 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1132 endfun
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1133
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1134 func! s:ProgressBar(title, max_value, winnr)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1135 let pgb=copy(s:progressbar)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1136 let pgb.title = a:title..' '
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1137 let pgb.max_value = a:max_value
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1138 let pgb.winnr = a:winnr
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1139 let pgb.cur_value = 0
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1140
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1141 let pgb.items = { 'title' : { 'color' : 'Statusline' },
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1142 \'bar' : { 'color' : 'Statusline' , 'fillcolor' : 'TOhtmlProgress_auto' , 'bg' : 'Statusline' } ,
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1143 \'counter' : { 'color' : 'Statusline' } }
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1144 let pgb.last_value = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1145 let pgb.needs_redraw = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1146 " Note that you must use len(split) instead of len() if you want to use
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1147 " unicode in title.
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1148 "
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1149 " Subtract 3 for spacing around the title.
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1150 " Subtract 4 for the percentage display.
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1151 " Subtract 2 for spacing before this.
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1152 " Subtract 2 more for the '|' on either side of the progress bar
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1153 let pgb.subtractedlen=len(split(pgb.title, '\zs'))+3+4+2+2
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1154 let pgb.max_len = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1155 set laststatus=2
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1156 return pgb
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1157 endfun
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1158
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1159 " Function: progressbar.calculate_ticks() {{{1
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1160 func! s:progressbar.calculate_ticks(pb_len)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1161 if a:pb_len<=0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1162 let pb_len = 100
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1163 else
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1164 let pb_len = a:pb_len
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1165 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1166 let self.progress_ticks = map(range(pb_len+1), "v:val * self.max_value / pb_len")
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1167 endfun
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1168
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1169 "Function: progressbar.paint()
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1170 func! s:progressbar.paint()
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1171 " Recalculate widths.
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1172 let max_len = winwidth(self.winnr)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1173 let pb_len = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1174 " always true on first call because of initial value of self.max_len
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1175 if max_len != self.max_len
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1176 let self.max_len = max_len
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1177
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1178 " Progressbar length
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1179 let pb_len = max_len - self.subtractedlen
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1180
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1181 call self.calculate_ticks(pb_len)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1182
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1183 let self.needs_redraw = 1
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1184 let cur_value = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1185 let self.pb_len = pb_len
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1186 else
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1187 " start searching at the last found index to make the search for the
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1188 " appropriate tick value normally take 0 or 1 comparisons
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1189 let cur_value = self.last_value
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1190 let pb_len = self.pb_len
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1191 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1192
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1193 let cur_val_max = pb_len > 0 ? pb_len : 100
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1194
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1195 " find the current progress bar position based on precalculated thresholds
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1196 while cur_value < cur_val_max && self.cur_value > self.progress_ticks[cur_value]
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1197 let cur_value += 1
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1198 endwhile
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1199
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1200 " update progress bar
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1201 if self.last_value != cur_value || self.needs_redraw || self.cur_value == self.max_value
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1202 let self.needs_redraw = 1
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1203 let self.last_value = cur_value
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1204
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1205 let t_color = self.items.title.color
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1206 let b_fcolor = self.items.bar.fillcolor
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1207 let b_color = self.items.bar.color
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1208 let c_color = self.items.counter.color
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1209
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1210 let stl = "%#".t_color."#%-( ".self.title." %)".
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1211 \"%#".b_color."#".
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1212 \(pb_len>0 ?
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1213 \ ('|%#'.b_fcolor."#%-(".repeat(" ",cur_value)."%)".
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1214 \ '%#'.b_color."#".repeat(" ",pb_len-cur_value)."|"):
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1215 \ ('')).
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1216 \"%=%#".c_color."#%( ".printf("%3.d ",100*self.cur_value/self.max_value)."%% %)"
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1217 call setwinvar(self.winnr, '&stl', stl)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1218 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1219 endfun
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1220
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1221 func! s:progressbar.incr( ... )
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1222 let self.cur_value += (a:0 ? a:1 : 1)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1223 " if we were making a general-purpose progress bar, we'd need to limit to a
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1224 " lower limit as well, but since we always increment with a positive value
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1225 " in this script, we only need limit the upper value
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1226 let self.cur_value = (self.cur_value > self.max_value ? self.max_value : self.cur_value)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1227 call self.paint()
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1228 endfun
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1229 " }}}
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1230 if s:settings.dynamic_folds
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1231 " to process folds we make two passes through each line
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1232 let s:pgb = s:ProgressBar("Processing folds:", line('$')*2, s:orgwin)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1233 endif
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1234
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1235 call s:SetProgbarColor()
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1236 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1237
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1238 let s:build_fun_lines = []
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1239 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1240 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1241 func! s:Add_diff_fill(lnum)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1242 let l:filler = diff_filler(a:lnum)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1243 if l:filler > 0
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1244 let l:to_insert = l:filler
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1245 while l:to_insert > 0
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1246 let l:new = repeat(s:difffillchar, 3)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1247
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1248 if l:to_insert > 2 && l:to_insert < l:filler && !s:settings.whole_filler
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1249 let l:new = l:new .. " " .. l:filler .. " inserted lines "
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1250 let l:to_insert = 2
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1251 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1252 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1253 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1254 if !s:settings.no_pre
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1255 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1256 " HTML line wrapping is off--go ahead and fill to the margin
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1257 " TODO: what about when CSS wrapping is turned on?
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1258 let l:new = l:new .. repeat(s:difffillchar, &columns - strlen(l:new) - s:margin)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1259 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1260 else
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1261 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1262 let l:new = l:new .. repeat(s:difffillchar, 3)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1263 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1264 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1265 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1266 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1267 let l:new = s:HtmlFormat_d(l:new, s:DIFF_D_ID, 0)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1268 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1269 if s:settings.number_lines
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1270 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1271 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1272 " Indent if line numbering is on. Indent gets style of line number
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1273 " column.
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1274 let l:new = s:HtmlFormat_n(repeat(' ', s:margin), s:LINENR_ID, 0, 0) .. l:new
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1275 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1276 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1277 if s:settings.dynamic_folds && !s:settings.no_foldcolumn
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1278 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1279 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1280 if s:foldcolumn > 0
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1281 " Indent for foldcolumn if there is one. Assume it's empty, there should
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1282 " not be a fold for deleted lines in diff mode.
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1283 let l:new = s:FoldColumn_fill() .. l:new
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1284 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1285 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1286 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1287 " Ignore this comment, just bypassing a highlighting issue: if
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1288 call add(s:build_fun_lines, [])
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1289 let s:build_fun_lines[-1] =<< trim ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1290 call add(s:lines, l:new..s:HtmlEndline)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1291 let l:to_insert = l:to_insert - 1
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1292 endwhile
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1293 endif
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1294 endfun
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1295 ENDLET
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1296 exec join(flatten(s:build_fun_lines), "\n")
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1297
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1298 " First do some preprocessing for dynamic folding. Do this for the entire file
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1299 " so we don't accidentally start within a closed fold or something.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1300 let s:allfolds = []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1301
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1302 if s:settings.dynamic_folds
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1303 let s:lnum = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1304 let s:end = line('$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1305 " save the fold text and set it to the default so we can find fold levels
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1306 let s:foldtext_save = &foldtext
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1307 setlocal foldtext&
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1308
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1309 " we will set the foldcolumn in the html to the greater of the maximum fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1310 " level and the current foldcolumn setting
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1311 let s:foldcolumn = &foldcolumn
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1312
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1313 " get all info needed to describe currently closed folds
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1314 while s:lnum <= s:end
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1315 if foldclosed(s:lnum) == s:lnum
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1316 " default fold text has '+-' and then a number of dashes equal to fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1317 " level, so subtract 2 from index of first non-dash after the dashes
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1318 " in order to get the fold level of the current fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1319 let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1320 " store fold info for later use
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1321 let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1322 call add(s:allfolds, s:newfold)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1323 " open the fold so we can find any contained folds
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1324 execute s:lnum.."foldopen"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1325 else
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1326 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1327 call s:pgb.incr()
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1328 if s:pgb.needs_redraw
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1329 redrawstatus
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1330 let s:pgb.needs_redraw = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1331 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1332 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1333 let s:lnum = s:lnum + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1334 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1335 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1336
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1337 " close all folds to get info for originally open folds
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1338 silent! %foldclose!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1339 let s:lnum = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1340
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1341 " the originally open folds will be all folds we encounter that aren't
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1342 " already in the list of closed folds
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1343 while s:lnum <= s:end
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1344 if foldclosed(s:lnum) == s:lnum
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1345 " default fold text has '+-' and then a number of dashes equal to fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1346 " level, so subtract 2 from index of first non-dash after the dashes
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1347 " in order to get the fold level of the current fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1348 let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1349 let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1350 " only add the fold if we don't already have it
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1351 if empty(s:allfolds) || index(s:allfolds, s:newfold) == -1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1352 let s:newfold.type = "open-fold"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1353 call add(s:allfolds, s:newfold)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1354 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1355 " open the fold so we can find any contained folds
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1356 execute s:lnum.."foldopen"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1357 else
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1358 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1359 call s:pgb.incr()
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1360 if s:pgb.needs_redraw
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1361 redrawstatus
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1362 let s:pgb.needs_redraw = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1363 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1364 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1365 let s:lnum = s:lnum + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1366 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1367 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1368
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1369 " sort the folds so that we only ever need to look at the first item in the
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1370 " list of folds
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1371 call sort(s:allfolds, "s:FoldCompare")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1372
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1373 let &l:foldtext = s:foldtext_save
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1374 unlet s:foldtext_save
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1375
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1376 " close all folds again so we can get the fold text as we go
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1377 silent! %foldclose!
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1378
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1379 " Go through and remove folds we don't need to (or cannot) process in the
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1380 " current conversion range
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1381 "
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1382 " If a fold is removed which contains other folds, which are included, we need
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1383 " to adjust the level of the included folds as used by the conversion logic
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1384 " (avoiding special cases is good)
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1385 "
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1386 " Note any time we remove a fold, either all of the included folds are in it,
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1387 " or none of them, because we only remove a fold if neither its start nor its
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1388 " end are within the conversion range.
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1389 let leveladjust = 0
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1390 for afold in s:allfolds
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1391 let removed = 0
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1392 if exists("g:html_start_line") && exists("g:html_end_line")
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1393 if afold.firstline < g:html_start_line
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1394 if afold.lastline <= g:html_end_line && afold.lastline >= g:html_start_line
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1395 " if a fold starts before the range to convert but stops within the
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1396 " range, we need to include it. Make it start on the first converted
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1397 " line.
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1398 let afold.firstline = g:html_start_line
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1399 else
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1400 " if the fold lies outside the range or the start and stop enclose
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1401 " the entire range, don't bother parsing it
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1402 call remove(s:allfolds, index(s:allfolds, afold))
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1403 let removed = 1
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1404 if afold.lastline > g:html_end_line
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1405 let leveladjust += 1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1406 endif
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1407 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1408 elseif afold.firstline > g:html_end_line
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1409 " If the entire fold lies outside the range we need to remove it.
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1410 call remove(s:allfolds, index(s:allfolds, afold))
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1411 let removed = 1
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1412 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1413 elseif exists("g:html_start_line")
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1414 if afold.firstline < g:html_start_line
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1415 " if there is no last line, but there is a first line, the end of the
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1416 " fold will always lie within the region of interest, so keep it
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1417 let afold.firstline = g:html_start_line
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1418 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1419 elseif exists("g:html_end_line")
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1420 " if there is no first line we default to the first line in the buffer so
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1421 " the fold start will always be included if the fold itself is included.
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1422 " If however the entire fold lies outside the range we need to remove it.
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1423 if afold.firstline > g:html_end_line
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1424 call remove(s:allfolds, index(s:allfolds, afold))
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1425 let removed = 1
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1426 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1427 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1428 if !removed
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1429 let afold.level -= leveladjust
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1430 if afold.level+1 > s:foldcolumn
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1431 let s:foldcolumn = afold.level+1
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1432 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1433 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1434 endfor
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1435
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1436 " if we've removed folds containing the conversion range from processing,
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1437 " getting foldtext as we go won't know to open the removed folds, so the
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1438 " foldtext would be wrong; open them now.
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1439 "
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1440 " Note that only when a start and an end line is specified will a fold
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1441 " containing the current range ever be removed.
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1442 while leveladjust > 0
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1443 exe g:html_start_line.."foldopen"
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1444 let leveladjust -= 1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
1445 endwhile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1446 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1447
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1448 " Now loop over all lines in the original text to convert to html.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 " Use html_start_line and html_end_line if they are set.
2304
a59e6ac5ed28 When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
1450 if exists("g:html_start_line")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 let s:lnum = html_start_line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 if s:lnum < 1 || s:lnum > line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 let s:lnum = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 let s:lnum = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 endif
2304
a59e6ac5ed28 When the buffer is in diff mode, have :TOhtml create HTML to show the diff
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
1458 if exists("g:html_end_line")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 let s:end = html_end_line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 if s:end < s:lnum || s:end > line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 let s:end = line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 let s:end = line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1467 " stack to keep track of all the folds containing the current line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1468 let s:foldstack = []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1469
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1470 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1471 let s:pgb = s:ProgressBar("Processing lines:", s:end - s:lnum + 1, s:orgwin)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1472 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1473
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1474 if s:settings.number_lines
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1475 let s:margin = strlen(s:end) + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1476 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1477 let s:margin = 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1478 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1479
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1480 if has('folding') && !s:settings.ignore_folding
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1481 let s:foldfillchar = &fillchars[matchend(&fillchars, 'fold:')]
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1482 if s:foldfillchar == ''
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1483 let s:foldfillchar = '-'
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1484 endif
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1485 endif
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1486 let s:difffillchar = &fillchars[matchend(&fillchars, 'diff:')]
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1487 if s:difffillchar == ''
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1488 let s:difffillchar = '-'
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1489 endif
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1490
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1491 let s:foldId = 0
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1492
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1493 if !s:settings.expand_tabs
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1494 " If keeping tabs, add them to printable characters so we keep them when
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1495 " formatting text (strtrans() doesn't replace printable chars)
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1496 let s:old_isprint = &isprint
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1497 setlocal isprint+=9
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1498 endif
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1499
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 while s:lnum <= s:end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501
32
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1502 " If there are filler lines for diff mode, show these above the line.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1503 call s:Add_diff_fill(s:lnum)
32
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1504
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1505 " Start the line with the line number.
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1506 if s:settings.number_lines
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1507 let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) .. s:lnum .. ' '
32
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1508 endif
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1509
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1510 let s:new = ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1511
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1512 if has('folding') && !s:settings.ignore_folding && foldclosed(s:lnum) > -1 && !s:settings.dynamic_folds
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1513 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1514 " This is the beginning of a folded block (with no dynamic folding)
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1515 let s:new = foldtextresult(s:lnum)
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1516 if !s:settings.no_pre
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1517 " HTML line wrapping is off--go ahead and fill to the margin
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1518 let s:new = s:new .. repeat(s:foldfillchar, &columns - strlen(s:new))
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1519 endif
856
8cd729851562 updated for version 7.0g
vimboss
parents: 837
diff changeset
1520
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1521 " put numcol in a separate group for sake of unselectable text
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1522 let s:new = (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, s:lnum): "") .. s:HtmlFormat_t(s:new, s:FOLDED_ID, 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523
856
8cd729851562 updated for version 7.0g
vimboss
parents: 837
diff changeset
1524 " Skip to the end of the fold
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1525 let s:new_lnum = foldclosedend(s:lnum)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1526
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1527 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1528 call s:pgb.incr(s:new_lnum - s:lnum)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1529 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1530
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1531 let s:lnum = s:new_lnum
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1532
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1533 else
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1534 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1535 " A line that is not folded, or doing dynamic folding.
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1536 "
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1537 let s:line = getline(s:lnum)
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1538 let s:len = strlen(s:line)
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1539
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1540 if s:settings.dynamic_folds
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1541 " First insert a closing for any open folds that end on this line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1542 while !empty(s:foldstack) && get(s:foldstack,0).lastline == s:lnum-1
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1543 let s:new = s:new.."</span></span>"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1544 call remove(s:foldstack, 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1545 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1546
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1547 " Now insert an opening for any new folds that start on this line
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1548 let s:firstfold = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1549 while !empty(s:allfolds) && get(s:allfolds,0).firstline == s:lnum
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1550 let s:foldId = s:foldId + 1
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1551 let s:new ..= "<span id='"
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1552 let s:new ..= (exists('g:html_diff_win_num') ? "win"..g:html_diff_win_num : "")
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1553 let s:new ..= "fold"..s:foldId..s:settings.id_suffix.."' class='"..s:allfolds[0].type.."'>"
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1554
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1555
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1556 " Unless disabled, add a fold column for the opening line of a fold.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1557 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1558 " Note that dynamic folds require using css so we just use css to take
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1559 " care of the leading spaces rather than using &nbsp; in the case of
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1560 " html_no_pre to make it easier
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1561 if !s:settings.no_foldcolumn
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1562 " add fold column that can open the new fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1563 if s:allfolds[0].level > 1 && s:firstfold
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1564 let s:new = s:new .. s:FoldColumn_build('|', s:allfolds[0].level - 1, 0, "",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1565 \ 'toggle-open FoldColumn','javascript:toggleFold("fold'..s:foldstack[0].id..s:settings.id_suffix..'");')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1566 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1567 " add the filler spaces separately from the '+' char so that it can be
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1568 " shown/hidden separately during a hover unfold
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1569 let s:new = s:new .. s:FoldColumn_build("+", 1, 0, "",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1570 \ 'toggle-open FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1571 " If this is not the last fold we're opening on this line, we need
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1572 " to keep the filler spaces hidden if the fold is opened by mouse
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1573 " hover. If it is the last fold to open in the line, we shouldn't hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1574 " them, so don't apply the toggle-filler class.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1575 let s:new = s:new .. s:FoldColumn_build(" ", 1, s:foldcolumn - s:allfolds[0].level - 1, "",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1576 \ 'toggle-open FoldColumn'.. (get(s:allfolds, 1, {'firstline': 0}).firstline == s:lnum ?" toggle-filler" :""),
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1577 \ 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1578
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1579 " add fold column that can close the new fold
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1580 " only add extra blank space if we aren't opening another fold on the
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1581 " same line
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1582 if get(s:allfolds, 1, {'firstline': 0}).firstline != s:lnum
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1583 let s:extra_space = s:foldcolumn - s:allfolds[0].level
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1584 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1585 let s:extra_space = 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1586 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1587 if s:firstfold
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1588 " the first fold in a line has '|' characters from folds opened in
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1589 " previous lines, before the '-' for this fold
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1590 let s:new ..= s:FoldColumn_build('|', s:allfolds[0].level - 1, s:extra_space, '-',
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1591 \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1592 else
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1593 " any subsequent folds in the line only add a single '-'
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1594 let s:new = s:new .. s:FoldColumn_build("-", 1, s:extra_space, "",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1595 \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1596 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1597 let s:firstfold = 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1598 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1599
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1600 " Add fold text, moving the span ending to the next line so collapsing
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1601 " of folds works correctly.
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1602 " Put numcol in a separate group for sake of unselectable text.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1603 let s:new = s:new .. (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, 0) : "") .. substitute(s:HtmlFormat_t(foldtextresult(s:lnum), s:FOLDED_ID, 0), '</span>', s:HtmlEndline..'\n\0', '')
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1604 let s:new = s:new .. "<span class='fulltext'>"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1605
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1606 " open the fold now that we have the fold text to allow retrieval of
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1607 " fold text for subsequent folds
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1608 execute s:lnum.."foldopen"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1609 call insert(s:foldstack, remove(s:allfolds,0))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1610 let s:foldstack[0].id = s:foldId
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1611 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1612
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1613 " Unless disabled, add a fold column for other lines.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1614 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1615 " Note that dynamic folds require using css so we just use css to take
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1616 " care of the leading spaces rather than using &nbsp; in the case of
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1617 " html_no_pre to make it easier
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1618 if !s:settings.no_foldcolumn
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1619 if empty(s:foldstack)
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1620 " add the empty foldcolumn for unfolded lines if there is a fold
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1621 " column at all
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1622 if s:foldcolumn > 0
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1623 let s:new = s:new .. s:FoldColumn_fill()
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1624 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1625 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1626 " add the fold column for folds not on the opening line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1627 if get(s:foldstack, 0).firstline < s:lnum
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1628 let s:new = s:new .. s:FoldColumn_build('|', s:foldstack[0].level, s:foldcolumn - s:foldstack[0].level, "",
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1629 \ 'FoldColumn', 'javascript:toggleFold("fold'..s:foldstack[0].id..s:settings.id_suffix..'");')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1630 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1631 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1632 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1633 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1634
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1635 " Now continue with the unfolded line text
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1636 if s:settings.number_lines
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1637 let s:new = s:new .. s:HtmlFormat_n(s:numcol, s:LINENR_ID, 0, s:lnum)
5003
ad6996a23e3e Updated runtime files. New version of TOhtml plugin.
Bram Moolenaar <bram@vim.org>
parents: 4681
diff changeset
1638 elseif s:settings.line_ids
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1639 let s:new = s:new .. s:HtmlFormat_n("", s:LINENR_ID, 0, s:lnum)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 endif
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1641
32
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1642 " Get the diff attribute, if any.
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1643 let s:diffattr = diff_hlID(s:lnum, 1)
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1644
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1645 " initialize conceal info to act like not concealed, just in case
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1646 let s:concealinfo = [0, '']
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1647
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1648 " Loop over each character in the line
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1649 let s:col = 1
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1650
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1651 " most of the time we won't use the diff_id, initialize to zero
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1652 let s:diff_id = 0
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1653
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1654 while s:col <= s:len || (s:col == 1 && s:diffattr)
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1655 let s:startcol = s:col " The start column for processing text
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1656 if !s:settings.ignore_conceal && has('conceal')
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1657 let s:concealinfo = synconcealed(s:lnum, s:col)
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1658 endif
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1659 if !s:settings.ignore_conceal && s:concealinfo[0]
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1660 let s:col = s:col + 1
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1661 " Speed loop (it's small - that's the trick)
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1662 " Go along till we find a change in the match sequence number (ending
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1663 " the specific concealed region) or until there are no more concealed
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1664 " characters.
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1665 while s:col <= s:len && s:concealinfo == synconcealed(s:lnum, s:col) | let s:col = s:col + 1 | endwhile
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1666 elseif s:diffattr
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1667 let s:diff_id = diff_hlID(s:lnum, s:col)
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1668 let s:id = synID(s:lnum, s:col, 1)
32
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1669 let s:col = s:col + 1
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1670 " Speed loop (it's small - that's the trick)
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1671 " Go along till we find a change in hlID
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1672 while s:col <= s:len && s:id == synID(s:lnum, s:col, 1)
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1673 \ && s:diff_id == diff_hlID(s:lnum, s:col) |
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1674 \ let s:col = s:col + 1 |
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1675 \ endwhile
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1676 if s:len < &columns && !s:settings.no_pre
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1677 " Add spaces at the end of the raw text line to extend the changed
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1678 " line to the full width.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1679 let s:line = s:line .. repeat(' ', &columns - virtcol([s:lnum, s:len]) - s:margin)
856
8cd729851562 updated for version 7.0g
vimboss
parents: 837
diff changeset
1680 let s:len = &columns
8cd729851562 updated for version 7.0g
vimboss
parents: 837
diff changeset
1681 endif
32
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1682 else
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1683 let s:id = synID(s:lnum, s:col, 1)
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1684 let s:col = s:col + 1
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1685 " Speed loop (it's small - that's the trick)
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1686 " Go along till we find a change in synID
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1687 while s:col <= s:len && s:id == synID(s:lnum, s:col, 1) | let s:col = s:col + 1 | endwhile
41f9fd58cf13 updated for version 7.0019
vimboss
parents: 29
diff changeset
1688 endif
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1689
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1690 if s:settings.ignore_conceal || !s:concealinfo[0]
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1691 " Expand tabs if needed
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1692 let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1693 if s:settings.expand_tabs
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1694 let s:offset = 0
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1695 let s:idx = stridx(s:expandedtab, "\t")
15033
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
1696 let s:tablist = split(&vts,',')
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
1697 if empty(s:tablist)
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
1698 let s:tablist = [ &ts ]
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
1699 endif
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
1700 let s:tabidx = 0
f8b0f1e42f2c Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
1701 let s:tabwidth = 0
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1702 while s:idx >= 0
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1703 if s:startcol + s:idx == 1
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1704 let s:i = s:tablist[0]
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1705 else
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1706 " Get the character, which could be multiple bytes, which falls
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1707 " immediately before the found tab. Extract it by matching a
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1708 " character just prior to the column where the tab matches.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1709 " We'll use this to get the byte index of the character
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1710 " immediately preceding the tab, so we can then look up the
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1711 " virtual column that character appears in, to determine how
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1712 " much of the current tabstop has been used up.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1713 if s:idx == 0
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1714 " if the found tab is the first character in the text being
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1715 " processed, we need to get the character prior to the text,
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1716 " given by startcol.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1717 let s:prevc = matchstr(s:line, '.\%' .. (s:startcol + s:offset) .. 'c')
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1718 else
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1719 " Otherwise, the byte index of the tab into s:expandedtab is
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1720 " given by s:idx.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1721 let s:prevc = matchstr(s:expandedtab, '.\%' .. (s:idx + 1) .. 'c')
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1722 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1723 let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1724
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1725 " find the tabstop interval to use for the tab we just found. Keep
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1726 " adding tabstops (which could be variable) until we would exceed
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1727 " the virtual screen position of the start of the found tab.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1728 while s:vcol >= s:tabwidth + s:tablist[s:tabidx]
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1729 let s:tabwidth += s:tablist[s:tabidx]
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1730 if s:tabidx < len(s:tablist)-1
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1731 let s:tabidx = s:tabidx+1
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1732 endif
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1733 endwhile
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1734 let s:i = s:tablist[s:tabidx] - (s:vcol - s:tabwidth)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1735 endif
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1736 " update offset to keep the index within the line corresponding to
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1737 " actual tab characters instead of replaced spaces; s:idx reflects
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1738 " replaced spaces in s:expandedtab, s:offset cancels out all but
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1739 " the tab character itself.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1740 let s:offset -= s:i - 1
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1741 let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1742 let s:idx = stridx(s:expandedtab, "\t")
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1743 endwhile
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1744 end
34
7f788cd27415 updated for version 7.0020
vimboss
parents: 32
diff changeset
1745
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1746 " get the highlight group name to use
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1747 let s:id = synIDtrans(s:id)
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1748 else
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1749 " use Conceal highlighting for concealed text
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1750 let s:id = s:CONCEAL_ID
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1751 let s:expandedtab = s:concealinfo[1]
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1752 endif
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1753
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1754 " Output the text with the same synID, with class set to the highlight ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1755 " name, unless it has been concealed completely.
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1756 if strlen(s:expandedtab) > 0
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1757 let s:new = s:new .. s:HtmlFormat(s:expandedtab, s:id, s:diff_id, "", 0)
2401
e7751177126b Add the synconcealed() function and use it for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2334
diff changeset
1758 endif
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1759 endwhile
ac33b7c03fac updated for version 7.0018
vimboss
parents: 7
diff changeset
1760 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1762 call extend(s:lines, split(s:new..s:HtmlEndline, '\n', 1))
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1763 if !s:settings.no_progress && s:pgb.needs_redraw
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1764 redrawstatus
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1765 let s:pgb.needs_redraw = 0
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1766 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 let s:lnum = s:lnum + 1
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1768
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1769 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1770 call s:pgb.incr()
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1771 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 endwhile
1122
2ad54fcf37e3 updated for version 7.1a
vimboss
parents: 856
diff changeset
1773
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1774 " Diff filler is returned based on what needs inserting *before* the given line.
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1775 " So to get diff filler at the end of the buffer, we need to use last line + 1
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1776 call s:Add_diff_fill(s:end+1)
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1777
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1778 if s:settings.dynamic_folds
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1779 " finish off any open folds
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1780 while !empty(s:foldstack)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1781 let s:lines[-1]..="</span></span>"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1782 call remove(s:foldstack, 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1783 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1784
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1785 " add fold column to the style list if not already there
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1786 let s:id = s:FOLD_C_ID
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1787 if !has_key(s:stylelist, s:id)
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1788 let s:stylelist[s:id] = '.FoldColumn { ' .. s:CSS1(s:id) .. '}'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1789 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1790 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
1791
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1792 if s:settings.no_pre
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1793 if !s:settings.use_css
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1794 " Close off the font tag that encapsulates the whole <body>
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1795 call extend(s:lines, ["</font>"])
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1796 else
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1797 call extend(s:lines, ["</div>"])
2432
80229a724a11 Updated runtime files. :TOhtml improvements by Benjamin Fritz.
Bram Moolenaar <bram@vim.org>
parents: 2401
diff changeset
1798 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 else
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1800 call extend(s:lines, ["</pre>"])
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1801 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1802 if !s:settings.no_doc
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1803 call extend(s:lines, ["</body>", "</html>"])
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1806 exe s:newwin .. "wincmd w"
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1807 call setline(1, s:lines)
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
1808 unlet s:lines
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1810 " Mangle modelines so Vim doesn't try to use HTML text as a modeline if editing
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1811 " this file in the future; need to do this after generating all the text in case
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1812 " the modeline text has different highlight groups which all turn out to be
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1813 " stripped from the final output.
5161
f7add3891e95 Updated runtime files. Fix NL translations.
Bram Moolenaar <bram@vim.org>
parents: 5003
diff changeset
1814 %s!\v(%(^|\s+)%([Vv]i%(m%([<=>]?\d+)?)?|ex)):!\1\&#0058;!ge
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1815
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1816 " 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
1817 " 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
1818 " using a modeline.
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1819 if !s:settings.no_modeline
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1820 call append(line('$'), "<!-- vim: set foldmethod=manual : -->")
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1821 endif
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1822
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 " Now, when we finally know which, we define the colors and styles
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1824 if s:settings.use_css && !s:settings.no_doc
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1825 1;/<style\>/+1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1827 " Normal/global attributes
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
1828 if s:settings.no_pre
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1829 call append('.', "body { color: " .. s:fgc .. "; background-color: " .. s:bgc .. "; font-family: ".. s:htmlfont .."; }")
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1830 +
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 else
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1832 call append('.', "pre { " .. s:whitespace .. "font-family: ".. s:htmlfont .."; color: " .. s:fgc .. "; background-color: " .. s:bgc .. "; }")
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1833 +
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 yank
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 put
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 execute "normal! ^cwbody\e"
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
1837 " body should not have the wrap formatting, only the pre section
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
1838 if s:whitespace != ''
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1839 exec 's#'..s:whitespace
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
1840 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1842 " fix browser inconsistencies (sometimes within the same browser) of different
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1843 " default font size for different elements
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1844 call append('.', '* { font-size: 1em; }')
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1845 +
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1846 " if we use any input elements for unselectable content, make sure they look
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1847 " like normal text
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1848 if !empty(s:settings.prevent_copy)
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1849 if s:settings.use_input_for_pc !=# "none"
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1850 call append('.', 'input { border: none; margin: 0; padding: 0; font-family: '..s:htmlfont..'; }')
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1851 +
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1852 " ch units for browsers which support them, em units for a somewhat
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1853 " reasonable fallback.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1854 for w in range(1, 20, 1)
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1855 call append('.', [
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1856 \ "input[size='"..w.."'] { width: "..w.."em; width: "..w.."ch; }"
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1857 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1858 +
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1859 endfor
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1860 endif
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1861
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1862 if s:settings.use_input_for_pc !=# 'all'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1863 let s:unselectable_styles = []
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1864 if s:settings.prevent_copy =~# 'f'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1865 call add(s:unselectable_styles, 'FoldColumn')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1866 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1867 if s:settings.prevent_copy =~# 'n'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1868 call add(s:unselectable_styles, 'LineNr')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1869 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1870 if s:settings.prevent_copy =~# 't' && !s:settings.ignore_folding
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1871 call add(s:unselectable_styles, 'Folded')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1872 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1873 if s:settings.prevent_copy =~# 'd'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1874 call add(s:unselectable_styles, 'DiffDelete')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1875 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1876 if s:settings.use_input_for_pc !=# 'none'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1877 call append('.', [
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1878 \ '/* Note: IE does not support @supports conditionals, but also does not fully support',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1879 \ ' "content:" with custom content, so we *want* the check to fail */',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1880 \ '@supports ( content: attr(data-custom-content) ) {'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1881 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1882 +3
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1883 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1884 " The line number column inside the foldtext is styled just like the fold
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1885 " text in Vim, but it should use the prevent_copy settings of line number
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1886 " rather than fold text. Apply the prevent_copy styles to foldtext
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1887 " specifically for line numbers, which always come after the fold column,
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1888 " or at the beginning of the line.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1889 if s:settings.prevent_copy =~# 'n' && !s:settings.ignore_folding
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1890 call append('.', [
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1891 \ ' .FoldColumn + .Folded, .Folded:first-child { user-select: none; }',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1892 \ ' .FoldColumn + [data-Folded-content]::before, [data-Folded-content]:first-child::before { content: attr(data-Folded-content); }',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1893 \ ' .FoldColumn + [data-Folded-content]::before, [data-Folded-content]:first-child::before { padding-bottom: 1px; display: inline-block; /* match the 1-px padding of standard items with background */ }',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1894 \ ' .FoldColumn + span[data-Folded-content]::before, [data-Folded-content]:first-child::before { cursor: default; }',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1895 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1896 +4
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1897 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1898 for s:style_name in s:unselectable_styles
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1899 call append('.', [
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1900 \ ' .'..s:style_name..' { user-select: none; }',
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1901 \ ' [data-'..s:style_name..'-content]::before { content: attr(data-'..s:style_name..'-content); }',
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1902 \ ' [data-'..s:style_name..'-content]::before { padding-bottom: 1px; display: inline-block; /* match the 1-px padding of standard items with background */ }',
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1903 \ ' span[data-'..s:style_name..'-content]::before { cursor: default; }',
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1904 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1905 +4
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1906 endfor
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1907 if s:settings.use_input_for_pc !=# 'none'
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1908 " Note, the extra '}' is to match the "@supports" above
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1909 call append('.', [
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1910 \ ' input { display: none; }',
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1911 \ '}'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1912 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1913 +2
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1914 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1915 unlet s:unselectable_styles
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1916 endif
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1917
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1918 " Fix mouse cursor shape for the fallback <input> method of uncopyable text
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1919 if s:settings.use_input_for_pc !=# 'none'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1920 if s:settings.prevent_copy =~# 'f'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1921 " Make the cursor show active fold columns as active areas, and empty fold
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1922 " columns as not interactive.
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1923 call append('.', ['input.FoldColumn { cursor: pointer; }',
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1924 \ 'input.FoldColumn[value="'..repeat(' ', s:foldcolumn)..'"] { cursor: default; }'
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1925 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1926 +2
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1927 if s:settings.use_input_for_pc !=# 'all'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1928 call append('.', [
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1929 \ 'a[data-FoldColumn-content="'..repeat(' ', s:foldcolumn)..'"] { cursor: default; }'
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1930 \ ])
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1931 +1
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1932 end
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1933 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1934 " make line number column show as non-interactive if not selectable
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1935 if s:settings.prevent_copy =~# 'n'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1936 call append('.', 'input.LineNr { cursor: default; }')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1937 +
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1938 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1939 " make fold text and line number column within fold text show as
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1940 " non-interactive if not selectable
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1941 if (s:settings.prevent_copy =~# 'n' || s:settings.prevent_copy =~# 't') && !s:settings.ignore_folding
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1942 call append('.', 'input.Folded { cursor: default; }')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1943 +
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1944 endif
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1945 " make diff filler show as non-interactive if not selectable
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1946 if s:settings.prevent_copy =~# 'd'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1947 call append('.', 'input.DiffDelete { cursor: default; }')
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1948 +
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1949 endif
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1950 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1951 endif
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1952 endif
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1953
31579
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30967
diff changeset
1954 if !s:settings.use_css && !s:settings.no_doc
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1955 " For Netscape 4, set <body> attributes too, though, strictly speaking, it's
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
1956 " incorrect.
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
1957 execute '%s:<body\([^>]*\):<body bgcolor="' .. s:bgc .. '" text="' .. s:fgc .. '"\1>\r<font face="'.. s:htmlfont ..'"'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1960 " Gather attributes for all other classes. Do diff first so that normal
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1961 " highlight groups are inserted before it.
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1962 if s:settings.use_css && !s:settings.no_doc
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1963 if s:diff_mode
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1964 call append('.', filter(map(keys(s:diffstylelist), "s:diffstylelist[v:val]"), 'v:val != ""'))
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1965 endif
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1966 if !empty(s:stylelist)
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
1967 call append('.', filter(map(keys(s:stylelist), "s:stylelist[v:val]"), 'v:val != ""'))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 " Add hyperlinks
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1972 if !s:settings.no_links
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1973 %s+\(https\=://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|&gt;\|&lt;\|&quot;\)+<a href="\1">\1</a>\2+ge
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1974 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 " The DTD
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1977 if !s:settings.no_doc
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1978 if s:settings.use_xhtml
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1979 exe "normal! gg$a\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1980 elseif s:html5
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1981 exe "normal! gg0i<!DOCTYPE html>\n"
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1982 else
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1983 exe "normal! gg0i<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1984 endif
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 34
diff changeset
1985 endif
410fa1a31baf updated for version 7.0023
vimboss
parents: 34
diff changeset
1986
30967
eb2638f278bf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25773
diff changeset
1987 if s:settings.use_xhtml && !s:settings.no_doc
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 34
diff changeset
1988 exe "normal! gg/<html/e\na xmlns=\"http://www.w3.org/1999/xhtml\"\e"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 " Cleanup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992 %s:\s\+$::e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
1994 " Restore old settings (new window first)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1995 "
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1996 " Don't bother restoring foldmethod in case it was syntax because the markup is
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
1997 " so weirdly formatted it can take a LONG time.
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
1998 let &l:foldenable = s:old_fen
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 let &report = s:old_report
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 let &title = s:old_title
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 let &icon = s:old_icon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 let &paste = s:old_paste
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003 let &magic = s:old_magic
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 let @/ = s:old_search
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2005 let &more = s:old_more
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2006
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2007 " switch to original window to restore those settings
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
2008 exe s:orgwin .. "wincmd w"
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2009
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2010 if !s:settings.expand_tabs
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2011 let &l:isprint = s:old_isprint
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2012 endif
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
2013 let &l:stl = s:origwin_stl
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 let &l:et = s:old_et
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
2015 let &l:scrollbind = s:old_bind
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2016
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2017 " and back to the new window again to end there
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
2018 exe s:newwin .. "wincmd w"
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2019
2642
840c3cadb842 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2546
diff changeset
2020 let &l:stl = s:newwin_stl
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2021 exec 'resize' s:old_winheight
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2022 let &l:winfixheight = s:old_winfixheight
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2024 let &ls=s:ls
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
2025 let &eventignore=s:ei_sav
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2026
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 " Save a little bit of memory (worth doing?)
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2681
diff changeset
2028 unlet s:htmlfont s:whitespace
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
2029 unlet s:old_et s:old_paste s:old_icon s:old_report s:old_title s:old_search
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 3713
diff changeset
2030 unlet s:old_magic s:old_more s:old_fen s:old_winheight
2681
85c5a72551e2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2642
diff changeset
2031 unlet! s:old_isprint
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2032 unlet s:whatterm s:stylelist s:diffstylelist s:lnum s:end s:margin s:fgc s:bgc s:old_winfixheight
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2033 unlet! s:col s:id s:attr s:len s:line s:new s:expandedtab s:concealinfo s:diff_mode
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15033
diff changeset
2034 unlet! s:orgwin s:newwin s:orgbufnr s:idx s:i s:offset s:ls s:ei_sav s:origwin_stl
2546
0d3f0e3d289b Updates for :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2508
diff changeset
2035 unlet! s:newwin_stl s:current_syntax
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2036 if !v:profiling
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2037 delfunc s:HtmlColor
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2038 delfunc s:HtmlFormat
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2039 delfunc s:CSS1
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2040 delfunc s:BuildStyleWrapper
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
2041 if !s:settings.use_css
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2042 delfunc s:HtmlOpening
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2043 delfunc s:HtmlClosing
8c60f65311fa updated for version 7.0052
vimboss
parents: 39
diff changeset
2044 endif
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
2045 if s:settings.dynamic_folds
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2046 delfunc s:FoldCompare
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2047 endif
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2048
2496
a29075150aee Improve handling of user settings in :TOhtml. Default to generating CSS.
Bram Moolenaar <bram@vim.org>
parents: 2432
diff changeset
2049 if !s:settings.no_progress
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2050 delfunc s:ProgressBar
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2051 delfunc s:progressbar.paint
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2052 delfunc s:progressbar.incr
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2053 unlet s:pgb s:progressbar
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2054 endif
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
2055
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
2056 delfunc s:Add_diff_fill
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 endif
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2058
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
2059 unlet! s:new_lnum s:diffattr s:difffillchar s:foldfillchar s:HtmlSpace s:diffstyle
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2060 unlet! s:LeadingSpace s:HtmlEndline s:firstfold s:numcol s:foldcolumn
33216
d77a9aab91ad runtime(tohtml): Update TOhtml to version 9.0v2 (#13050)
Christian Brabandt <cb@256bit.org>
parents: 31885
diff changeset
2061 unlet! s:wrapperfunc_lines s:build_fun_lines
3713
9910cbff5f16 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2062 unlet s:foldstack s:allfolds s:foldId s:settings
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
2063
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
2064 let &cpo = s:cpo_sav
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2065 unlet! s:cpo_sav
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
2066
2321
1902913f2049 Improved version of 2html.vim.
Bram Moolenaar <bram@vim.org>
parents: 2304
diff changeset
2067 " Make sure any patches will probably use consistent indent
2334
3c9324c0800e Improved :TOhtml. (Benjamin Fritz)
Bram Moolenaar <bram@vim.org>
parents: 2321
diff changeset
2068 " vim: ts=8 sw=2 sts=2 noet