Please fix the "Pretty Print" class in the forums and the article "Contribution Center"

  • One of the things I like the most about SQLServerCentral.com is how easy is usually is to post formatted code. It's come a long way but there are still some problems with the "Pretty Print" class code block both in the forums and the article "Contribution Center". I don't know if it's possible but it would be a wonderful thing if some of these minor problems could be repaired in the near future.

    1. Neither preserves the color of comments when an apostrophe is present in the comment. Instead, it reads the apostrophe as a single quote and colors everything after that Red. For example…

    WITH

    cteSomeCTE AS

    (--==== This is Jeff's 1st test comment

    SELECT yadayada

    FROM sometable

    )--==== This Jeff's 2nd test comment

    SELECT *

    FROM cteSomeCTE

    ;

    2. Observing the same example above, neither preserves comments when the comment is a trailing comment immediately after either a left or right parenthesis. The work around, of course, is to insert a space between the parenthesis and the first dash of the comment but most folks don't expect this.

    3. Both use light gray coloring for some symbology which, at best, is difficult to read. See the NULL, parenthesis, and the mathematical operatior in the following.

    SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) + 1;

    Further, some of the functions also appear in light gray (Left and Right below).

    ABS()

    SUBSTRING()

    LEFT()

    RIGHT()

    CHARINDEX()

    PATINDEX()

    SIGN()

    SUM()

    4. In the "Contribution Center", by default, if a line is long enough to trigger the scroll bars, it also makes the code block window much too long. This can be (apparently) manually adjusted in the contribution center but only if the width of the window is small enough (it usually is) so that you're actually aware of the problem. This problem no longer appears on the forums.

    5. During copy and paste operations from such a rendered code block, the code appears as a single line when pasted into SSMS. There was a time when this all worked perfectly and wonder if it can be brought back.

    6. Occasionally, characters such as "<", ">", etc show up as their entitized value instead of being displayed correctly. (or course, it works correctly for me now... go figure).

    SELECT *

    FROM sometable

    WHERE A < B

    As a sidebar, most of these problems where repaired in previous editions of the code blocks and the latest "upgrade" has resurrected these problems.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Noted, and passed to the publishing team.

    1. I'm not sure how easy the first item is to fix, but we'll see. Definitely an issue.

    2. Again, not sure, and not sure how many people do this. I know I drop comments on separate lines, but we'll note it.

    3. agree. Gray is hard on these old eyes as well

    4. Hadn't noticed, but I'll check

    5. No idea here, but something to look at. Note that in Firefox 4, this isn't an issue.

    6. Needs to be fixed for sure.

  • [font="Courier New"]

    WITH

    cteSomeCTE AS

    (--==== This is Jeff's 1st test comment

    SELECT yadayada

       FROM sometable

    )--==== This Jeff's 2nd test comment

    SELECT *

       FROM cteSomeCTE[/font]

    Well the poor old prettifier works with Jeff's code anyway!

    Best wishes,
    Phil Factor

  • Phil Factor (2/5/2012)


    [font="Courier New"]

    WITH

    cteSomeCTE AS

    (--==== This is Jeff's 1st test comment

    SELECT yadayada

       FROM sometable

    )--==== This Jeff's 2nd test comment

    SELECT *

       FROM cteSomeCTE[/font]

    Well the poor old prettifier works with Jeff's code anyway!

    Heh... I just knew that would come up. πŸ˜€

    If you look at my original code, there is a single leading space before each SELECT. The prettifier includes that space (as you can see if you quote your own post) but we all know what happens to leading spaces in HTML. They disappear. They need to be entitized as hard spaces as they have been everywhere else leading spaces occur. Not sure why this usually only happens with SELECT but it's been that way ever since I starting using that fine bit of code.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Steve Jones - SSC Editor (2/5/2012)


    Noted, and passed to the publishing team.

    1. I'm not sure how easy the first item is to fix, but we'll see. Definitely an issue.

    2. Again, not sure, and not sure how many people do this. I know I drop comments on separate lines, but we'll note it.

    3. agree. Gray is hard on these old eyes as well

    4. Hadn't noticed, but I'll check

    5. No idea here, but something to look at. Note that in Firefox 4, this isn't an issue.

    6. Needs to be fixed for sure.

    Thanks, Steve. On #5 for me (and maybe half the rest of the world), Firefox just isn't an option.

    On #2, it probably only affects me because 80% of the people posting don't even use comments and the 20% that do almost never (there are a couple of exceptions) format their code the way I do. Since I'm aware of it and can work around it simply by lodging a space in right after the parenthesis, I'd rather see folks put their effort into #5 and #6.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • OK, #5 seems to be fixed. Posting from IE8, and copy/paste to SSMS 2008R2 preserves line breaks for me.

    In terms of #s 1 and 2, we have some ideas, and we'll test.

    #3, SSMS uses the same color, so despite the fact I think it's hard to read, I don't think we want to change.

    In terms of #4, this isn't clear to our staff. Can you elaborate?

  • Steve Jones - SSC Editor (2/6/2012)


    OK, #5 seems to be fixed. Posting from IE8, and copy/paste to SSMS 2008R2 preserves line breaks for me.

    In terms of #s 1 and 2, we have some ideas, and we'll test.

    #3, SSMS uses the same color, so despite the fact I think it's hard to read, I don't think we want to change.

    In terms of #4, this isn't clear to our staff. Can you elaborate?

    Dang!!! the developers are Johnny on the spot! I'll test #5 and post a clarification on #4 tonight. Thanks Steve.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Tests for #5 are absolutely spot on for the fix. Great job! That makes life a whole lot easier on this side of the house! I can live with the rest. I still owe you some "pictures" on the problem of #4 and I apologize for not having it by now.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Man! I've got to say it again! Hat's off to the SSC Dev Team for fixing the code window length problem and the code window copy problem! It's made posting the joy that it once was! πŸ™‚

    Now if you could just pin the "Forum Ettiquete" article to the "General" and "T-SQL" forums, maybe we could get the OPs to finally make our life easier to respond. πŸ˜‰

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (2/13/2012)


    Man! I've got to say it again! Hat's off to the SSC Dev Team for fixing the code window length problem and the code window copy problem! It's made posting the joy that it once was! πŸ™‚

    Now if you could just pin the "Forum Ettiquete" article to the "General" and "T-SQL" forums, maybe we could get the OPs to finally make our life easier to respond. πŸ˜‰

    I Know this is late, but did you just see a rabbit go by? πŸ˜‰

  • Ugh, Nope. Couple ah chickens though.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (5/10/2012)


    Ugh, Nope. Couple ah chickens though.

    Okay, Just wanted to make sure you weren't in Wonderland or something. :w00t:

  • OH! THOSE rabbits! Yeah... they went screaming by yelling something about a tent in the desert.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply