In the case of JavaScript, for example, UE syntax highlighting offers 10 predefined "color groups" followed by "Word List 6", "Word List 7" and "Word List 8". I want to understand how to go about creating and maintaining these additional "Word Lists" (like "Word List 6") so that I can include the JavaScript tags <script language="JavaScript"> & </script> in a Word List and color them the same color as the script itself. I can find nothing in the UE Help files and FAQs pertaining to these Word Lists. Thank you.
"Word List 6" in the color group selection box of the syntax highlighting configuration dialog is the default name for color group 6 if this color group has no name or is even not listed in the wordfile.
A color group is defined in the wordfile - default after installation is Wordfile.txt in program directory of UltraEdit - with /Cn at the beginning of a line where n is the color index of 1 to 8.
To name this color group, a string with surrounding double quotes "" can be specified immediately after the number. According to help this string may be up to 18 characters. But I think it may already have up to 24 characters because the name "C# Preprocessor Directives" of color group /C3 of language /L7"C#" in the default wordfile is shown in the selection box as "C# Preprocessor Directiv" which are 24 characters.
Now how can keywords be assigned to a non-existing and so currently not used color group?
Open the syntax highlighting configuration dialog. You will see the name with full path of the currently used wordfile. Press the Open button to open this file with UltraEdit and close the configuration dialog by pressing the Cancel button.
In the wordfile first search for the language where you want to add your keywords. The language definition lines start with /Ln where n is the language index of 1 to 20.
You want <script language="JavaScript"></script> be highlighted with a color also used for the javascript code. The javascript keywords are defined below the line starting with /L9"JavaScript" in the wordfile.
But the words <script, language= and </script> are not javascript keywords, they are HTML keywords. This HTML keywords define the begin and end of a javascript section in the HTML file. The are interpreted by the HTML interpreter and not the javascript engine of the browsers. To highlight the javascript language section correctly inside the HTML language file the multi-language feature of UltraEdit is used.
So to change the color of this 3 keywords, we have to look for the language definition for HTML in the wordfile. The HTML language definition in the default Wordfile.txt starts with line /L3"HTML". Find this line.
The color group 1 /C1"Tags" of the HTML language definition contains the HTML tags <script and </script>. Delete this 2 (uppercase) strings here (and maybe also <script>). The HTML language is not case-sensitive, so <script and <SCRIPT are highlighted identical by UltraEdit!
language= is a HTML attribute and is listed in color group /C2"Attributes". Delete this uppercase string also.
Scroll a few lines down to the blank line which is the end of the HTML language definition block. Insert here now following lines:
/C3"Javascript tags"
language=
<script </script>
And maybe also add <script> between the 2 other script tags if deleted above.
Save the wordfile and open again the syntax highlighting configuration dialog. Select language "HTML" and then color group "Javascript tags" and set the color now to whatever you want.
Hope this is now helpful! (Take me more than 1 hour to write!)
A color group is defined in the wordfile - default after installation is Wordfile.txt in program directory of UltraEdit - with /Cn at the beginning of a line where n is the color index of 1 to 8.
To name this color group, a string with surrounding double quotes "" can be specified immediately after the number. According to help this string may be up to 18 characters. But I think it may already have up to 24 characters because the name "C# Preprocessor Directives" of color group /C3 of language /L7"C#" in the default wordfile is shown in the selection box as "C# Preprocessor Directiv" which are 24 characters.
Now how can keywords be assigned to a non-existing and so currently not used color group?
Open the syntax highlighting configuration dialog. You will see the name with full path of the currently used wordfile. Press the Open button to open this file with UltraEdit and close the configuration dialog by pressing the Cancel button.
In the wordfile first search for the language where you want to add your keywords. The language definition lines start with /Ln where n is the language index of 1 to 20.
You want <script language="JavaScript"></script> be highlighted with a color also used for the javascript code. The javascript keywords are defined below the line starting with /L9"JavaScript" in the wordfile.
But the words <script, language= and </script> are not javascript keywords, they are HTML keywords. This HTML keywords define the begin and end of a javascript section in the HTML file. The are interpreted by the HTML interpreter and not the javascript engine of the browsers. To highlight the javascript language section correctly inside the HTML language file the multi-language feature of UltraEdit is used.
So to change the color of this 3 keywords, we have to look for the language definition for HTML in the wordfile. The HTML language definition in the default Wordfile.txt starts with line /L3"HTML". Find this line.
The color group 1 /C1"Tags" of the HTML language definition contains the HTML tags <script and </script>. Delete this 2 (uppercase) strings here (and maybe also <script>). The HTML language is not case-sensitive, so <script and <SCRIPT are highlighted identical by UltraEdit!
language= is a HTML attribute and is listed in color group /C2"Attributes". Delete this uppercase string also.
Scroll a few lines down to the blank line which is the end of the HTML language definition block. Insert here now following lines:
/C3"Javascript tags"
language=
<script </script>
And maybe also add <script> between the 2 other script tags if deleted above.
Save the wordfile and open again the syntax highlighting configuration dialog. Select language "HTML" and then color group "Javascript tags" and set the color now to whatever you want.
Hope this is now helpful! (Take me more than 1 hour to write!)
Best regards from an UC/UE/UES for Windows user from Austria
Thank you, Mofi, for taking the time to further explain.
I did some study & experimentation with the Wordfile.txt file and discovered myself, before seeing that you had changed your reply, that I had to edit the /L3"HTML" section by deleting <SCRIPT <SCRIPT> and </SCRIPT> from the /C1"Tags" section of /L3"HTML" and creating a new /C3 section in /L3"HTML", which I defined as /C3"Script Tags". I put these tags (<script <script> and </script>) there. Then I removed LANGUAGE= from the /C2"Attributes" section and created a /C4 section defined as /C4"Script Attributes" and put LANGUAGE= there. I then colored the /C3 and /C4 sections of /L3"HTML" to match the color I used for the entire /L9"JavaScript" section.
Perhaps, I should fully explain how I am coloring and why. I am authoring pages that quite frequently include HTML, JavaScript, PHP and SQL all on the same page. To make portions easier to find, I am trying to code all HTML one color, everything pertaining to JavaScript another color, PSP a third color, et cetera.
So I start with an example that looks like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
How I wanted it to look is like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
With the changes I made (above) it looks like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
So I am getting close, but not perfect. What I was hoping could be done would be to create a /Cn"Whatever" category in /L3"HTML" and have the complete string
<script language="JavaScript">
defined as a single element that could be color coded as a complete string by defining the color of /Cn"Whatever"
Is my question easier to understand now? I hope so. And if it cannot be done, I can live with that. But if it can be done, I would like to do it.
Thanks again, Mofi.
I did some study & experimentation with the Wordfile.txt file and discovered myself, before seeing that you had changed your reply, that I had to edit the /L3"HTML" section by deleting <SCRIPT <SCRIPT> and </SCRIPT> from the /C1"Tags" section of /L3"HTML" and creating a new /C3 section in /L3"HTML", which I defined as /C3"Script Tags". I put these tags (<script <script> and </script>) there. Then I removed LANGUAGE= from the /C2"Attributes" section and created a /C4 section defined as /C4"Script Attributes" and put LANGUAGE= there. I then colored the /C3 and /C4 sections of /L3"HTML" to match the color I used for the entire /L9"JavaScript" section.
Perhaps, I should fully explain how I am coloring and why. I am authoring pages that quite frequently include HTML, JavaScript, PHP and SQL all on the same page. To make portions easier to find, I am trying to code all HTML one color, everything pertaining to JavaScript another color, PSP a third color, et cetera.
So I start with an example that looks like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
How I wanted it to look is like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
With the changes I made (above) it looks like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
So I am getting close, but not perfect. What I was hoping could be done would be to create a /Cn"Whatever" category in /L3"HTML" and have the complete string
<script language="JavaScript">
defined as a single element that could be color coded as a complete string by defining the color of /Cn"Whatever"
Is my question easier to understand now? I hope so. And if it cannot be done, I can live with that. But if it can be done, I would like to do it.
Thanks again, Mofi.
You could also add JavaScript to /Cn"Whatever" and you should get:
<script language="JavaScript">
It's also possible to highlight the whole line <script language="JavaScript"> in red color, but this is a really dirty trick.
Add Block Comment On Alt = <scri Block Comment Off Alt = > at the /L3"HTML" line before File Extensions =. Now the string <script language="JavaScript"> will be interpreted by UltraEdit as alternate block comment. Set the color for Alternate Block Comments for language HTML to the same color as for /Cn"Whatever" and you will have the perfect result you want with this really dirty trick.
<script language="JavaScript">
It's also possible to highlight the whole line <script language="JavaScript"> in red color, but this is a really dirty trick.
Add Block Comment On Alt = <scri Block Comment Off Alt = > at the /L3"HTML" line before File Extensions =. Now the string <script language="JavaScript"> will be interpreted by UltraEdit as alternate block comment. Set the color for Alternate Block Comments for language HTML to the same color as for /Cn"Whatever" and you will have the perfect result you want with this really dirty trick.
Best regards from an UC/UE/UES for Windows user from Austria
AHA!!! I love dirty tricks!! I knew you would come through with the solution. I will give it a try right away. Thanks again. That sounds exactly like the result I want.
OOOPS! The "dirty trick" didn't quite work as expected. I followed your instructions and it did color the string <script language="JavaScript"> as I wanted it to, but the script itself:
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
changed color as though it was no longer a script, but was colored as though it was HTML "Normal Text." So we solved one problem and created another. After your suggestion, it now looked like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
But thanks anyway. I can live with it the way it is.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
changed color as though it was no longer a script, but was colored as though it was HTML "Normal Text." So we solved one problem and created another. After your suggestion, it now looked like this:
this is html. this is html.
<script language="JavaScript">
<!--
greeting()
{ alert("Thanks, Mofi"); }
-->
</script>
this is more html. this is more html.
But thanks anyway. I can live with it the way it is.
You might consider using different background colors for JavaScript vs HTML rather than making the text all one color and losing the helpful syntax highlighting. For my setup I have HTML use the default white background and JavaScript use a light blue background (as well as different background colors for CSS and PHP). You can see what it looks like in the screenshot below (sorry for the external link, the forum attachments aren't working).
To change the background color for a language go to Configuration > Editor Display > Syntax Highlighting, pick the language, select the "Normal Text" color group, then change the background color and uncheck "Background Color Automatic". You don't need to set the background color for any other color groups in the language so long as they all have "Background Color Automatic" checked.
The only downside to this is that is doesn't just affect JavaScript code embedded in HTML, separate JavaScript files will also have the background color. You could probably set up a different language definition for separate JavaScript files to get around this but it doesn't really bother me (if you do that make sure to remove the file extensions from the original definition and also remove the JSCRIPT_LANG from the second definition; only one is allowed and it would need to be for the embedded version).
-Sean
To change the background color for a language go to Configuration > Editor Display > Syntax Highlighting, pick the language, select the "Normal Text" color group, then change the background color and uncheck "Background Color Automatic". You don't need to set the background color for any other color groups in the language so long as they all have "Background Color Automatic" checked.
The only downside to this is that is doesn't just affect JavaScript code embedded in HTML, separate JavaScript files will also have the background color. You could probably set up a different language definition for separate JavaScript files to get around this but it doesn't really bother me (if you do that make sure to remove the file extensions from the original definition and also remove the JSCRIPT_LANG from the second definition; only one is allowed and it would need to be for the embedded version).
-Sean
Thanks ... I may consider that alternative. Right now, all of my backgrounds are black, but I could easily make some dark blue or dark red, etc.
Sorry, my fault, bad tested it. By specifying the <script tag as comment, UltraEdit will not recognize anymore that a Javascript section is following and the javascript codes embedded into html comments will be highlighted as html comments. So remove the alternate block comments from the HTML language definition and live with the <script language="JavaScript"> or use the good alternative background coloring method from scallanh. I think, there is no other method to highlight the whole <script line with 1 color.
Best regards from an UC/UE/UES for Windows user from Austria