On Tuesday, Jul 29, 2003, at 16:37 Asia/Tokyo, Brian Ferguson wrote:

One of the macros included with NWEx is for Quoting paragraphs; it puts " at start and end. Unfortunately this is not the same as Quoting text in an email - adding > at the start of each line or paragraph. I know nothing about Perl but it must be a simple way of converting this text macro to an email-useful macro. Can anyone help here please?

Here is a script I'm using in both NW express and, via TextExtras, other Cocoa apps.


<http://quinon.com/files/nisus_files/NWExpressMacros/ QuoteUnquote.pl.sit>

I stole the basic idea from

/Developer/ProjectBuilder Extras/ExampleScripts/Scripts/30-Comments/10-un_commentLines.pl


Kino


========================================================================

#!/usr/bin/perl
#
# -- TextExtras User Script Info --
# %%%{TEName=Quote/Unquote}%%%
# %%%{TEInput=Selection}%%%
# %%%{TEOutput=ReplaceSelection}%%%
# %%%{TEKeyEquivalent=}%%%
# %%%{TEArgument=TextExtras}%%%
# %%%{TEIncrementalDisplay=YES}%%%
#
#
# -- Nisus Writer Express --
#Nisus Macro Block
#source clipboard
#destination clipboard
#before execution
#Clipboard 1
#Copy
#after execution
#Paste
#Clipboard 0
#End Nisus Macro Block
#
# If NW Expresss takes long time to switch clipboard,
# remove 'Clipboard 1' and 'Clipboard 0'.


####### QuoteUnquote.pl #######


# Quote unquoted lines and Unquote quoted lines.

# Attention: if the selection contains any line
# begining with '>' or ' >', the whole selection
# will be unquoted.

use strict;
use warnings;

my $str = "";

if (scalar(@ARGV) > 0) {
        if ( $ARGV[0] eq "TextExtras" ) {
$str = <<'MYSELECTION';
%%%{TESelectedText}%%%
MYSELECTION
chomp $str;
        }
} else {        # Executed as NW Express macro
        while (<>) {
        $str .= $_;
        }
}

if ( $str eq "" ) {
        print STDERR "QuoteUnquote.pl: Nothing selected!\n";
        exit;
}

if ( $str =~ /^ ?>/m ) {
# if there is a line beginning with '>' or ' >'...
        $str =~ s/^ ?>[ >]*//gm;
} else {
        $str =~ s/^/> /gm;
}

print $str;

###### end of script ######

========================================================================


--------------------------------------------------- The Nisus Interactive List [EMAIL PROTECTED]

Searchable archives:
http://www.mail-archive.com/nisus-interactive%40nisus.com/

To unsubscribe from this list please send a message with "unsubscribe
nisus-interactive" in the body of the email to [EMAIL PROTECTED]




Reply via email to