[TxMt] MultiMarkdown Bug in Lists...
Brian H
binarynomad at gmail.com
Sun Mar 16 15:40:14 UTC 2008
Hi Fletcher,
Thanks so much for looking into this bug. I use your bundle on a
daily basis and it is wonderful.
I tested the new sibling command and it no longer strips out any of
the "$", but now I found that it will not recognize the level of the
list item. If I indent a sibling, the new sibling always resets
itself back to the beginning (or top level) of the list, I have to
keep manually indenting the level of the list items:
PREVIOUS
- item1
- item2
- item3
- item4
CURRENT
- item1
- item2
- item3
- item4
----
Brian H
binarynomad at gmail.com
http://www.binarynomad.com
On Mar 16, 2008, at 7:35 AM, Fletcher T. Penney wrote:
> OK, I think the following works. Anyone who uses the MMD bundle,
> please try it out in various circumstances. My testing indicates
> that it works, but I may have missed something.
>
> If I don't hear of any bugs, I'll update the bundle on my web site....
>
> Replace the command for "List - New Sibling" with:
>
> #!/usr/bin/env perl
>
> # New, cleaned up, improved list sibling command
> # Thanks to Allan Odgaard and Brian H for finding and
> # helping to fix problem with special characters in list items
>
>
> # get current line, and break into what is left and right of caret
>
> $line = $ENV{'TM_CURRENT_LINE'};
>
> $index = $ENV{'TM_LINE_INDEX'};
> $line =~ /^(.{$index})(.*)$/;
> $left = $1;
> $right = $2;
>
>
> # Escape special characters since we will paste as snippet
> $left =~ s/(?=[\$`\\])/\\/g;
> $right =~ s/(?=[\$`\\])/\\/g;
>
> # Now, figure out what to paste back
>
> if ($left =~ /^\s*((\*|\+|\-|\d+\.)\s*)\S+/) {
> # We appear to have a list item with content, so create a new sibling
>
> $marker = $1; # What was used as a list item marker?
>
> # If the marker included a counter, increment it
> $marker =~ s{
> (\d+)
> }{
> $1+1;
> }ex;
>
> print "$left\n$marker$right\$0";
> } else {
> # Not a list item with content, so strip marker (if any) and add a
> newline
> $left =~ s/^\s*((\*|\+|\-|\d+\.)\s*)//;
> print "$left\n$right\$0";
> }
>
>
>
> --
> Fletcher T. Penney
> fletcher at fletcherpenney.net
>
> You're not drunk if you can lie on the floor without holding on.
> - Dean Martin
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
More information about the textmate
mailing list