garysieling / jquery-highlighttextarea

http://garysieling.github.io/jquery-highlighttextarea/
156 stars 75 forks source link

Basic SMARTY code highlighting #1

Closed CezaryDanielNowak closed 12 years ago

CezaryDanielNowak commented 12 years ago

Hello! I would like to use your jQuery plugin: highlightTextarea to highlight Smarty templates but I have some problem...

My regular expression just doesnt work: '{.+}' (It highlight wrong places). I tested it by this tool: http://gskinner.com/RegExr/

I include some smarty code to play with:

<p>{$image}</p>
<h3>{$auction.auction_link}</h3>
<p>Your price: {if $auction.final_price gte 0}</p>
<h2>{$auction.final_price|money}</h2>
<p>Please follow the steps in <em><strong>How to proceed with order?</strong></em> section.</p>
<p>{else}</p>
<h2>{"0"|money}</h2>
<p>We will transfer <strong>{$auction.final_price_no_minus|money}</strong> to your account!</p>
<p>{/if}</p>
mistic100 commented 12 years ago

the real problem is that when opied the the overlay < div >, HTML tags in the ontent are parsed, so it's a big mess

adeed to todo list

adrianhove commented 12 years ago

I was wondering if there is a way to highlight the text based on the index. For example if you have text at ((index % 2) == 0) it could be yellow, if it at ((index % 2) == 1) it could be blue.

CezaryDanielNowak commented 12 years ago

Yes, it would be even better ! This way it may be the best not-overweight smarty editor (as CodeMirror for example)

mistic100 commented 12 years ago

@adrianhove I understand what you mean but it's very specific isn't ?

adrianhove commented 12 years ago

@mistic100 Yes. It's not an issue. I am in the process of modifying the code and implementing it myself. I just thought it would be a great feature to add on.

adrianhove commented 12 years ago

Check my fork. I added highlighting in different colours.

mistic100 commented 12 years ago

hey folks, I don't have much to work on the plugin but I don't forget you !

CezaryDanielNowak commented 12 years ago

I made some changes in code and it works for Smarty now :) It will also support TAB ( \t ) character. I'm sending my code to the author.

Regards, Cezary Nowak polishwebdesign.pl

mistic100 commented 12 years ago

main issue fixed in 2.0, see demo file