Need someone to lead product management at your software company? I create software for people that create software and I'm looking for my next opportunity. Check out my resume and get in touch.

This is the blog of Adam Kalsey. Unusual depth and complexity. Rich, full body with a hint of nutty earthiness.

Content Management

Double spaces

Freshness Warning
This blog post is over 21 years old. It's possible that the information you read below isn't current and the links no longer work.

Sounds like a challenge.

Okay, I’ll bite. Download Doublespace, a Movable Type plugin for converting multiple spaces to non-breaking spaces so they’ll display properly in HTML. No real documentation for this one. Just put it in your plugins directory and add double_spaces="1" to your MT tags.

Tim Appnel has taken over the maintenance and support of this plugin as of Oct 2004.

Comments

Adam Kalsey
October 14, 2002 10:15 PM

There was an error in my thinking on this plugin. If an entry had two or more consecutive spaces, all spaces in the entry would be replaced by non-breaking spaces. I've now fixed it so that all instances of two spaces will be replaced by a space followed by a non-breaking space. That should work all the time without inserting unnecessary non-breaking spaces.

Dog Newsie
October 18, 2002 7:26 AM

and the same can be said for Radioland's fabulous Radioland blogging software. In fact, often I have a wish for a feature and before I can even voice my desire, it's implemented. Fixes and new features are release almost every day. Bugs do exist (the ever present paragraph bug), but they are ones that are difficult to fix and we have to be patient, because it takes time to fix them (how much griping would you tolerate if you sold a tool like this for $39. These people are amazingly tolerant of us newbies.) Amazingly, they just keep improving it anyway. Radioland: http://radio.userland.com

*** Dave
October 23, 2002 3:22 PM

Tres cool -- except that a double-space created by the plug-in can be can be broken across lines, so that you can have a spurious space show up on the next line. Not sure how you'd get around that, but it was a nice try.

Adam Kalsey
October 23, 2002 4:03 PM

Well, yes, but that's a limitation of HTML. Multiple instances of whitespace are condensed down to a single instance when the code is rendered. The only way to have two or more spaces in a row is to use a non-breaking space. Add to that the fact that there's no real way to specify the line length (or even to figure out where on the line a character is), and you can see the problem isn't really solvable. If you want perfect control over your typography, you shouldn't be using HTML. Try PDF instead. By the way, I disagree with the two spaces thing. There should be a single space after a period. Period. I just built the plugin because Scott asked.

Paul
March 26, 2003 9:04 PM

Hey there. I was wondering if this plugin can be modified to give me a double return when only one is hit. I am trying to accomplish a first line indent for each paragraph in my entries, but the text that I am posting is all completed with just one carriage return, so MT does nothing with it. Here is my thread on MT's forum: http://www.movabletype.org/cgi-bin/ikonboard/ikonboard.cgi?s=3e825f083052ffff;act=ST;f=14;t=17277 Thanks in advance for any input you can give.

Adam Kalsey
March 27, 2003 11:19 AM

Plugins only work with the data that comes out of MT. There's no way for them to affect the data going into it. If all you want is for 5 spaces to follow every <br> tag, you could modify Double Spaces to do that for you. Just change the line that reads: $string =~ s| | &nbsp;|g; to read $string =~ s|(<br\s+?/?>)|$1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|g; The HTML it generates isn't going to win any awards for semantic markup, but it will display correctly in the browser.

Paul
March 28, 2003 10:03 AM

Hey adam. Thanks a bunch for that. I edited it, and changed the name to DoubleReturn, and left all your information intact. It works just like I wanted it to. Much thanks again!

Trackback from Law Student's Journal
April 7, 2003 2:46 AM

It's not just me!

Excerpt: Seems I'm not the only one griping about not having double spaces between sentences. Thank god someone did something about it... I'm giving it a test run....

Trackback from the golden path
April 23, 2003 8:45 PM

About the site

Excerpt: Philiosophy As a discourse between myself and the wider world, the golden path is an unorganized accumulation of hopes, the embodiment of wish. Design notes can be found in the archives of this site itself, but include: February 12, 2003...

A visitor
August 8, 2003 9:32 AM

The way to fix what Dave is talking about is to have the two spaces converted to a nonbreaking space followed by a regular space. Currently you have them reversed, it seems.

Brad Carps
November 12, 2003 10:12 AM

Adam, I thank you for making such a useful MT plugin. However, I'd like to suggest that you format your double spaces with "&nbsp; " instead of " &nbsp;" because the latter syntax you use seems to put an occasional extra space at the front of some wrapped lines in certain paragraphs. Namely, if a sentence ends right where the line wraps, then the non-breaking space gets added to the following line. I've found that for left-aligned text, if you put the non-breaking space right next to the word, most browsers interpret it as part of the word and as a result, won't add it to the beginning of the next line. $string =~ s|  |&nbsp; |g; Thanks again for the script.

Hal97
December 7, 2003 2:13 AM

What Brad there says is quite useful for left aligned text as he says... however would be problematic for right aligned (it'd end up with basically the same problem we have now, but the superfluous space would be at the end of a sentance). So hows about an attribute saying you want it formatted for right aligned text (with left aligned being default).

This discussion has been closed.

Recently Written

Roadmap Outcomes, not Features (Sep 4)
Drive success by roadmapping the outcomes you'll create instead of the features you'll deliver.
Different roadmaps for different folks (Sep 2)
The key to effective roadmapping? Different views for different needs.
Micromanaging and competence (Jul 2)
Providing feedback or instruction can be seen as micromanagement unless you provide context.
My productivity operating system (Jun 24)
A framework for super-charging productivity on the things that matter.
Great product managers own the outcomes (May 14)
Being a product manager means never having to say, "that's not my job."
Too Big To Fail (Apr 9)
When a company piles resources on a new product idea, it doesn't have room to fail. But failing is an important part of innovation. If you can't let it fail, it can't succeed.
Go small (Apr 4)
The strengths of a large organization are the opposite of what makes innovation work. Starting something new requires that you start with a small team.
Start with a Belief (Apr 1)
You can't use data to build products unless you start with a hypothesis.

Older...

What I'm Reading