Convert spaces to   quickly

1,036 views
Skip to first unread message

srmaximo

unread,
Mar 31, 2010, 3:05:58 PM3/31/10
to BBEdit Talk
Hello,

I'm creating a page of guitar strumming patterns on my site, and the
format I use often requires more than one space between characters.
So far, I've been accomplishing this by copy/pasting the space entity.

This is slow and repetitive work, though. It would speed things up if
I could just copy the strum pattern in my browser (they're in other
locations on my site), paste them into the html file in BBEdit,
highlight it, and then tell BBEdit to convert the spaces to the
entity.

I tried a program called SmartyPants, but it only converts dashes and
smartquotes.

Thank for your help,

Rob

G. T. Stresen-Reuter

unread,
Mar 31, 2010, 4:45:55 PM3/31/10
to bbe...@googlegroups.com
On Mar 31, 2010, at 8:05 PM, srmaximo wrote:

> Hello,
>
> I'm creating a page of guitar strumming patterns on my site, and the
> format I use often requires more than one space between characters.
> So far, I've been accomplishing this by copy/pasting the space entity.

Although your description is fairly clear, we'd probably all be able to guide you better if you could provide samples of what you are starting with (the HTML) and how you want it to end up. I suspect more than one person could suggest using the PRE element if you want to preserve spacing exactly as it currently exists.

> This is slow and repetitive work, though. It would speed things up if
> I could just copy the strum pattern in my browser (they're in other
> locations on my site), paste them into the html file in BBEdit,
> highlight it, and then tell BBEdit to convert the spaces to the
> entity.

Have you tried Find and Replace (and selecting the "Selected text only" checkbox)? Simply enter a space in the search field and in the replace field enter   and then click the "Replace All" button.

I hope that helps.

Ted

srmaximo

unread,
Mar 31, 2010, 4:58:12 PM3/31/10
to BBEdit Talk
Thanks for your reply, Ted. Here's an example of a page that has an
existing strum pattern:
http://www.heartwoodguitar.com/Guitar%20Music%20for%20Web/Cash,%20Johnny%20-%20Folsom%20Prison%20Blues.htm

And though the current page I'm working on isn't live, it looks
something like this:
http://www.heartwoodguitar.com/strum-patterns.php

My goal is to copy and paste the strumming patterns from song pages
into the a table with as little work as possible.

Using the PRE element would probably work, except that I've already
spent about 20 hours on the project and changing my approach now may
not be worth it. Isn't there a way to convert spaces to  
quickly?

Find and replace works pretty well--just a hassle to reconfigure it
after I've used it to do something else.

Thank you!

Rob

Bill Hernandez

unread,
Mar 31, 2010, 5:46:55 PM3/31/10
to bbe...@googlegroups.com
On Mar 31, 2010, at 3:58 PM, srmaximo wrote:

bbedit_grep.png

Bill Hernandez

unread,
Mar 31, 2010, 5:51:05 PM3/31/10
to bbe...@googlegroups.com
On Mar 31, 2010, at 3:58 PM, srmaximo wrote:

forgot, if you have tabs

Search : \t
Replace : \ \ \ \ 

Bill Hernandez
Plano, Texas

G. T. Stresen-Reuter

unread,
Mar 31, 2010, 6:35:28 PM3/31/10
to bbe...@googlegroups.com
On Mar 31, 2010, at 9:58 PM, srmaximo wrote:

> Find and replace works pretty well--just a hassle to reconfigure it
> after I've used it to do something else.

With recent versions of BBEdit, you can save Find and Replace combinations which then allows you to select them (the combination) from a menu to populate the corresponding fields with one click (sort of), or with a little AppleScript you could write a command that could be called by a keyboard combination that applies the Find and Replace on the current selection. Check the documentation on how to do all of this for your version as the exact method varies between versions.

Ted

Bucky Junior

unread,
Mar 31, 2010, 10:19:11 PM3/31/10
to bbe...@googlegroups.com

On Mar 31, 2010, at 2:58 PM, srmaximo wrote:
>
> Using the PRE element would probably work, except that I've already
> spent about 20 hours on the project and changing my approach now may
> not be worth it. Isn't there a way to convert spaces to  
> quickly?


Even though it would change your work flow and change your approach,
your really might be happier in the long run using the PRE element for
your formatting. If you ever (when you ever) want to go back and edit
the space-based formating, it will be much easier with mono-spaced PRE
formatting than with six character   formatted spaces.

Just my opinion though.


Roland Küffner

unread,
Apr 1, 2010, 2:17:01 AM4/1/10
to bbe...@googlegroups.com
Another approach:

You could use Apple's Automator to create a shortcut. BBEdit has some nice components that you can use from inside Automator.

If you choose to create a workflow "as service" (Snow Leopard required) you will get a menu Item meaning you can select text in your browser, right click and choose your workflow from the Service submenu in the context menu.

I did not test it but it should work some way like this:

1: Open Automator and create a new workflow as service
2: Add the BBEdit action "Search and Replace" and populate it with the patterns provided by others in this thread
3: Add the "Copy to clipboard" action

You can now copy text in your browser, choose this workflow from the context menu and the replaced text will be waiting when you arrive in BBEdit. You could even economize one step more if you dare using the BBEdit action "Set Contents of BBEdit Document" on step 3 (but have an eye on the settings).

Regards
Roland

> --
> You received this message because you are subscribed to the
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to bbe...@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/bbedit?hl=en
> If you have a feature request or would like to report a problem,
> please email "sup...@barebones.com" rather than posting to the group.
>
> To unsubscribe, reply using "remove me" as the subject.

Greg Shenaut

unread,
Apr 1, 2010, 12:09:56 PM4/1/10
to bbe...@googlegroups.com
If your file format supports it, I'd suggest using "no-break space" (Option-space) where you want the  's to go (that way, you can mix regular spaces and non-breaking spaces). If you do that, then I've found that most text and HTML browsers will read and render them exactly as if you'd typed   (it will help if you explicitly declare the character encoding in the HTML header). BBEdit will display these characters as a bullet instead of a space if you enable View>Text Display>Show invisibles. And of course if you want to change them explicitly, you can "replace all" no-break space chars with   in BBEdit.

Greg Shenaut

Reply all
Reply to author
Forward
0 new messages