Less optimal HTML output?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Less optimal HTML output?

Yongwei Wu
I noticed something weird recently in the VIM HTML output (CSS on). It
is probably there for quite some time now, but I checked the HTML
source only recently.

* { font-size: 1em; } (in CSS)

I do not see the point of this. It does not seem to affect the result
in Chrome, but it makes the font larger in IE than without it.

<script type='text/javascript'>
<!--

-->
</script>

Apparently it does nothing, but it triggers the IE warning: "Internet
Explorer restricted this web page from running scripts or ActiveX
controls."

Can it be regarded as bugs? Or is there a way to tune the output to
get rid of them?

(Now I have to remove them manually from the HTML.)

Best regards,

Yongwei

--
Wu Yongwei
URL: http://wyw.dcweb.cn/

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Less optimal HTML output?

Benjamin Fritz
On Tuesday, April 12, 2016 at 8:44:00 AM UTC-5, Yongwei Wu wrote:
> I noticed something weird recently in the VIM HTML output (CSS on). It
> is probably there for quite some time now, but I checked the HTML
> source only recently.
>
> * { font-size: 1em; } (in CSS)
>
> I do not see the point of this. It does not seem to affect the result
> in Chrome, but it makes the font larger in IE than without it.
>

From 2html.vim:

  " fix browser inconsistencies (sometimes within the same browser) of different
  " default font size for different elements
  call append('.', '* { font-size: 1em; }')

I'm not sure exactly what that means or when it was introduced, but I can look into it. Perhaps there is a better way to accomplish this.

I can confirm that the font gets bigger in IE with that in (actually it makes it match Firefox and Chrome fairly closely). This is weird; in a monospace font 1em should already be the width of a character. Setting it to 100% or 1rem instead of 1em seems to do the same thing. Ugh...IE.

Why is the larger text a problem? I figured consistency across browsers would be a good thing, not a bad one...

> <script type='text/javascript'>
> <!--
>
> -->
> </script>
>
> Apparently it does nothing, but it triggers the IE warning: "Internet
> Explorer restricted this web page from running scripts or ActiveX
> controls."
>
It's a bug that an empty script tag is generated; apparently you don't have any options enabled that use javascript (dynamic folds, uncopyable regions, jumping to specific lines). Previously the line-jumping script was always added, now it has an option to remove it. Now that the option is there, the <script> tag should also be removed if there will be no content. I just created an issue for this:

https://bitbucket.org/fritzophrenic/vim-tohtml/issues/6/empty-script-tag-should-not-be-generated

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Less optimal HTML output?

Yongwei Wu
On 13 April 2016 at 00:04, Ben Fritz <[hidden email]> wrote:

> On Tuesday, April 12, 2016 at 8:44:00 AM UTC-5, Yongwei Wu wrote:
>> I noticed something weird recently in the VIM HTML output (CSS on). It
>> is probably there for quite some time now, but I checked the HTML
>> source only recently.
>>
>> * { font-size: 1em; } (in CSS)
>>
>> I do not see the point of this. It does not seem to affect the result
>> in Chrome, but it makes the font larger in IE than without it.
>>
>
> From 2html.vim:
>
>   " fix browser inconsistencies (sometimes within the same browser) of different
>   " default font size for different elements
>   call append('.', '* { font-size: 1em; }')
>
> I'm not sure exactly what that means or when it was introduced, but I can look into it. Perhaps there is a better way to accomplish this.
>
> I can confirm that the font gets bigger in IE with that in (actually it makes it match Firefox and Chrome fairly closely). This is weird; in a monospace font 1em should already be the width of a character. Setting it to 100% or 1rem instead of 1em seems to do the same thing. Ugh...IE.
>
> Why is the larger text a problem? I figured consistency across browsers would be a good thing, not a bad one...

I think this is dependent on the browser configuration. In my case,
the IE font size with 1 em is apparent bigger than other cases. In
other browsers (with or without 1 em) or IE without 1 em, I get the
standard 10 pt (13 px) Courier New as output.

I guess the reason is that the standard CSS in IE has 10 pt Courier
New for <pre>, and 12 pt ... for <body>. "font-size: 1em" makes <pre>
use 12 pt as well. For some reasons Chrome is not affected by
"font-size: 1em": I verified that it thinks the font-size is still 13
px, the default setting.

Best regards,

Yongwei

--
Wu Yongwei
URL: http://wyw.dcweb.cn/

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Less optimal HTML output?

Benjamin Fritz

On Tue, Apr 12, 2016 at 9:12 PM, Yongwei Wu <[hidden email]> wrote:

>
> I think this is dependent on the browser configuration. In my case,
> the IE font size with 1 em is apparent bigger than other cases. In
> other browsers (with or without 1 em) or IE without 1 em, I get the
> standard 10 pt (13 px) Courier New as output.
>
> I guess the reason is that the standard CSS in IE has 10 pt Courier
> New for <pre>, and 12 pt ... for <body>. "font-size: 1em" makes <pre>
> use 12 pt as well. For some reasons Chrome is not affected by
> "font-size: 1em": I verified that it thinks the font-size is still 13
> px, the default setting.

A feature I was thinking about was to auto-detect font name and font size, and apply that.

This would apply the same font size from Vim to the document instead of "1em". And obviously, a manual setting would go along with that.

Not sure if this would solve your problem as well or if you want the line gone entirely.

Probably the targeting could be more precise.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Less optimal HTML output?

Yongwei Wu
On 13 April 2016 at 13:24, Benjamin Fritz <[hidden email]> wrote:

>
> On Tue, Apr 12, 2016 at 9:12 PM, Yongwei Wu <[hidden email]> wrote:
>>
>> I think this is dependent on the browser configuration. In my case,
>> the IE font size with 1 em is apparent bigger than other cases. In
>> other browsers (with or without 1 em) or IE without 1 em, I get the
>> standard 10 pt (13 px) Courier New as output.
>>
>> I guess the reason is that the standard CSS in IE has 10 pt Courier
>> New for <pre>, and 12 pt ... for <body>. "font-size: 1em" makes <pre>
>> use 12 pt as well. For some reasons Chrome is not affected by
>> "font-size: 1em": I verified that it thinks the font-size is still 13
>> px, the default setting.
>
> A feature I was thinking about was to auto-detect font name and font size,
> and apply that.
>
> This would apply the same font size from Vim to the document instead of
> "1em". And obviously, a manual setting would go along with that.
>
> Not sure if this would solve your problem as well or if you want the line
> gone entirely.
>
> Probably the targeting could be more precise.

Unless we can find a reason when "* { font-size: 1em; }" is useful,
the simple solution seem just to remove this line. That was the way
Vim used to be.

Can we find out when and why it was introduced?

--
Wu Yongwei
URL: http://wyw.dcweb.cn/

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.