On Sat, May 20, 2006 at 12:09:20AM EDT, Hari Krishna Dara wrote:
> 
[..]
> 
> If you have links installed, you can do this easily with the -dump
> option. Here is a quick idea:
> 
> function! HtmlToTxt()
>     write
>     let filename = expand('%')
>     pedit %.txt
>     wincmd p
>     setl bufhidden=delete
>     exec 'silent! 1,$!links -dump '.filename
>     setl nomodified
>     wincmd p
> endfunc
> nnoremap <silent> <F12> :call HtmlToTxt()<CR>
> 
> E.g., if you have the following in a file:
> 
> <html>
> <table border="1">
>   <tr>
>     <th>Number</th><th>Description</th>
>   </tr>
>   <tr>
>     <td>1</td><td>One</td>
>   </tr>
>   <tr>
>     <td>2</td><td>Two</td>
>   </tr>
>   <tr>
>     <td>3</td><td>Three</td>
>   </tr>
> </table>
> </html>
> 
> and press <F12>, you get the below in the preview window:
> 
>    +----------------------+
>    | Number | Description |
>    |--------+-------------|
>    | 1      | One         |
>    |--------+-------------|
>    | 2      | Two         |
>    |--------+-------------|
>    | 3      | Three       |
>    +----------------------+
> 
> To make your HTML table editing easier, you can have macros to insert new
> rows and columns.
> 
Thanks, Hari,

This is very nice indeed. Took me about two minutes to set it up and run
the test and would appear to meet my requirements: I can get the
text-only rendering - without box characters - for a quick preview in
vim via a simple keyboard action and I could likely set up some other
macro/function that would launch Elinks or a graphical web browser for
different levels of rendering of my documents.

I need to dig into vim's function capabilities, see if I can have the
preview window full screen-height - or use normal vertical split instead
of the preview window - so I can have the html source and the basic
text-mode rendering thereof side-by-side.

The dilemma of course is choosing which markup language I should choose
(html, groff, latex, ..). I'm sure I could start one of those
never-ending threads if I asked something quite vague such as "which
markup language is the best choice for the documenting dilettante".. or
something to that effect. :-)

Personally the main issue I have with html is that I find its syntax
rather illegible and quite difficult to type. But I'm sure there must be
quite a collection of vim tools to help your enter all these tags
rapidly.

Thank you very much.

cga

> -- 
> HTH,
> Hari
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

Reply via email to