4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When "g:html_use_css" is set the HTML header generated by the
12 2html script is wrong.
13 Solution: Add the header after adding HREF for links.
14 Also use ":normal!" instead of ":normal" to avoid mappings
16 Files: runtime/syntax/2html.vim
19 *** ../vim-6.2.143/runtime/syntax/2html.vim Sat May 31 20:59:11 2003
20 --- runtime/syntax/2html.vim Sun Nov 2 17:44:26 2003
23 " Vim syntax support file
24 " Maintainer: Bram Moolenaar <Bram@vim.org>
25 ! " Last Change: 2003 May 31
26 " (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>)
28 " Transform a file into HTML, using the current syntax highlighting.
30 " Vim syntax support file
31 " Maintainer: Bram Moolenaar <Bram@vim.org>
32 ! " Last Change: 2003 Nov 02
33 " (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>)
35 " Transform a file into HTML, using the current syntax highlighting.
38 let s:old_magic = &magic
42 - if exists("html_use_css")
43 - exe "normal a<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n \"http://www.w3.org/TR/html4/strict.dtd\">\n\e"
46 " HTML header, with the title and generator ;-). Left free space for the CSS,
47 " to be filled at the end.
48 ! exe "normal a<html>\n<head>\n<title>\e"
49 ! exe "normal a" . expand("%:p:~") . "</title>\n\e"
50 ! exe "normal a<meta name=\"Generator\" content=\"Vim/" . version/100 . "." . version %100 . "\">\n\e"
51 if s:html_encoding != ""
52 ! exe "normal a<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:html_encoding . "\">\n\e"
54 if exists("html_use_css")
55 ! exe "normal a<style type=\"text/css\">\n<!--\n-->\n</style>\n\e"
57 if exists("html_no_pre")
58 ! exe "normal a</head>\n<body>\n\e"
60 ! exe "normal a</head>\n<body>\n<pre>\n\e"
65 let s:old_magic = &magic
68 " HTML header, with the title and generator ;-). Left free space for the CSS,
69 " to be filled at the end.
70 ! exe "normal! a<html>\n<head>\n<title>\e"
71 ! exe "normal! a" . expand("%:p:~") . "</title>\n\e"
72 ! exe "normal! a<meta name=\"Generator\" content=\"Vim/" . version/100 . "." . version %100 . "\">\n\e"
73 if s:html_encoding != ""
74 ! exe "normal! a<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:html_encoding . "\">\n\e"
76 if exists("html_use_css")
77 ! exe "normal! a<style type=\"text/css\">\n<!--\n-->\n</style>\n\e"
79 if exists("html_no_pre")
80 ! exe "normal! a</head>\n<body>\n\e"
82 ! exe "normal! a</head>\n<body>\n<pre>\n\e"
88 if exists("html_no_pre")
89 let s:new = substitute(s:new, ' ', '\ \ ', 'g') . '<br>'
91 ! exe "normal \<C-W>pa" . strtrans(s:new) . "\n\e\<C-W>p"
92 let s:lnum = s:lnum + 1
95 " Finish with the last line
96 if exists("html_no_pre")
97 ! exe "normal \<C-W>pa\n</body>\n</html>\e"
99 ! exe "normal \<C-W>pa</pre>\n</body>\n</html>\e"
104 if exists("html_no_pre")
105 let s:new = substitute(s:new, ' ', '\ \ ', 'g') . '<br>'
107 ! exe "normal! \<C-W>pa" . strtrans(s:new) . "\n\e\<C-W>p"
108 let s:lnum = s:lnum + 1
111 " Finish with the last line
112 if exists("html_no_pre")
113 ! exe "normal! \<C-W>pa\n</body>\n</html>\e"
115 ! exe "normal! \<C-W>pa</pre>\n</body>\n</html>\e"
122 if exists("html_use_css")
123 if exists("html_no_pre")
124 ! execute "normal A\nbody { color: " . s:fgc . "; background-color: " . s:bgc . "; font-family: Courier, monospace; }\e"
126 ! execute "normal A\npre { color: " . s:fgc . "; background-color: " . s:bgc . "; }\e"
129 ! execute "normal ^cwbody\e"
132 if exists("html_no_pre")
135 if exists("html_use_css")
136 if exists("html_no_pre")
137 ! execute "normal! A\nbody { color: " . s:fgc . "; background-color: " . s:bgc . "; font-family: Courier, monospace; }\e"
139 ! execute "normal! A\npre { color: " . s:fgc . "; background-color: " . s:bgc . "; }\e"
142 ! execute "normal! ^cwbody\e"
145 if exists("html_no_pre")
148 " Line numbering attributes
150 if exists("html_use_css")
151 ! execute "normal A\n.lnr { " . s:CSS1(hlID("LineNr")) . "}\e"
153 execute '%s+<span class="lnr">\([^<]*\)</span>+' . s:HtmlOpening(hlID("LineNr")) . '\1' . s:HtmlClosing(hlID("LineNr")) . '+g'
156 " Line numbering attributes
158 if exists("html_use_css")
159 ! execute "normal! A\n.lnr { " . s:CSS1(hlID("LineNr")) . "}\e"
161 execute '%s+<span class="lnr">\([^<]*\)</span>+' . s:HtmlOpening(hlID("LineNr")) . '\1' . s:HtmlClosing(hlID("LineNr")) . '+g'
165 " its occurences to make the HTML shorter
167 if exists("html_use_css")
168 ! execute "normal A\n." . s:id_name . " { " . s:attr . "}"
170 execute '%s+<span class="' . s:id_name . '">\([^<]*\)</span>+' . s:HtmlOpening(s:id) . '\1' . s:HtmlClosing(s:id) . '+g'
173 " its occurences to make the HTML shorter
175 if exists("html_use_css")
176 ! execute "normal! A\n." . s:id_name . " { " . s:attr . "}"
178 execute '%s+<span class="' . s:id_name . '">\([^<]*\)</span>+' . s:HtmlOpening(s:id) . '\1' . s:HtmlClosing(s:id) . '+g'
185 ! %s+\(http://\S\{-}\)\(\([.,;:]\=\(\s\|$\)\)\|[\\"'<>]\)+<A HREF="\1">\1</A>\2+ge
193 ! %s+\(http://\S\{-}\)\(\([.,;:]\=\(\s\|$\)\)\|[\\"'<>]\|>\|<\)+<A HREF="\1">\1</A>\2+ge
196 ! if exists("html_use_css")
197 ! exe "normal! ggi<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n\e"
202 *** ../vim-6.2.143/src/version.c Sun Nov 2 15:49:56 2003
203 --- src/version.c Sun Nov 2 17:48:30 2003
207 { /* Add new patch number below this line */
213 Violators can be fined, arrested or jailed for making ugly faces at a dog.
214 [real standing law in Oklahoma, United States of America]
216 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
217 /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
218 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
219 \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///