[TxMt] TM doesn't have trouble with RE, but I have.

marios tmtxpstuff at consking.com
Wed Feb 20 20:03:45 UTC 2008


Daniel Stockman wrote:
>> So here is the case. I want do do some tricky Syntax highlight matching,
>> and wanted to have the visual sidebar with the line numbers.
>> [...]
>> As you can see, I want to replace every single in the document, with the
>> span instance above plus the Capture Register( Just like the Ruby code
>> does in TM Bundle ), which is the whole line, whether it is empty or not.
> 
> Actually, it's really hard to understand what you're aiming at, here.
> "Just like the Ruby code does in TM Bundle"... uh, which one? What
> command/snippet are you referring to?
> 
> I see several ways of adding line numbers to a document (bundle name):
>   - Create HTML From Document / Selection with Line Numbers (TextMate)
>   - Add Line Numbers to Document / Selection (Text)
>   - Option + Command + L will show the line numbers in the gutter...
> 
> You "want to replace every single"... what? "in the document". And I'm
> really perplexed by the reference to testing "the JavaScript", which
> AFAIK isn't what bundles are written/tested/interpreted in.
> 
> I think more clarification is required so we can understand what exactly
> you want to do.
> 
> ~ Daniel
> 

Sorry for the confusion. Ok, so how do we express ourselves better?
Lemmy try once more.

The question, that I am asking, is related to Regular Expressions and
Javascript. ( So this is not a Support request at all )

I am working on a Plugin for Textpattern, which will use a mootools
class, to append the corresponding DOM nodes with the classed span tags.

This will all happen after the code that is to be displayed syntax
highlighted is already encoded to entities. That works all so far.

Now in order to get the same effect as we do have with the Make HTML
document from source with Line numbers (Which is located in the TextMate
Bundle and uses Ruby for that), yes the one that makes the span tags for
the line numbers,I am trying to figure out, why the same Regular
expression, that I mentioned in my previous post, would not work, when
used as above.

( I even checked the Syntax with Flanagan's Book, also tried global
matching but no luck )

So this is the task:

Match every beginning of a line, including the first line of the
document, and put that in Capture register one, then match every line
until the end of the Line, end put that in Capture Register 2, then
replace every instance, with some extra Markup (The spantags here ) plus
Capture Register 2.

This works from within TextMate, but not in Javascript.


I hope, this explains better what I meant.

regards, marios



More information about the textmate mailing list