Sample quoting
-
In my article Web User Forms for ASP.NET[^] I have the following code sample:
public void MyPublicMethod( object sender, EventArgs e )
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\");
// do something with dir
} // MyPublicMethodprotected void MyProtectedMethod( object sender, EventArgs e )
{
System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
} // MyProtectedMethodprivate void MyPrivateMethod( object sender, EventArgs e )
{
System.Threading.Thread.CurrentThread.Abort();
} // MyPrivateMethod</script>
<%Response.Write( "Embedded Code generated output." ); %></pre>
Is there any workaround to fix the flaw syntax highlighting?
<div class="signature">Cheers,
Jani Giannoudis
<a href="https://www.meerazo.com">Meerazo.com</a> - Resource Sharing Made Easy | Co-founder</div></x-turndown> -
In my article Web User Forms for ASP.NET[^] I have the following code sample:
public void MyPublicMethod( object sender, EventArgs e )
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\");
// do something with dir
} // MyPublicMethodprotected void MyProtectedMethod( object sender, EventArgs e )
{
System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
} // MyProtectedMethodprivate void MyPrivateMethod( object sender, EventArgs e )
{
System.Threading.Thread.CurrentThread.Abort();
} // MyPrivateMethod</script>
<%Response.Write( "Embedded Code generated output." ); %></pre>
Is there any workaround to fix the flaw syntax highlighting?
<div class="signature">Cheers,
Jani Giannoudis
<a href="https://www.meerazo.com">Meerazo.com</a> - Resource Sharing Made Easy | Co-founder</div></x-turndown>What you should do is explicitly set the language in each opeing PRE tag. Details can be found in this tip: Using PRE tags on Code Project[^] :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
What you should do is explicitly set the language in each opeing PRE tag. Details can be found in this tip: Using PRE tags on Code Project[^] :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Currently the pre tag lang is Javascript. Same issue with the pre tag cs.
Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder
-
Currently the pre tag lang is Javascript. Same issue with the pre tag cs.
Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder
There always have been some issues with the coloring as soon as string literals appear. I suspect too much Regex code has been used. What is it exactly you don't like? :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
There always have been some issues with the coloring as soon as string literals appear. I suspect too much Regex code has been used. What is it exactly you don't like? :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
<script runat="server" language="C#">
public void MyPublicMethod( object sender, EventArgs e )
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo( "C:\" );
// do something with dir
} // MyPublicMethodprotected void MyProtectedMethod( object sender, EventArgs e )
{
System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
} // MyProtectedMethodprivate void MyPrivateMethod( object sender, EventArgs e )
{
System.Threading.Thread.CurrentThread.Abort();
} // MyPrivateMethod</script>
<%Response.Write( "Embedded Code generated output." ); %>
end-of-line #5
);
until line #21<%Response.Write(
Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder
-
<script runat="server" language="C#">
public void MyPublicMethod( object sender, EventArgs e )
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo( "C:\" );
// do something with dir
} // MyPublicMethodprotected void MyProtectedMethod( object sender, EventArgs e )
{
System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
} // MyProtectedMethodprivate void MyPrivateMethod( object sender, EventArgs e )
{
System.Threading.Thread.CurrentThread.Abort();
} // MyPrivateMethod</script>
<%Response.Write( "Embedded Code generated output." ); %>
end-of-line #5
);
until line #21<%Response.Write(
Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder
Jani Giannoudis wrote:
( "C:\" )
That isn't valid C# code, either use @ or escape the backslash! As a result the code following it got comment colored, and the strings are in black. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
Jani Giannoudis wrote:
( "C:\" )
That isn't valid C# code, either use @ or escape the backslash! As a result the code following it got comment colored, and the strings are in black. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Correct. In the initial code sample the backslash was escaped. The trick is to use the
@"C:\"
variant. Many thanks Luc!Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder
-
Correct. In the initial code sample the backslash was escaped. The trick is to use the
@"C:\"
variant. Many thanks Luc!Cheers, Jani Giannoudis Meerazo.com - Resource Sharing Made Easy | Co-founder
you're welcome. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
In my article Web User Forms for ASP.NET[^] I have the following code sample:
public void MyPublicMethod( object sender, EventArgs e )
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\");
// do something with dir
} // MyPublicMethodprotected void MyProtectedMethod( object sender, EventArgs e )
{
System.Diagnostics.Process.Start( "C:\AUTOEXEC.BAT" );
} // MyProtectedMethodprivate void MyPrivateMethod( object sender, EventArgs e )
{
System.Threading.Thread.CurrentThread.Abort();
} // MyPrivateMethod</script>
<%Response.Write( "Embedded Code generated output." ); %></pre>
Is there any workaround to fix the flaw syntax highlighting?
<div class="signature">Cheers,
Jani Giannoudis
<a href="https://www.meerazo.com">Meerazo.com</a> - Resource Sharing Made Easy | Co-founder</div></x-turndown>Apart from the string issue, I also set the language to HTML (though XML or ASP.NET will work the same) which has improved the colouring. This is ASP.NET, since it includes markup tags.
<script runat="server" language="C#">
public void MyPublicMethod( object sender, EventArgs e )
{
...
}
</script>This is javascript, because it's actual javascript, not Javascript embedded inside ASP.NET
public void MyPublicMethod( object sender, EventArgs e )
{
...
}cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP