This series is written by a representative of the latter group, which is comprised mostly of what might be called "productivity users" (perhaps "tinkerly productivity users?"). Though my lack of training precludes me from writing code or improving anyone else's, I can, nonetheless, try and figure out creative ways of utilizing open source programs. And again, because of my lack of expertise, though I may be capable of deploying open source programs in creative ways, my modest technical acumen hinders me from utilizing those programs in what may be the most optimal ways. The open-source character, then, of this series, consists in my presentation to the community of open source users and programmers of my own crude and halting attempts at accomplishing computing tasks, in the hope that those who are more knowledgeable than me can offer advice, alternatives, and corrections. The desired end result is the discovery, through a communal process, of optimal and/or alternate ways of accomplishing the sorts of tasks that I and other open source productivity users need to perform.

Monday, October 21, 2024

xclip to the rescue? How I wish . . .

I find the blogging platform I've been using for this blog to be horrendous. First, I don't want to have to log into a website to write articles: I'd rather type them on my computer, usually using my favored command-line text editor nano.

I was iniatially enthused to discover that blogspot/blogger (the host for this blog) offered the possibility of e-mailing posts. Esssentially, you add a custom word to an e-mail address they provide, and you can use that to send posts directly to your blog (subject line becomes the blog posting's title). Great, I thought, I can type posts on my computer and send them to my blog.

But my enthusiasm was shortlived. Initial tests indicated that the blogging platform was inserting a bunch of extraneous html tags into postings I'd send like that. No problem, I thought, I'll just write my posts with html, tags pre-inserted. Tests using that method indicated that the platform was continuing to insert those extraneous tags. See the graphic below for an indication of how the file looks in html editing view on blogger's site (all the &gt &lt &#39 and <br> were added by their system, not by me):


So I was left with a dilemma: how can I more conveniently, according to my preferred practices, continue blogging here? Researching the matter revealed the xclip utility, which appeared to be a good workaround for helping deal with the constraints involved in continuing to blog on this platform.

I discovered that, after I save the posting I've written under nano, I can simply cat the file into the system's clipboard by running a command like cat myfile.txt | xclip (see the LATER EDIT note added at the very end of this post for the corrected invocation for the blogger site) and from there paste it into the platform's editor interface by placing my cursor there and clicking the middle mouse button. Granted, it's pretty much the same as using a graphical text editor like leafpad and hitting ctrl-a to highlight the whole of the file, ctrl-c to copy the highlighted text to the clipboard, then ctrl-v after placing the cursor into the platform's editor interface. Not ideal, since I would much prefer if the e-mailing method would work as I had hoped by just importing the text as written in the file, but it's an acceptable (at least for now) workaround.

Perhaps more to come later, if I manage to make improvements or to figure out some heretofore overlooked factor.

Afterthought: I tried to paste this post into the blogger editing interface using xclip and it didn't work. Nothing would paste. So I had to paste the text into leafpad, then do the ctrl-a, ctrl-c, ctrl-v trick to be able to paste it here. So I changed the exclamation sign I had initially placed at the end of the title to a question mark, since it may not provide the solution after all. Sigh.

LATER EDIT: IMPORTANT! I've discovered that the way I can paste text into blogger using xclip is by running it with a couple of switches, as follows: cat myfile.txt | xclip -selection clipboard: having done that, I can then place the cursor in blogger's html editor and hit ctrl-v and the text from the file will paste into the editor as intended.

No comments:

Post a Comment