Friday, May 11, 2012

Re: TOhtml - select without linenr

On Thu, 10 May 2012 20:30:21 -0700 (PDT)
Ben Fritz <fritzophrenic@gmail.com> wrote:

>On Thursday, May 10, 2012 5:24:29 PM UTC-5, Tarlika Elisabeth Schmitz
>wrote:
>> I just started looking into converting syntax highlighted code to
>> HTML (to be embedded on a web page).
>>
>> Great feature! The only fly in the ointment is the fact that line
>> numbers are selectable.
>Your test page renders fine in each browser (with some 1px issues
>which I can ignore)

Where the hell did they appear?!

>The only thing that doesn't seem to
>work, is that the text is for some reason pasted into MS Word
>unformatted from Opera and Firefox.

I am surprised! I never thought you could paste a formatted web page
into LibreOffice.
I tried this with Chrome (to LibreOffice) using YOUR TOhtml page -
result formatted exactly as on web page incl. bg.
It did not work with FF 9 (neither your nor my vim output). Correct
font but no colours, neither fg nor bg.

>> The output is placed in a <table>, and the line numbers are in a
>> separate <td>. Consequently, it is possible to select the output code
>> without grabbing line numbers.
>>
>
>Did you just hand-code this

yes

>Dynamic folding [...]

Could you attach an example?
I don't use folding, not even in vim. Maybe I get an idea if I see the
HTML output in action.

>wrapping may be turned on.

That's clever! Didn't realize TOhtml reacted to the current wrapping.

I can think of two code prettifier which deal with wrapping using a
horizontal scrollbar. Always annoying, I know.
TOhtml with wrap wraps through the linenr coloumn though. Not 100%
ideal either.

>> Although not essential in this set-up, it is possible to
>> make the line numbers unselectable just using CSS.
>
>As stated, however, the primary goal is making the region uncopyable. I
>don't care too much about selectability.

As long as the copied/pasted code is ready to use (without linenr),
that's objective achieved for me.

>Are you saying IE10 supports user-select?

I read that somewhere, can't find it now. (-ms-user-select)

> Anyway, I want to avoid non-standard
>markup where possible, and "unselectable" is certainly that.

I'm afraid catering for x different browsers times y versions is a
dirty business. It may offend your sense of tidiness but if it works
I'd go for it.

I am always keen to find a soution that still works ok without
javascript. My default is no JS (I use NoScript).

>> I made a point of keeping the CSS classes that reflext the vim colour
>> scheme (lnr, Identifier,...) separate
>
>Good call. Next on the list is external stylesheets, for which there's
>another patch out on vim_dev somewhere I think.

As each TOhtml output only includes the styles used, I thought this is
essential. This way one can build up an external style sheet by adding
to it. (I am thinking of a separate style sheet for embedded "pretty
printed" code.)

>The other idea I had, is abandoning the idea of getting it working on
>IE8

Not sure how many peole use which browesers. Haven't seen any stats
recently.

> using inline SVG to create an image that had the line number
>text.

intersting but discounts loads of old browsers.


Anyway, there's scope for improvement but it is a pretty cool vim
feature as it is already!

--

Tarlika Elisabeth Schmitz, Scotland

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: