Giter VIP home page Giter VIP logo

Comments (7)

dbarnett avatar dbarnett commented on September 1, 2024

Can you give examples of the working HTML via the browser vs. the non-working HTML from vim? Check xclip -selection clipboard -o -t text/html in both cases.

from vim-syncopate.

chiphogg avatar chiphogg commented on September 1, 2024

Sure. The differences are stark. For one, the (working) HTML via the browser is 10x as big.

Working HTML via the browser:

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>function</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"></span>
<font color="#98fb98" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">WifiSsid</font>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">()</font>
<br style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);">  </span>
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>let</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#98fb98" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">l:cmd</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>=</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#ffa0a0" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">"nm-tool |grep --only-matching '*[^ ][^:]*' |sed 's/^*//'"</font>
<br style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);">  </span>
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>return</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> maktaba#string#</span>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<font color="#ffffff">Strip</font>
</span>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">(</font>
<font color="#98fb98" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">system</font>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">(</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);">l:cmd</span>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">))</font>
<br style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>endfunction</b>
</font>

I had to introduce some manual breaking for readability.

Non-working HTML via clipboard:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/.vimrc_local.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="vim">
<meta name="settings" content="ignore_folding,no_pre,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="desert">

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

-->
</script>
</head>
<body bgcolor="#333333" text="#ffffff">
<font face="monospace">
<font color="#f0e68c"><b>function</b></font>!&nbsp;<font color="#98fb98">WifiSsid</font><font color="#ffdead">()</font><br>
&nbsp;&nbsp;<font color="#f0e68c"><b>let</b></font>&nbsp;<font color="#98fb98">l:cmd</font>&nbsp;<font color="#f0e68c"><b>=</b></font>&nbsp;<font color="#ffa0a0">&quot;nm-tool |grep --only-matching '*[^ ][^:]*' |sed 's/^*//'&quot;</font><br>
&nbsp;&nbsp;<font color="#f0e68c"><b>return</b></font>&nbsp;maktaba#string#<span style="background-color: #333333"><font color="#ffffff">Strip</font></span><font color="#ffdead">(</font><font color="#98fb98">system</font><font color="#ffdead">(</font>l:cmd<font color="#ffdead">))</font><br>
<font color="#f0e68c"><b>endfunction</b></font><br>
</font>
</body>
</html>
<!-- vim: set foldmethod=manual : -->

from vim-syncopate.

chiphogg avatar chiphogg commented on September 1, 2024

By the way: if you take the "non-working" HTML, and:

  1. Strip everything up to the <body>, and after the </body> (inclusive)

  2. Surround it in a suitably styled <div>, e.g.,

    <div style='background-color:#333; color: #fff;'>

Then it looks good in the email client.

from vim-syncopate.

dbarnett avatar dbarnett commented on September 1, 2024

Given many quirks and limitations we've discovered in :TOhtml and the fact that what it's doing doesn't seem that hard, I want to at least propose the possibility of bypassing :TOhtml and just writing our own implementation. It even seems to have a lot of logic devoted to emulating the current vim session (e.g., checking has('gui_running')), which is the opposite of what we want.

That said, I'm not opposed to taking this paradigm as far as we can and trying to post-process it into something sane.

from vim-syncopate.

chiphogg avatar chiphogg commented on September 1, 2024

I've mulled it over. Rolling our own doesn't sound that crazy. There are certainly a lot of benefits.

However, we have to keep in mind that :TOhtml does a lot: line numbers and code folding come to mind. Also, I like the "use built-in :TOhtml options to configure" philosophy; if we roll our own, we either have to jettison that, or else support a lot of obscure features.

I'd definitely consider rolling our own in the future. For now, though, I think we'll get further faster if we just post-process the :TOhtml output.

from vim-syncopate.

dbarnett avatar dbarnett commented on September 1, 2024

Works beautifully for me.

FWIW, it still doesn't look good in Google Docs (the dark background is shrink-wrapped to only span actual text on the line:
image

But it does that when I copy from :SyncopateExportToBrowser and anything else I try, so there may be nothing we can do about that.

from vim-syncopate.

chiphogg avatar chiphogg commented on September 1, 2024

Yeah, I hadn't tested Docs since this last update, but that's what happened for me before.

Oh well -- still a big improvement! I think all these changes are enough to call it 0.2.0 -- about to get a PR ready.

from vim-syncopate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.