monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

commit 3c5b82f3d56a85421b6c851f8ca675f634cc2bf2
parent ab1e254406bc77d9e2694ed92386158bedad4b82
Author: Willy Goiffon <willy@mailoo.org>
Date:   Tue, 29 Oct 2013 09:04:16 +0100

Added function CodeHTML(ft) to convert code snippet to HTML

Diffstat:
tools/blog.vim | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/tools/blog.vim b/tools/blog.vim @@ -19,6 +19,16 @@ fu! EscapeHTML() silent! s/"/\&quot;/g endf +fu! CodeHTML(newft) + let oldft = &ft " remember current filetype + let ft = a:newft " filetype to be used + '<,'>TOhtml " convert the selection to HTML + /^<pre/+1,/^<\/pre>/-1d " get the code in between <pre> tags + bd! " remove the HTML temporary buffer + norm gvp " copy that in place of the old text + let ft = oldft " recall the saved filetype +endf + " love that... ab -- &mdash; ab </ </<C-X><C-o>