Code Formatting

  • Do view source on any forum page and look at the js "Brush" modules right at the top:

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shCore.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushCpp.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushCSharp.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushCss.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushJava.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushJScript.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushPhp.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushPlain.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushSql.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushVb.js"></script>

    <script type="text/javascript" src="/shared/syntaxhighlighter/scripts/shBrushXml.js"></script>'

    (Hmm, looks like I was wrong about the XML, you still have to put in the "& lt;" codes)

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • The real hard part was figuring out how to spell the tag labels. They're case-sensitive and not generally capitalized the same as they appear above.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • I've asked for a full documentation and I'll add these to the shortcuts on the left.

    We used the same algorithm in the blogs and articles, so we should support a few different languages. I think the "code" tag is for T-SQL and the "code2" is for XML.

    not sure about CSharp, but I'll get them added.

  • Here's what I have so far that works:

    [ code ] for SQL,

    [ code="csharp" ] for C#

    [ code="vb" ] for VB.net

    [ code="xml" ] for XML

    bit i still have to use "& lt;" and "& gt;" for "<" and ">".

    (note: I added extra spaces to prevent these from being translated as tags)

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Steve Jones - Editor (3/30/2009)


    I think the "code" tag is for T-SQL and the "code2" is for XML.

    Testing XML

    [code2]

    [/code2]

    Edit: Nope.

    I notice that the ADDADD is still there.

    -- Testing single quotes within comments '

    Print 'String 1'

    Print 'String 2'

    Edit: Looks like that's still broken too.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hmm, maybe something changed. I'll get the code list and post it.

    No changes yet since the release last week. There is development starting today for release next week.

  • RBarryYoung (3/30/2009)


    Here's what I have so far that works:

    [ code ] for SQL,

    [ code="csharp" ] for C#

    [ code="vb" ] for VB.net

    [ code="xml" ] for XML

    bit i still have to use "& lt;" and "& gt;" for "<" and ">".

    (note: I added extra spaces to prevent these from being translated as tags)

    That implies that the new [ code ] formatter might produce strange effects on old [ code ] blocks if they weren't SQL. I know I've used code blocks for results etc where I wanted fixed font.

    BTW, does [ code="sql" ] work as well if you want to be explicit about it?

    Derek

  • Derek Dongray (3/31/2009)


    RBarryYoung (3/30/2009)


    Here's what I have so far that works:

    [ code ] for SQL,

    [ code="csharp" ] for C#

    [ code="vb" ] for VB.net

    [ code="xml" ] for XML

    bit i still have to use "& lt;" and "& gt;" for "<" and ">".

    (note: I added extra spaces to prevent these from being translated as tags)

    That implies that the new [ code ] formatter might produce strange effects on old [ code ] blocks if they weren't SQL. I know I've used code blocks for results etc where I wanted fixed font.

    Yes, exactly. I spent much of last weekend trying to find old posts of mine that were messed up and fixing them. I am sure that I didn't find nearly all of them.

    BTW, does [ code="sql" ] work as well if you want to be explicit about it?

    I haven't tried it yet.

    Let's try it now:

    SELECT DATEDIFF(WK,'2000-1-1','2000-12-31'), DATEDIFF(WK,'2000-1-1','2001-1-1'), dbo.fnWeeksInYear(2000)

    SELECT DATEDIFF(WK,'2001-1-1','2001-12-31'), DATEDIFF(WK,'2001-1-1','2002-1-1'), dbo.fnWeeksInYear(2001)

    SELECT DATEDIFF(WK,'2002-1-1','2002-12-31'), DATEDIFF(WK,'2002-1-1','2003-1-1'), dbo.fnWeeksInYear(2002)

    SELECT DATEDIFF(WK,'2003-1-1','2003-12-31'), DATEDIFF(WK,'2003-1-1','2004-1-1'), dbo.fnWeeksInYear(2003)

    SELECT DATEDIFF(WK,'2004-1-1','2004-12-31'), DATEDIFF(WK,'2004-1-1','2005-1-1'), dbo.fnWeeksInYear(2004)

    SELECT DATEDIFF(WK,'2005-1-1','2005-12-31'), DATEDIFF(WK,'2005-1-1','2006-1-1'), dbo.fnWeeksInYear(2005)

    SELECT DATEDIFF(WK,'2006-1-1','2006-12-31'), DATEDIFF(WK,'2006-1-1','2007-1-1'), dbo.fnWeeksInYear(2006)

    SELECT DATEDIFF(WK,'2007-1-1','2007-12-31'), DATEDIFF(WK,'2007-1-1','2008-1-1'), dbo.fnWeeksInYear(2007)

    SELECT DATEDIFF(WK,'2008-1-1','2008-12-31'), DATEDIFF(WK,'2008-1-1','2009-1-1'), dbo.fnWeeksInYear(2008)

    SELECT DATEDIFF(WK,'2009-1-1','2009-12-31'), DATEDIFF(WK,'2009-1-1','2010-1-1'), dbo.fnWeeksInYear(2009)

    Yep. Looks good.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • I'm now just seeing everythign as plain fixed font. Has it all been switched off?

    Or is my browser playing up?

    Derek

  • Looks good to me. I am using Firefox 3.0.8.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Have you disabled macros or javascript?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • RBarryYoung (3/31/2009)


    Have you disabled macros or javascript?

    Not deliberately! 🙂

    But after some other checking I found that Javascript wasn't working and eventually fixed it by "regsvr32 jscript" so it's OK now!

    The only update I had yesterday was for iTunes. Can't think why that (or anything else) would unregister jscript.

    Observed side-effect: System Restore won't start; it just gives a blank window; it must use jscript! Very helpful! A restore program which can't work if things are broken in a particular way! :w00t:

    Derek

  • New code formatting engine: http://www.sqlservercentral.com/Forums/Topic794401-83-1.aspx

Viewing 13 posts - 31 through 42 (of 42 total)

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