Markus Heidelberg, 18.07.2008:
> 
> So how can we bypass this? Splitting s:HtmlFormat() in two functions, one for
> conversion of the HTML characters, the other for generation of the HTML tags?
> Then we could probably add s:LeadingSpace between these two function calls.

What about this?


*** 2html.vim.orig      2008-07-17 23:36:24.000000000 +0200
--- 2html.vim   2008-07-18 01:10:23.000000000 +0200
***************
*** 102,110 ****
    endfun
  endif
  
! " Return HTML valid characters enclosed in a span of class style_name with
! " unprintable characters expanded and double spaces replaced as necessary.
! function! s:HtmlFormat(text, style_name)
    " Replace unprintable characters
    let formatted = strtrans(a:text)
  
--- 102,108 ----
    endfun
  endif
  
! function! s:HtmlFormatReserved(text)
    " Replace unprintable characters
    let formatted = strtrans(a:text)
  
***************
*** 117,122 ****
--- 115,127 ----
      let formatted = substitute(formatted, '^ ', s:HtmlSpace, 'g')
    endif
  
+   return formatted
+ endfun
+ 
+ function! s:HtmlFormatTags(text, style_name)
+   " Replace unprintable characters
+   let formatted = strtrans(a:text)
+ 
    " Enclose in a span of class style_name
    let formatted = '<span class="' . a:style_name . '">' . formatted . 
'</span>'
  
***************
*** 129,134 ****
--- 134,145 ----
    return formatted
  endfun
  
+ " Return HTML valid characters enclosed in a span of class style_name with
+ " unprintable characters expanded and double spaces replaced as necessary.
+ function! s:HtmlFormat(text, style_name)
+   return s:HtmlFormatTags(s:HtmlFormatReserved(a:text), a:style_name)
+ endfun
+ 
  " Return CSS style describing given highlight id (can be empty)
  function! s:CSS1(id)
    let a = ""
***************
*** 303,314 ****
    if s:filler > 0
      let s:n = s:filler
      while s:n > 0
!       if s:numblines
!       " Indent if line numbering is on
!       let s:new = repeat(s:LeadingSpace, strlen(s:end) + 1) . 
repeat(s:difffillchar, 3)
!       else
!       let s:new = repeat(s:difffillchar, 3)
!       endif
  
        if s:n > 2 && s:n < s:filler && !exists("html_whole_filler")
        let s:new = s:new . " " . s:filler . " inserted lines "
--- 314,320 ----
    if s:filler > 0
      let s:n = s:filler
      while s:n > 0
!       let s:new = repeat(s:difffillchar, 3)
  
        if s:n > 2 && s:n < s:filler && !exists("html_whole_filler")
        let s:new = s:new . " " . s:filler . " inserted lines "
***************
*** 320,326 ****
        let s:new = s:new . repeat(s:difffillchar, &columns - strlen(s:new))
        endif
  
!       let s:new = s:HtmlFormat(s:new, "DiffDelete")
        exe s:newwin . "wincmd w"
        exe "normal! a" . s:new . s:HtmlEndline . "\n\e"
        exe s:orgwin . "wincmd w"
--- 326,339 ----
        let s:new = s:new . repeat(s:difffillchar, &columns - strlen(s:new))
        endif
  
!       let s:new = s:HtmlFormatReserved(s:new)
! 
!       if s:numblines
!       " Indent if line numbering is on
!       let s:new = repeat(s:LeadingSpace, strlen(s:end) + 1) . s:new
!       endif
! 
!       let s:new = s:HtmlFormatTags(s:new, "DiffDelete")
        exe s:newwin . "wincmd w"
        exe "normal! a" . s:new . s:HtmlEndline . "\n\e"
        exe s:orgwin . "wincmd w"


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui