Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. WYSIWIG article editor "refactors" code in pre blocks - When that code contains Generics (.NET)

WYSIWIG article editor "refactors" code in pre blocks - When that code contains Generics (.NET)

Scheduled Pinned Locked Moved Site Bugs / Suggestions
csharphtmlasp-netcom
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mgkr
    wrote on last edited by
    #1

    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.

    L S 2 Replies Last reply
    0
    • M mgkr

      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.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Are you properly HTML-escaping the relevant characters, not just < but also > and & ? You really must use &lt; and &gt; and &amp; 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.

      M 1 Reply Last reply
      0
      • L Luc Pattyn

        Are you properly HTML-escaping the relevant characters, not just < but also > and & ? You really must use &lt; and &gt; and &amp; 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.

        M Offline
        M Offline
        mgkr
        wrote on last edited by
        #3

        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

        L R 2 Replies Last reply
        0
        • M mgkr

          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.

          S Offline
          S Offline
          Sean Ewington
          wrote on last edited by
          #4

          I took a crack at it, is that better?

          Thanks, Sean Ewington The Code Project

          M 1 Reply Last reply
          0
          • S Sean Ewington

            I took a crack at it, is that better?

            Thanks, Sean Ewington The Code Project

            M Offline
            M Offline
            mgkr
            wrote on last edited by
            #5

            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 :-)

            S 1 Reply Last reply
            0
            • M mgkr

              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 :-)

              S Offline
              S Offline
              Sean Ewington
              wrote on last edited by
              #6

              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

              M 1 Reply Last reply
              0
              • S Sean Ewington

                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

                M Offline
                M Offline
                mgkr
                wrote on last edited by
                #7

                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.

                P L 2 Replies Last reply
                0
                • M mgkr

                  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

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • M mgkr

                    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.

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    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

                    My blog | My articles | MoXAML PowerToys | Onyx

                    M 1 Reply Last reply
                    0
                    • M mgkr

                      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

                      R Offline
                      R Offline
                      realJSOP
                      wrote on last edited by
                      #10

                      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

                      M 1 Reply Last reply
                      0
                      • M mgkr

                        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.

                        L Offline
                        L Offline
                        Luc Pattyn
                        wrote on last edited by
                        #11

                        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.

                        1 Reply Last reply
                        0
                        • P Pete OHanlon

                          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

                          My blog | My articles | MoXAML PowerToys | Onyx

                          M Offline
                          M Offline
                          mgkr
                          wrote on last edited by
                          #12

                          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

                          1 Reply Last reply
                          0
                          • R realJSOP

                            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

                            M Offline
                            M Offline
                            mgkr
                            wrote on last edited by
                            #13

                            Hehe - 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 :)

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups