Mercurial > vim
comparison runtime/syntax/2html.vim @ 837:6bb1fa855dc9 v7.0e03
updated for version 7.0e03
author | vimboss |
---|---|
date | Wed, 19 Apr 2006 21:23:36 +0000 |
parents | 5a7843c57316 |
children | 8cd729851562 |
comparison
equal
deleted
inserted
replaced
836:5a7843c57316 | 837:6bb1fa855dc9 |
---|---|
1 " Vim syntax support file | 1 " Vim syntax support file |
2 " Maintainer: Bram Moolenaar <Bram@vim.org> | 2 " Maintainer: Bram Moolenaar <Bram@vim.org> |
3 " Last Change: 2006 Apr 18 | 3 " Last Change: 2006 Apr 19 |
4 " (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>) | 4 " (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>) |
5 " (XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>) | 5 " (XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>) |
6 | 6 |
7 " Transform a file into HTML, using the current syntax highlighting. | 7 " Transform a file into HTML, using the current syntax highlighting. |
8 | 8 |
110 let formatted = strtrans(a:text) | 110 let formatted = strtrans(a:text) |
111 | 111 |
112 " Replace the reserved html characters | 112 " Replace the reserved html characters |
113 let formatted = substitute(substitute(substitute(substitute(substitute(formatted, '&', '\&', 'g'), '<', '\<', 'g'), '>', '\>', 'g'), '"', '\"', 'g'), "\x0c", '<hr class="PAGE-BREAK">', 'g') | 113 let formatted = substitute(substitute(substitute(substitute(substitute(formatted, '&', '\&', 'g'), '<', '\<', 'g'), '>', '\>', 'g'), '"', '\"', 'g'), "\x0c", '<hr class="PAGE-BREAK">', 'g') |
114 | 114 |
115 " Replace double spaces | 115 " Replace double spaces and leading spaces |
116 if ' ' != s:HtmlSpace | 116 if ' ' != s:HtmlSpace |
117 let formatted = substitute(formatted, ' ', s:HtmlSpace . s:HtmlSpace, 'g') | 117 let formatted = substitute(formatted, ' ', s:HtmlSpace . s:HtmlSpace, 'g') |
118 let formatted = substitute(formatted, '^ ', s:HtmlSpace, 'g') | |
118 endif | 119 endif |
119 | 120 |
120 " Enclose in a span of class style_name | 121 " Enclose in a span of class style_name |
121 let formatted = '<span class="' . a:style_name . '">' . formatted . '</span>' | 122 let formatted = '<span class="' . a:style_name . '">' . formatted . '</span>' |
122 | 123 |
361 let s:line = getline(s:lnum) | 362 let s:line = getline(s:lnum) |
362 | 363 |
363 let s:len = strlen(s:line) | 364 let s:len = strlen(s:line) |
364 | 365 |
365 if s:numblines | 366 if s:numblines |
366 let s:new = '<span class="lnr">' . s:new . '</span>' | 367 let s:new = s:HtmlFormat(s:new, "lnr") |
367 endif | 368 endif |
368 | 369 |
369 " Get the diff attribute, if any. | 370 " Get the diff attribute, if any. |
370 let s:diffattr = diff_hlID(s:lnum, 1) | 371 let s:diffattr = diff_hlID(s:lnum, 1) |
371 | 372 |
417 exe s:newwin . "wincmd w" | 418 exe s:newwin . "wincmd w" |
418 if exists("html_no_pre") | 419 if exists("html_no_pre") |
419 if exists("use_xhtml") | 420 if exists("use_xhtml") |
420 exe "normal! a</p>\n</body>\n</html>\e" | 421 exe "normal! a</p>\n</body>\n</html>\e" |
421 else | 422 else |
422 exe "normal! a\n</body>\n</html>\e" | 423 exe "normal! a</body>\n</html>\e" |
423 endif | 424 endif |
424 else | 425 else |
425 if exists("use_xhtml") | 426 if exists("use_xhtml") |
426 exe "normal! a</pre>\n</p>\n</body>\n</html>\e" | 427 exe "normal! a</pre>\n</p>\n</body>\n</html>\e" |
427 else | 428 else |
468 " Line numbering attributes | 469 " Line numbering attributes |
469 if s:numblines | 470 if s:numblines |
470 if exists("html_use_css") | 471 if exists("html_use_css") |
471 execute "normal! A\n.lnr { " . s:CSS1(hlID("LineNr")) . "}\e" | 472 execute "normal! A\n.lnr { " . s:CSS1(hlID("LineNr")) . "}\e" |
472 else | 473 else |
473 execute '%s+<span class="lnr">\([^<]*\)</span>+' . s:HtmlOpening(hlID("LineNr")) . '\1' . s:HtmlClosing(hlID("LineNr")) . '+g' | 474 execute '%s+^<span class="lnr">\([^<]*\)</span>+' . s:HtmlOpening(hlID("LineNr")) . '\1' . s:HtmlClosing(hlID("LineNr")) . '+g' |
474 endif | 475 endif |
475 endif | 476 endif |
476 | 477 |
477 " Gather attributes for all other classes | 478 " Gather attributes for all other classes |
478 let s:idlist = strpart(s:idlist, 1) | 479 let s:idlist = strpart(s:idlist, 1) |