WYSIWIG article editor "refactors" code in pre blocks - When that code contains Generics (.NET)
-
As the subject says : WYSIWIG article editor "refactors" code in <pre> blocks - When that code contains Generics (.NET) "Just change to HTML view then". Too late... As the WYSIWIG is the default, and the code will already be altered. I recently posted an article ASP.NET OO SessionWrapper - As an integral part of the objects them self.[^] which contains 3 such codeblocks (containing Generics) On each edit I have to redo those codeblocks. I even added a "note to editors" text warning about this - Not sure if that warning is actually displayed to editors at all.. As one other editor did some edits, and screwed up the code... The other codeblocks are fine - Hence why I'm thinking it's related to the Generics syntax somehow.
-
As the subject says : WYSIWIG article editor "refactors" code in <pre> blocks - When that code contains Generics (.NET) "Just change to HTML view then". Too late... As the WYSIWIG is the default, and the code will already be altered. I recently posted an article ASP.NET OO SessionWrapper - As an integral part of the objects them self.[^] which contains 3 such codeblocks (containing Generics) On each edit I have to redo those codeblocks. I even added a "note to editors" text warning about this - Not sure if that warning is actually displayed to editors at all.. As one other editor did some edits, and screwed up the code... The other codeblocks are fine - Hence why I'm thinking it's related to the Generics syntax somehow.
Are you properly HTML-escaping the relevant characters, not just < but also > and & ? You really must use
<
and>
and&
Your article currently is containing weird things such as<</span>T> where T :
:)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Are you properly HTML-escaping the relevant characters, not just < but also > and & ? You really must use
<
and>
and&
Your article currently is containing weird things such as<</span>T> where T :
:)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
I need to escape inside <pre> tags? --- The example you listed is deffo weird - where did you find that one :-) --- EDIT lol - in the first post I could write <pre> without escaping it - But not in my reply - Hence this edit --- Double EDIT (ftw) Think I found what you are referring to - You missed the starting span tag :-)
<span class="code-keyword">></span> where T :
That's perfectly legal - and not of my doing either. It's autogenerated by the site...
modified on Monday, March 14, 2011 11:35 AM
-
As the subject says : WYSIWIG article editor "refactors" code in <pre> blocks - When that code contains Generics (.NET) "Just change to HTML view then". Too late... As the WYSIWIG is the default, and the code will already be altered. I recently posted an article ASP.NET OO SessionWrapper - As an integral part of the objects them self.[^] which contains 3 such codeblocks (containing Generics) On each edit I have to redo those codeblocks. I even added a "note to editors" text warning about this - Not sure if that warning is actually displayed to editors at all.. As one other editor did some edits, and screwed up the code... The other codeblocks are fine - Hence why I'm thinking it's related to the Generics syntax somehow.
I took a crack at it, is that better?
Thanks, Sean Ewington The Code Project
-
I took a crack at it, is that better?
Thanks, Sean Ewington The Code Project
-
Holy cow - That was some quick bug fixing. Hats of to you Sir! -- I haven't dared actually submitting - But the pre blocks seems to be escaped correctly now - rather than refactored/mangled :-)
Luc kindly and accurately described the problem, < > and & must be changed to < > and & All I did was change the ">"s ;)
Thanks, Sean Ewington The Code Project
-
Luc kindly and accurately described the problem, < > and & must be changed to < > and & All I did was change the ">"s ;)
Thanks, Sean Ewington The Code Project
Aaah - You changed the actual text, not the WYSIWIG editor code - Gotcha :-) (I was wondering how the hell you managed to fix code so quick) Thanks a bunch! --- It remains that the WYSIWIG editor is buggy though (as an FYI) In all the pre blocks I've done, I've not escaped anything by hand at all, I've simply copy/pasted from my code files (this done in HTML view ofc). The editor has then made the syntax highlighting and (partial :-)) escaping on the code. But workaround noted should I run into this again. --- Thanks all for the super speedy responses - That's truly amazing.
-
I need to escape inside <pre> tags? --- The example you listed is deffo weird - where did you find that one :-) --- EDIT lol - in the first post I could write <pre> without escaping it - But not in my reply - Hence this edit --- Double EDIT (ftw) Think I found what you are referring to - You missed the starting span tag :-)
<span class="code-keyword">></span> where T :
That's perfectly legal - and not of my doing either. It's autogenerated by the site...
modified on Monday, March 14, 2011 11:35 AM
mgkr wrote:
I need to escape inside <pre> tags?
definitely yes.
mgkr wrote:
You missed the starting span tag
I saw what I saw and reported. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Aaah - You changed the actual text, not the WYSIWIG editor code - Gotcha :-) (I was wondering how the hell you managed to fix code so quick) Thanks a bunch! --- It remains that the WYSIWIG editor is buggy though (as an FYI) In all the pre blocks I've done, I've not escaped anything by hand at all, I've simply copy/pasted from my code files (this done in HTML view ofc). The editor has then made the syntax highlighting and (partial :-)) escaping on the code. But workaround noted should I run into this again. --- Thanks all for the super speedy responses - That's truly amazing.
Alternatively, if you're pasting in, check the 'Encode "<" (and other HTML) characters when pasting' in the Options below the message.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
-
I need to escape inside <pre> tags? --- The example you listed is deffo weird - where did you find that one :-) --- EDIT lol - in the first post I could write <pre> without escaping it - But not in my reply - Hence this edit --- Double EDIT (ftw) Think I found what you are referring to - You missed the starting span tag :-)
<span class="code-keyword">></span> where T :
That's perfectly legal - and not of my doing either. It's autogenerated by the site...
modified on Monday, March 14, 2011 11:35 AM
mgkr wrote:
you listed is deffo weird
Please do not use textspeak. It's the fastest way I know of to lose everyone's attention.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Aaah - You changed the actual text, not the WYSIWIG editor code - Gotcha :-) (I was wondering how the hell you managed to fix code so quick) Thanks a bunch! --- It remains that the WYSIWIG editor is buggy though (as an FYI) In all the pre blocks I've done, I've not escaped anything by hand at all, I've simply copy/pasted from my code files (this done in HTML view ofc). The editor has then made the syntax highlighting and (partial :-)) escaping on the code. But workaround noted should I run into this again. --- Thanks all for the super speedy responses - That's truly amazing.
I have updated my tip/trick on PRE tags, link is in my sig. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Alternatively, if you're pasting in, check the 'Encode "<" (and other HTML) characters when pasting' in the Options below the message.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
Thanks for the tip! Hadn't really noticed that toggle. It's on by default - which explains why I was struggling (not understanding) what was going on when sometimes pasting bits and pieces. Seeing as the top of the editor window here has 3 distinct buttons for <,> and & respectively - Wouldn't it be nice with one for "encode selected text" as well :) I mean, if I'm writing stuff, say about html formatting, I'd end up using a lot of <'s and >'s, and having to move to the mouse to click those buttons for each (or writing the escape code by hand) is a tad cumbersome. Just writing normally, and then when done mark up the text, and click that button would be sweet. Not a huge priority I agree - Just a "nice to have". - workaround is of course to just type your text normally, and then ctrl+a/ctrl+x/ctrl+c (with the encode option checked) - Which I just did ;P
-
mgkr wrote:
you listed is deffo weird
Please do not use textspeak. It's the fastest way I know of to lose everyone's attention.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997Hehe - I agree actually. I hate the practice myself. While the result is the same, in my case it's actually not a question of being perverted by "textspeaking", as I rarely ever send a text (10-20 a year perhaps), but more an old habit from not quite knowing how to spell a few words (english not being my native language). As I said, I hate the practice myself, so I really try to catch my self - But once in a while you can catch me in slipping one of the following in. ofc - Of course ppl - People (no idea how that one got added to my bad habit list...) def/deffo - Definitely (And I'm sad to say it's not more than maybe 3-4 years ago I learned it's not spelled "definatly"...) Theres probably a couple more, but that's what I can think of at the top of my head. So yeah - I know. And I try :)