Re: Paste as HTML

2006-10-21 Thread Mathias Michaelis
>>> What is the added value of marking
>>> it as HTML on the clipboard?
>>> 
>> The added value is that you are able to paste the text into a word
>> processing program like AbiWord, MS Word or StarWriter in a way that
>> the HTML-Tags are not shown, but are interpreted by the word
>> processing program in order to format the text as it would be
>> formatted in a HTML browser.
>> 
>> To achieve this know, I only see one way: Convert your text to HTML,
>> then save it as HTML, open it with a web browser, copy it from here
>> into the clipboard and paste it into a word processing program.
> 
> Why don't these programs offer the option "paste as HTML"?  I mean, the
> user must have a choice if he wants the HTML as text or the resulting
> markup.
> 
The windows clipboard can contain one and the same data item several
time, each time in a different format. If I for instance copy from
an HTML browser, the data is contained there in HTML as well as in
plain text format.

I assume word processing programs offer only the format option they
can find within the clipboard and they can handle with. When Vim
copies text into the clipboard, it declares this text as plain text,
never as HTML. This is why word processing programs interpret this
text as plain text and don't offer the same options as for HTML --
even if the text _is_ HTML.

IMHO this is ok: In order to tell to a target application what it
can do with the data contained in the clipboard, declare its format
and don't assume that the user can do this. Of course I have no
doubt that there are only intelligent Vim users. But the world of
word processing program is another one ;-)

With best regards

Mathias Michaelis


Re: Paste as HTML

2006-10-21 Thread Igor Dvorkin

The end user copies colored formatted text, and when they paste  the
formatting is preserved. The end user is not aware that HTML was
involved in the operation.

A confusing point is clients of the HTML clipboard format (CF_HTML)
consider this type to be text+formatting for display, not a transport
for HTML. If you want to pass an HTML snippet between applications,
you'd use CF_TEXT.

As per peoples suggestion I'm looking at a a solution that does:

 ToHTML()
 w!
 !copy_to_clipboard_as_html %
 q

Finally,  Is the policy if you find functions in tree with mixed tab
space usage to ignore it?

On 10/21/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:


Why don't these programs offer the option "paste as HTML"?  I mean, the
user must have a choice if he wants the HTML as text or the resulting
markup.


Re: Paste as HTML

2006-10-21 Thread Mathias Michaelis
Hello Tony

>> To achieve this know, I only see one way: Convert your text to HTML,
>> then save it as HTML, open it with a web browser, copy it from here
>> into the clipboard and paste it into a word processing program.
>> 
> What about opening the HTML file directly as RTF in a word processor?
>
I guess the original poster wants to insert code snippets into an
already existing documentation.

Regards

Mathias


Re: Paste as HTML

2006-10-21 Thread Bram Moolenaar

Mathias Michaelis wrote:

> > What is the added value of marking
> > it as HTML on the clipboard?
> > 
> The added value is that you are able to paste the text into a word
> processing program like AbiWord, MS Word or StarWriter in a way that
> the HTML-Tags are not shown, but are interpreted by the word
> processing program in order to format the text as it would be
> formatted in a HTML browser.
> 
> To achieve this know, I only see one way: Convert your text to HTML,
> then save it as HTML, open it with a web browser, copy it from here
> into the clipboard and paste it into a word processing program.

Why don't these programs offer the option "paste as HTML"?  I mean, the
user must have a choice if he wants the HTML as text or the resulting
markup.

-- 
>From "know your smileys":
 :}  You lie like Pinocchio

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Paste as HTML

2006-10-21 Thread A.J.Mechelynck

Mathias Michaelis wrote:

Hello *


What is the added value of marking
it as HTML on the clipboard?


The added value is that you are able to paste the text into a word
processing program like AbiWord, MS Word or StarWriter in a way that
the HTML-Tags are not shown, but are interpreted by the word
processing program in order to format the text as it would be
formatted in a HTML browser.

To achieve this know, I only see one way: Convert your text to HTML,
then save it as HTML, open it with a web browser, copy it from here
into the clipboard and paste it into a word processing program.

With best regards

Mathias



What about opening the HTML file directly as RTF in a word processor?


Best regards,
Tony.


Re: Paste as HTML

2006-10-21 Thread Mathias Michaelis
Hello *

> What is the added value of marking
> it as HTML on the clipboard?
> 
The added value is that you are able to paste the text into a word
processing program like AbiWord, MS Word or StarWriter in a way that
the HTML-Tags are not shown, but are interpreted by the word
processing program in order to format the text as it would be
formatted in a HTML browser.

To achieve this know, I only see one way: Convert your text to HTML,
then save it as HTML, open it with a web browser, copy it from here
into the clipboard and paste it into a word processing program.

With best regards

Mathias


Re: Paste as HTML

2006-10-21 Thread Bram Moolenaar

Igor Dvorkin wrote:

> Many windows apps support a clipboard pasting format of HTML. This is
> how you can copy code in Visual Studio 2005 and paste it into outlook
> and see syntax highlighting.
> 
> I recommend something similar be done for VIM. Today, we have toHTML,
> that's reasonable, but ideally we'd able to yank as HTML. I've created
> a patch that can yank HTML to the clipboard as type HTML. I don't
> think this patch should be submitted, instead used by the person
> considering this feature request.
> 
> 
> Ideally this patch will be extended to allow the user to decide to :
> 
> a) yank text , convert it to HTML, and have show up as type HTML.
> b) yank HTML, and have it have it show up as type HTML
> c) yank text, and have it show up as HTML
> 
> My patch only implements 'b'
> 
> Thoughts?

Your patch appears to mostly change indent...

With a simple script you can invoke 2html.vim on highlighted text and
yank the result into the clipboard.  What is the added value of marking
it as HTML on the clipboard?

-- 
hundred-and-one symptoms of being an internet addict:
86. E-mail Deficiency Depression (EDD) forces you to e-mail yourself.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Paste as HTML

2006-10-21 Thread Edward L. Fox

On 10/21/06, Ilya Bobir <[EMAIL PROTECTED]> wrote:

Edward L. Fox wrote:
> In my opinion, this kind of work shouldn't be done by hacking the
> source code of VIM. You can use a vim script to call the synax
> highlighting engine to convert the text into HTML code, and copy the
> converted code into the clipboard with a DLL add-on (as we know, GVim
> supports 'libcall' well).
Maybe copying into the clipboard can be done without a DLL add-on?  By
using "+ register.


I don't think so. "+ register cannot set the clipboard data type, so
the text in the clipboard won't be recognized as HTML but pure text.





Re: Paste as HTML

2006-10-21 Thread Ilya Bobir

Edward L. Fox wrote:

In my opinion, this kind of work shouldn't be done by hacking the
source code of VIM. You can use a vim script to call the synax
highlighting engine to convert the text into HTML code, and copy the
converted code into the clipboard with a DLL add-on (as we know, GVim
supports 'libcall' well).
Maybe copying into the clipboard can be done without a DLL add-on?  By 
using "+ register.


Re: Paste as HTML

2006-10-20 Thread Edward L. Fox

On 10/21/06, Igor Dvorkin <[EMAIL PROTECTED]> wrote:

Many windows apps support a clipboard pasting format of HTML. This is
how you can copy code in Visual Studio 2005 and paste it into outlook
and see syntax highlighting.

I recommend something similar be done for VIM. Today, we have toHTML,
that's reasonable, but ideally we'd able to yank as HTML. I've created
a patch that can yank HTML to the clipboard as type HTML. I don't
think this patch should be submitted, instead used by the person
considering this feature request.


In my opinion, this kind of work shouldn't be done by hacking the
source code of VIM. You can use a vim script to call the synax
highlighting engine to convert the text into HTML code, and copy the
converted code into the clipboard with a DLL add-on (as we know, GVim
supports 'libcall' well).




Ideally this patch will be extended to allow the user to decide to :

a) yank text , convert it to HTML, and have show up as type HTML.
b) yank HTML, and have it have it show up as type HTML
c) yank text, and have it show up as HTML

My patch only implements 'b'

Thoughts?





Regards,


Edward L. Fox


Re: Paste as HTML

2006-10-20 Thread A.J.Mechelynck

Igor Dvorkin wrote:

Many windows apps support a clipboard pasting format of HTML. This is
how you can copy code in Visual Studio 2005 and paste it into outlook
and see syntax highlighting.

I recommend something similar be done for VIM. Today, we have toHTML,
that's reasonable, but ideally we'd able to yank as HTML. I've created
a patch that can yank HTML to the clipboard as type HTML. I don't
think this patch should be submitted, instead used by the person
considering this feature request.


Ideally this patch will be extended to allow the user to decide to :

a) yank text , convert it to HTML, and have show up as type HTML.
b) yank HTML, and have it have it show up as type HTML
c) yank text, and have it show up as HTML

My patch only implements 'b'

Thoughts?


My thoughts:

- Vim is a text editor, not a WYSIWYG word processor
- Vim is multi-platform
- ":TOhtml" already works on ranges. IMHO it can be use with no source hacking 
to do all three of your alternatives, by yanking its output.

- Your patch has mixed CR+LF and LF-only ends-of-lines.
- I don't see why you converted so many tabs to spaces; it just makes the 
patch bulkier.



Best regards,
Tony.


Paste as HTML

2006-10-20 Thread Igor Dvorkin

Many windows apps support a clipboard pasting format of HTML. This is
how you can copy code in Visual Studio 2005 and paste it into outlook
and see syntax highlighting.

I recommend something similar be done for VIM. Today, we have toHTML,
that's reasonable, but ideally we'd able to yank as HTML. I've created
a patch that can yank HTML to the clipboard as type HTML. I don't
think this patch should be submitted, instead used by the person
considering this feature request.


Ideally this patch will be extended to allow the user to decide to :

a) yank text , convert it to HTML, and have show up as type HTML.
b) yank HTML, and have it have it show up as type HTML
c) yank text, and have it show up as HTML

My patch only implements 'b'

Thoughts?


paste_html_to_clipboard_win32.diff
Description: Binary data