Stick a <div> inside the <body>

The point is to fix #16.

Broadly, the correct solution is "stick a `<div>` inside the body with the foreground/background from the `Normal` highlight group".

How to find out those colors?  Well, `2html.vim` has a lot of logic to figure out what they are; it makes sense to just re-use that logic if we can.  If `g:html_use_css == 0` (which we force to be true), then those colours occur in the `<body>` attribute.  So we can solve this problem by just copying the `<body>` to a `<div>` and keeping the same attributes, right?

Well... almost.  It turns out, Gmail disregards the deprecated `bgcolor=` and `text=` attributes.  So we have to do a _little_ more legwork to turn them into a `style` attribute.  But overall, this isn't too bad.
Don't clobber the '/' register.

On Fri, Dec 5, 2014, 16:32 Bob <notifications@github.com> wrote:

> In autoload/syncopate.vim:
>
> > +  put =substitute(getline('.'), a:pattern, a:replacement, '')
> > +  -
> > +  silent! delete _
> > +endfunction
> > +
> > +
> > +" Put a <div> inside the <body>, with the bgcolor and text attributes (if any)
> > +" turned into a style attribute.
> > +"
> > +" This is intended to piggyback on 2html.vim's guesses for foreground and
> > +" background colours.
> > +function! s:PutDivInBody()
> > +  " Find the <body>-line, and follow it up with a similar <div>-line.
> > +  1
> > +  call search('<body')
> > +  put =substitute(getline('.'), 'body', 'div', '')
>
> Oh, right I misread the function. Ok next question, why put a modified
> line and delete the old one instead of using :s ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/google/vim-syncopate/pull/18/files#r21401809>.
>