On Tue, Mar 23, 2010 at 02:30, RobS <[email protected]> wrote:
> Doing poetry on-line, I often have to use spans to indent
> lines, and poetry being poetry, there is no predictability to it, so I
> need to manually paste in the span at the start of the line.

How about changing your workflow? Use Clippings or use Applescript to
insert both opening and closing span tags. Or use TextExpander.

1] Clippings
Make a clipping similar to this: <span
class="ind2">#insertion#</span>. Set a keystroke for the clipping to
make it even easier to use. Type the keystroke. <span
class="ind2"></span> is inserted and the cursor is placed inside the
tag, ready for your text.

2] TextExpander
Do much the same with TextExpander: set up the keystroke and text to
insert. Use the new ummm text box feature. When you type the keystroke
a dialog box appears. Enter your indented line of poetry in the text
box and press Return. The complete span tag and your line of poetry
are inserted and the cursor is placed *after* it ready for your break
tag. I use this a lot for wrapping text in <code> tags.

3] Applescript
I use Applescript all the time for adding tags to text selections when
I work with text others have sent me.

The following script (for italics) can surely be improved by the
experts on this list, but it works for me. I select the script
manually from the menu but you could assign a keystroke. You'd need to
edit it slightly for your span. remove the Say line if you don't like
chatty scripts.

-- This script adds <span></span> tags to selected text.
-- It adds  style="font-style: italic;" to the span.
-- It removes and existing <i></i> tags if they are included in the selection.
-- Use this for italicising text, not for emphasis
-- for example, a book title.
-- A book title *class* would be better....

tell application "BBEdit"
        
        tell text window 1
                
                if selection is "" then
                        
                        say "Oops, you need to select the text."
                        return
                end if
                
                replace "</?i>" using "" searching in selection options {search
mode:grep, starting at top:true, wrap around:false, backwards:false,
case sensitive:false, match words:false, extend selection:false}
                set selection to ¬
                        "<span style=\"font-style: italic;\">" & selection & 
"</span>"
                
        end tell
        
        say "Here's your italic."
        
end tell



Cheers,

Miraz


-- 
Miraz Jordan

MacTip: Log In or Out automatically -
http://mactips.info/2010/03/log-in-or-out-automatically

KnowIT: Remember to check and empty your WordPress spam -
http://knowit.co.nz/2010/03/remember-to-check-and-empty-your-wordpress-spam

The Dog Lobby:  http://doglobby.org

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 "[email protected]" rather than posting to the group.

To unsubscribe from this group, send email to 
bbedit+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to