]> Pileus Git - vpaste/blob - 2html.patch
Use /bin/sh for vpaste script
[vpaste] / 2html.patch
1 --- /usr/share/vim/vim73/syntax/2html.vim       2010-08-28 18:59:26.000000000 +0000
2 +++ /home/andy/.vim/syntax/2html.vim    2010-08-31 04:34:00.000000000 +0000
3 @@ -33,6 +33,13 @@
4  
5  let s:settings = tohtml#GetUserSettings()
6  
7 +" Whitespace
8 +if &wrap
9 +  let s:whitespace = "white-space: pre-wrap; "
10 +else
11 +  let s:whitespace = ""
12 +endif
13 +
14  " When not in gui we can only guess the colors.
15  if has("gui_running")
16    let s:whatterm = "gui"
17 @@ -211,7 +218,6 @@
18  let s:old_search = @/
19  let s:old_more = &more
20  set notitle noicon
21 -setlocal et
22  set nomore
23  set report=1000000
24  setlocal noscrollbind
25 @@ -298,7 +304,7 @@
26    call add(s:lines, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.encoding . '"' . s:tag_close)
27  endif
28  call extend(s:lines, [
29 -      \ ("<title>".expand("%:p:~")."</title>"),
30 +      \ ("<title>".&titlestring."</title>"),
31        \ ("<meta name=\"Generator\" content=\"Vim/".v:version/100.".".v:version%100.'"'.s:tag_close),
32        \ ("<meta name=\"plugin-version\" content=\"".g:loaded_2html_plugin.'"'.s:tag_close)
33        \ ])
34 @@ -408,7 +414,7 @@
35  if s:settings.no_pre
36    call extend(s:lines, ["</head>", "<body>"])
37  else
38 -  call extend(s:lines, ["</head>", "<body>", "<pre>"])
39 +  call extend(s:lines, ["</head>", "<body><pre>"])
40  endif
41  
42  exe s:orgwin . "wincmd w"
43 @@ -873,6 +879,7 @@
44        if s:settings.ignore_conceal || !s:concealinfo[0]
45         " Expand tabs
46         let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
47 +       if &expandtab
48         let s:offset = 0
49         let s:idx = stridx(s:expandedtab, "\t")
50         while s:idx >= 0
51 @@ -895,6 +902,9 @@
52           let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
53           let s:idx = stridx(s:expandedtab, "\t")
54         endwhile
55 +       else
56 +         setlocal isprint+=9
57 +       end
58  
59         " get the highlight group name to use
60         let s:id = synIDtrans(s:id)
61 @@ -945,12 +955,12 @@
62  if s:settings.no_pre
63    if !s:settings.use_css
64      " Close off the font tag that encapsulates the whole <body>
65 -    call extend(s:lines, ["</font>", "</body>", "</html>"])
66 +    call extend(s:lines, ["</font></body></html>"])
67    else
68 -    call extend(s:lines, ["</body>", "</html>"])
69 +    call extend(s:lines, ["</body></html>"])
70    endif
71  else
72 -  call extend(s:lines, ["</pre>", "</body>", "</html>"])
73 +  call extend(s:lines, ["</pre></body></html>"])
74  endif
75  
76  exe s:newwin . "wincmd w"
77 @@ -979,7 +989,7 @@
78    if s:settings.no_pre
79      execute "normal! A\nbody { color: " . s:fgc . "; background-color: " . s:bgc . "; font-family: ". s:htmlfont ."; }\e"
80    else
81 -    execute "normal! A\npre { font-family: ". s:htmlfont ."; color: " . s:fgc . "; background-color: " . s:bgc . "; }\e"
82 +    execute "normal! A\npre { " . s:whitespace . "font-family: ". s:htmlfont ."; color: " . s:fgc . "; background-color: " . s:bgc . "; }\e"
83      yank
84      put
85      execute "normal! ^cwbody\e"
86 @@ -1077,8 +1087,8 @@
87  exec 'resize' s:old_winheight
88  let &l:winfixheight = s:old_winfixheight
89  
90 -call setwinvar(s:orgwin,'&stl', s:origwin_stl)
91 -call setwinvar(s:newwin,'&stl', s:newwin_stl)
92 +"call setwinvar(s:orgwin,'&stl', s:origwin_stl)
93 +"call setwinvar(s:newwin,'&stl', s:newwin_stl)
94  let &ls=s:ls
95  
96  " Save a little bit of memory (worth doing?)