|
I just tried to add a tip containing code in VB where some of the code was class attributes enclosed in < and > . That doesn't work at all when you wrap it in pre tags.
I'll try to post the lines here to see what happens:
With pre tags:
<ToolboxBitmap(GetType(Label))> _
Public Class TransparentLabel
Without pre tags:
<toolboxbitmap(gettype(label))> _
Public Class TransparentLabel
EDIT: Nope, neither of the code snippets show properly - the attribute line is disappearing - Editors that can see this post in edit mode will see what I mean...
|
|
|
|
|
In general you have to espace escape those characters that make parts of your code look like HTML tags.
In a forum like this one, you'd have to replace < by < to prevent the HTML monster from potentially eat it all.
Here is actual proof it works both inside and outside PRE tags, the previous sentence really contains:
replace < by &lt; to prevent
replace < by &lt; to prevent
AFAIK in Q&A and T&T editor, if your piece of code is pasted and gets recognized as code (which means it gets PRE tags added automatically), then it will also be "HTML encoded", preventing any such problems.
If OTOH you explicitly told it not to recognize code, or you pasted a lot of text toghether with some code in one big swoop, or you entered the < signs without pasting at all, then it is your responsibility in Q&A/T&T to escape them as indicated earlier.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
modified on Wednesday, June 9, 2010 7:14 AM
|
|
|
|
|
It did actually get encoded, but I thought it was a mistake in this case (thought that the pre tags in this case required the real code) and changed it back, duh!
Thanks
Test:
<ToolboxBitmap(GetType(Label))> _
Public Class TransparentLabel
|
|
|
|
|
Luc Pattyn wrote: In general you have to espace those characters
Why on earth would Johnny J want to carry his characters around in an overpriced French People Carrier?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
|
maybe so you can see them very well and learn from them, isn't that the main idea behind the T&T section?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Message of the Day by a country mile methinks
|
|
|
|
|
Angle brackets are always interpreted as html tags. If you want them to be visible escape (< for < and > for >). Which is what I've done below
<ToolboxBitmap(GetType(Label))> _
Public Class TransparentLabel
|
|
|
|
|
Great, thanks to you too Thiru
|
|
|
|
|
Thiru Thirunavukarasu wrote: Angle brackets are always interpreted as html tags
I slightly disagree. It is my guess there often (maybe always) is an attempt to interpret them, however it often fails gracefully.
Behavior is rather inconsistent, my below example holds comparisons with a numeric constant "10" and a numeric variable "n"
for(int i=0; i<10; i++)
for(int i=0; i<10; i++)
for(int i=0; i<n; i++)
for(int i=0; i< n; i++)
for(int i=0; i<n; i++)
BTW: always escaping them works fine, so that is still the recommended way!
PS: the example also illustrates some syntax coloring odities that have been reported before (and aren't all that important)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
modified on Tuesday, June 8, 2010 11:45 AM
|
|
|
|
|
Yep correct. What I kind of meant to say is that our editor doesn't try to do anything special with the angle brackets so it's up to the browser to render as it sees fit.
|
|
|
|
|
are you saying the earlier observations are in accordance with the HTML specs, hence all browsers (should) treat them the same; or are you suggesting each browser can do as it sees fit, hence we authors would better always escape correctly?
FWIW: when I try and keep my web site W3C compliant, and use its check tool, I have to escape them.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Luc Pattyn wrote: are you saying the earlier observations are in accordance with the HTML specs, hence all browsers (should) treat them the same
Nope
Luc Pattyn wrote: or are you suggesting each browser can do as it sees fit, hence we authors would better always escape correctly
Yes since it's non-standard each browser will have a different implementation.
Escaping is definitely best!
|
|
|
|
|
Thanks. That is very good to know, as having it look good on my browser (FF) no longer is a guarantee then it will look good on most.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Np
|
|
|
|
|
I reported this error before (can't remember to whom, but i think it was Sean), but I just realized that it is still not fixed.
On this page:
http://www.codeproject.com/info/Submit.aspx[^]
There's THIS text:
Foreign language submissions
The Code Project is an English-language site. While we welcome those from all cultures and all walks of life, we do ask that only English language articles be psoted.
Now, the task for all is: Spot the error (or in Pythonese[^]!)
|
|
|
|
|
Hmmm, I thought we fixed that ...
I'll have to wait for the next upload for the change to take effect. Thanks for the catch!
Thanks,
Sean Ewington
The Code Project
|
|
|
|
|
No problem. If I notice it again, I'll just psot it here...
|
|
|
|
|
I would add the suggection to consistently use or not use a hyphen in English-language there.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Good call. I hadn't even noticed that. Was too preoccupied with the obvious error...
|
|
|
|
|
Oops
We'll have this fixed in a jiffy.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
You mean we're not allowed to psot articles anymore...?
|
|
|
|
|
[quote]
Small but embarrasSing error
[/quote]
Are we being self-referential today, or merely recursive?
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
still there!
Best regards,
Jaime.
|
|
|
|
|
We haven't released the new code yet.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|