On 30/01/2013 20:20, Marek Stepanek wrote:
And how you apply this ruby script to the selected text? I have no idea,
how ruby is working ...
It works just as a Perl script works, as a filter
Here a little perl-filter. Adapt the first paragraph number to your
needs: my $para_nr = sprintf("%3s",1) if you have already some numbers
before.
Here’s an alternative that left-aligns the text. It probably
needs a little tweaking.
#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 60;
my $n = 1; my $number;
my @paras = <>;
my $padding = 2;
$padding = 3 if scalar @paras > 99;
my @new_lines;
for (@paras) {
$number = sprintf ("%$padding\d. ", $n);
push @new_lines, wrap($number, " ", $_);
$n++;
}
print @new_lines;
JD
--
--
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.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.