Your Ad Here

Double spaces

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.

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.

Lijit Search

Best Of

Recently Read

Get More

Subscribe | Archives

Recently

Sprout Test (May 7)
A test post for Sprout widgets.
Product Leadership (May 3)
An anthology of product leadership writing.
Fighting Monster patent claims (Apr 16)
The patent bully picked on the wrong little guy.
Peavy's pine tar (Apr 6)
Jake Peavy's cheating
Bush and Morgan on inner city baseball (Mar 30)
Morgan and Bush discuss the role of baseball in the inner cities.
Not a fork (Mar 27)
We have no intention of forking Drupal. That would be nuts. So what are we doing then?
Eating our dogfood in the sausage factory (Mar 26)
Recursive development for the new Drupal powered community platform.

Subscribe to this site's feed.

Elsewhere

Feed Crier
Get alerted by IM when your favorite web sites and feeds are updated.
SacStarts
The Sacramento technology startup community.
Pinewood Freak
Pinewood Derby tips and tricks
Del.icio.us
My tagstream at del.icio.us.
Waddlespot
My son's Club Penguin community. News, blogs, tips, and tricks.

Contact

Adam Kalsey

Mobile: 916.600.2497

Email: adam AT kalsey.com

AIM or Skype: akalsey

Resume

PGP Key

©1999-2008 Adam Kalsey.
Content management by Movable Type.