View previous topic :: View next topic |
Author |
Message |
skywayman Smarty n00b
Joined: 17 Jan 2008 Posts: 3
|
Posted: Thu Jan 17, 2008 9:45 pm Post subject: Syntax Highlighting web page broken |
|
|
I don't have any points so I can't post URLs. You'll have to bear with me.
To reproduce:
From the front page:
Click "Contributed Code" at left
Under Syntax Highlighting click "Configurations for different text editors"
Error:
Forbidden
You don't have permission to access /contribs/syntax_highlighting/ on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
I'm attempting to integrate smarty syntax highlighting in to Notepad++ or at least see if I can find something already implemented. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Jan 17, 2008 10:14 pm Post subject: |
|
|
The contribs directory works now, thanks for the heads up. |
|
Back to top |
|
milimetr88 Smarty n00b
Joined: 18 Jan 2009 Posts: 4
|
Posted: Sun Jan 18, 2009 1:53 pm Post subject: Re: Syntax Highlighting web page broken |
|
|
skywayman wrote: |
I'm attempting to integrate smarty syntax highlighting in to Notepad++ or at least see if I can find something already implemented. |
Hi, have you already coped with highlighting Smarty in Notepad++? I'm interested in it too, but have not enough time to write this file on my own. If you have done anything, could you please send it to me?
My mail: <my login here> [at] gmail com |
|
Back to top |
|
skywayman Smarty n00b
Joined: 17 Jan 2008 Posts: 3
|
Posted: Mon Jan 19, 2009 3:56 pm Post subject: |
|
|
Nope! NP++ is not clear on how to add syntax support. The editing engine is based on Scintilla which has documentation on highlighting, but nothing on applying new schemes.
I believe the NP++ author had to write his own interface to Scintilla's highlighting API and I cannot find XML files or other methods to reverse engineer. I suppose the next best thing to do is ask him... |
|
Back to top |
|
milimetr88 Smarty n00b
Joined: 18 Jan 2009 Posts: 4
|
Posted: Mon Jan 19, 2009 5:19 pm Post subject: |
|
|
Well, I have spend ten minutes on looking here and there in Notepad++ files and it seems rather easy to be "reverse engineered" although probably consuming a couple of hours.
Just look at the files:
langs.xml
stylers.xml
FunctionListRules.xml
langs.xml contains the name of a language, comment start/end signs, extensions and keywords divided into several groups, each group named e.g. instre1.
These names seem to be used in the second file, stylers.xml, to assign styles for them - font, color, size and so on
The third file looks the most interesting - it contains regexps for various types of many languages.
Now just choose a language which you know and look into these files and explore When I will have some time, I will play with them too. |
|
Back to top |
|
skywayman Smarty n00b
Joined: 17 Jan 2008 Posts: 3
|
Posted: Mon Jan 19, 2009 9:16 pm Post subject: |
|
|
My installation doesn't have FunctionListRules.xml
I went through the XML files I have and created unique SMARTY definitions, but nothing seems to cause it to show as available.
I mimicked the php definitions, but changed the file extension to tpl instead. No dice. |
|
Back to top |
|
bluelueboy Smarty Rookie
Joined: 21 Jan 2009 Posts: 5
|
Posted: Thu Jan 22, 2009 1:52 pm Post subject: |
|
|
Hi folks,
I've been searching a lot for smarty color syntaxing for notepad++ out there but I've always been unsuccefull in finding anything.
Looking up notepad++ website, I found a neat howto guide to create userdefined syntaxings.
http://notepad-plus.sourceforge.net/uk/UserLanguageDefineSystem-HOWTO.php
Following the tutorial, and seaking the web for the functions lists I came up with a solution that does the job. It's not perfect, but it's far better than nothing.
Here is the fast way of getting there :
Download this file
http://storage.barrhauss.com/smarty/userDefineLang.xml
and place it in the notepad++ directory. That's it. If it doesn't work, notepadd might be writting the XML files in the %APPDATA%\Notepad++ directory. Try that instead.
I'll keep you updated in case of improvements.
Last edited by bluelueboy on Thu Feb 09, 2012 10:51 am; edited 3 times in total |
|
Back to top |
|
milimetr88 Smarty n00b
Joined: 18 Jan 2009 Posts: 4
|
Posted: Sat Jan 24, 2009 8:45 pm Post subject: |
|
|
Ah, yes, you are right! Thank you, bluelueboy! Once I have found the save guide on notepad++ website, but have completely forgotten about it.
More or less your file works correctly Thank you once again. Do you happen to know how to modify it to force Notepad++ to highlight HTML tags like in HTML files?
I have just found a bug in Smarty highlighting, although I don't know yet whether it's your xml's fault one a Notepad's bug:
(I'll paste the link later, now I don't have 3 posts) when there is <tr>{ (without a space between > and {), <tr> is not coloured.
Besides that when typing words there is a slight, tiny delay before the words appear on screen. I think that's because the number of words in your xml is HUGE. Can't it be smaller? I will take a look, maybe I will manage to improve efficiency and cut out some words |
|
Back to top |
|
milimetr88 Smarty n00b
Joined: 18 Jan 2009 Posts: 4
|
|
Back to top |
|
bluelueboy Smarty Rookie
Joined: 21 Jan 2009 Posts: 5
|
Posted: Fri Jan 30, 2009 7:17 pm Post subject: |
|
|
Alright,
I'm preparing a little howto so you can follow how I made the syntaxing.
I know about the cons you speak of, I've also tried an alternative syntaxing but both are not perfect.
The text is on another computer, I'll post it soon. |
|
Back to top |
|
bluelueboy Smarty Rookie
Joined: 21 Jan 2009 Posts: 5
|
Posted: Fri Feb 06, 2009 11:58 am Post subject: |
|
|
Arg,
So it apears my computer's hard drive is unaccesible and I can't retreive the "how to" I've been writting (and spent quite some time on it)...
Lucky enough I had sent a copy of the userDefinedLang.xml on internet.
Here is the alternative syntax coloration I've wrote (allong with the first one). Find it under the name "Smarty Simple".
Basicaly the difference is that this time curly braquets { and } are considered as operators, so touching characters won't interfeer with the coloration as you pointed out. The down side is that since all operators have the same color, you might not want them to be colored the same way keywords are. It's up to you.
It is not perfect either since this time a single * can easilymake the coloration coment the rest of the file. The reason for this is that operators are not properly included in the token search.
Be aware that if you want to merge this file with custom definitions you've made yourself, or your own improvements, you'll have to edit the xml manualy.
find it here : http://barrhauss.com/storage/smartysimple/userDefineLang.xml
Last edited by bluelueboy on Fri Feb 06, 2009 12:30 pm; edited 1 time in total |
|
Back to top |
|
bluelueboy Smarty Rookie
Joined: 21 Jan 2009 Posts: 5
|
Posted: Fri Feb 06, 2009 12:25 pm Post subject: |
|
|
I would be surprised if the size of the dictionary really adds any visible latency. I can't feel any, in either using custom languages or standard built in languages, and my computer is far from being high end... I just don't have any explanation to your problem but of course, try to start a new langage with a tiny dictionnary and see if there is a difference in delay.
For details concerning your issues : as I mentioned above, in the first version of the language I uploaded, curly brackets where not considered as operators. I actualy added them to the words in the dictionary, making in much bigger indeed. Notepad++ will only consider blank spaces, new lines and operators (customly defined) as separators, thus sticking a < or any other character that is not an operator results in failure to find the token.
In the second version I added, the brackets as operators so all tokens are now found and the dictionary is considerably smaller, but there are some issues with * hanging around in the code.
Other than that, both versions I've submited have the same limitations : you only have 4 different colors to play with, so there is no way you can implement both smarty and HTML complete colorations.
Also, string delimiters ' ' and " " are actualy prioritized over smarty delimiters whereas smart works the other way (since the delimiters are part of the html and not smarty instructions).
The system is just to simple for that. Maybe the other solutions mentionned above by skywayman (editing the built in xml language files) but I haven't tried that yet and he was not succesfull either |
|
Back to top |
|
cl Smarty Rookie
Joined: 05 Dec 2008 Posts: 12
|
Posted: Thu Apr 15, 2010 7:14 am Post subject: |
|
|
I use FREE PHP IDE - Codelobster PHP Edition with specail Smarty plug-in for working with Smarty.
It has syntax highlighting, autocomplete and context help. |
|
Back to top |
|
phazei Smarty Rookie
Joined: 26 Feb 2010 Posts: 6
|
Posted: Fri Aug 20, 2010 12:46 am Post subject: |
|
|
Rather than attempting to redo your own custom highlighting, just try to figure out how to make it think "{" is an open tag for php and "}" as a close php tag. The php highlighting would look fine. If you just do <? in front of a smarty tag, you can see.
Or you can put {*<a*} in front of your large blocks of { and it works kinda... |
|
Back to top |
|
alv_in Smarty n00b
Joined: 14 Mar 2011 Posts: 1
|
Posted: Mon Mar 14, 2011 12:20 pm Post subject: |
|
|
Excuse me for digging up old thread.
Could someone publish bluelueboy userDefineLang.xml file?
I used to use it, but forgot to backup, and the link http://barrhauss.com/storage/smarty/userDefineLang.xml is now
dead.
thanks in advance |
|
Back to top |
|
|