Results 1 to 23 of 23

Thread: formatting code

  1. #1

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    formatting code

    there is formatting with colour with line numbers which is difficult to copy and paste

    then there is
    formatting code with [ code ] [/ code ] is grey only

    there is also colour without line numbers, what tags do i need for this effect?
    bleh

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: formatting code

    Moved to Forum Feedback - which is where forum usage questions belong

    The colouring without line numbers doesn't exist any more, but hopefully the one with line numbers will be modified soon so that it is easy to copy & paste.

  3. #3

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    Quote Originally Posted by si_the_geek
    Moved to Forum Feedback - which is where forum usage questions belong

    The colouring without line numbers doesn't exist any more, but hopefully the one with line numbers will be modified soon so that it is easy to copy & paste.
    hi si

    i have seen posts with the colouring without line numbers, so the server still supports it
    bleh

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: formatting code

    You can use [code] and manually colour keywords using the [color] tag, if you're masochistic enough.

  5. #5

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    Quote Originally Posted by penagate
    You can use [code] and manually colour keywords using the [color] tag, if you're masochistic enough.
    yep, looked at a historical post and i deduced that a script used to run to make all the formatting tag changes. why did they replace it?
    bleh

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: formatting code

    Well, on vBulletin 2 and 3.0.x, we had a custom [vbcode] tag for VB code highlighting; the vBulletin-standard [html] and [php] tags, and the generic [code]. When we upgraded to vBulletin 3.5, the [vbcode] tag was removed and replaced with the 3.5-compatible [highlight=lang] tag, which is more versatile, but needs some formatting work as you've pointed out. The old posts which contained [vbcode] were converted to use the new tag. Some people used to colour code manually (I did occasionally for Javascript samples); these haven't been changed.

  7. #7

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    Quote Originally Posted by penagate
    When we upgraded to vBulletin 3.5, the [vbcode] tag was removed and replaced with the 3.5-compatible [highlight=lang] tag, which is more versatile, but needs some formatting work as you've pointed out. The old posts which contained [vbcode] were converted to use the new tag. Some people used to colour code manually (I did occasionally for Javascript samples); these haven't been changed.
    seems like the script can be made to run and change the tags once permanently, if you see what i mean?

    also it seems a little silly to remove functionality as the vbulletin evolves
    bleh

  8. #8

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    i seem to remember someone actually created a application for custom tag formatting, do you remember who that was?
    bleh

  9. #9

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    i think the app used to be in this thread that has dissapeared?
    http://forums.vb-world.net/showthrea...threadid=59426
    bleh

  10. #10

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    Code:
    Function factorial(ByVal n As Long) As Variant
    ' by cleverconcepts
    Dim d As Variant, i&
    d = CDec(d)
    For i = n To 1 Step -1
        If i = n Then
            d = n
        Else
            d = d * i
        End If
    Next i
    factorial = d
    End Function
    bleh

  11. #11

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    excellent
    bleh

  12. #12
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: formatting code

    That's a lot of work.

    I've deleted your "test" posts from this thread. We have a separate Forum Test Area if you want to do things like that in future.


    While there are currently a couple of issues with the new tags, they will be much better in the long run (and will automatically update any existing posts).. the only problem is that we have to put up with the issues like copy & paste for a little bit.

    By the way, I forgot to mention before that a temporary fix to the copy & paste issue is to paste into WordPad, then copy & paste from there to VB.

  13. #13

    Thread Starter
    Member cleverconcepts's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    44

    Re: formatting code

    Quote Originally Posted by si_the_geek
    That's a lot of work.
    whew, yep, sore fingers now.


    By the way, I forgot to mention before that a temporary fix to the copy & paste issue is to paste into WordPad, then copy & paste from there to VB.
    bleh

  14. #14
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: formatting code

    The tags also don't seem to nest correctly anymore. I removed a line from my sig because it had the old vbcode tags, which are of no use... upon changing them to the highlight tags, the tag in the middle to prevent them from taking effect kept appearing when it should have been closing itself. Anyone else had tihs issue?

  15. #15
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: formatting code

    If you want to copy and paste code that is formatted this way (with [highlight=VB] tags)
    vb Code:
    1. Private Sub mnuImages_Click()
    2.  
    3.     Dim intIndex As Integer
    4.    
    5.     mnuImages.Checked = Not mnuImages.Checked
    6.    
    7.     If mnuImages.Checked Then
    8.         tvwXML.Style = tvwTreelinesPlusMinusPictureText
    9.         For intIndex = 1 To tvwXML.Nodes.Count
    10.             SetTreeviewNodeImage tvwXML.Nodes(intIndex)
    11.         Next
    12.     Else
    13.         For intIndex = 1 To tvwXML.Nodes.Count
    14.             tvwXML.Nodes(intIndex).Image = 0
    15.         Next
    16.         tvwXML.Style = tvwTreelinesPlusMinusText
    17.     End If
    18.    
    19.     SaveSetting App.EXEName, "Options", "Tree Images", mnuImages.Checked
    20.  
    21. End Sub
    then you can use either of the two New apps in my signature. With those two apps it's as easy as ctrl-c/paste or atc-c/paste.

  16. #16
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: formatting code

    Now just allow for tags inside the code and we'll be one step closer...

  17. #17

  18. #18
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: formatting code

    Quote Originally Posted by timeshifter
    The tags also don't seem to nest correctly anymore. I removed a line from my sig because it had the old vbcode tags, which are of no use... upon changing them to the highlight tags, the tag in the middle to prevent them from taking effect kept appearing when it should have been closing itself. Anyone else had tihs issue?
    If you want to show people how to use any tags, you can use the new "NoParse" tag, eg:

    [noparse][HIGHLIGHT="vb"] code here [/HIGHLIGHT][/noparse]

    shows: [HIGHLIGHT="vb"] code here [/HIGHLIGHT]

  19. #19
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: formatting code

    Quote Originally Posted by timeshifter
    The tags also don't seem to nest correctly anymore. I removed a line from my sig because it had the old vbcode tags, which are of no use... upon changing them to the highlight tags, the tag in the middle to prevent them from taking effect kept appearing when it should have been closing itself. Anyone else had tihs issue?
    I didn't understand what you meant when I first responed to you. I don't experienmce the problem you mention. This example, like the one in my signature has a bold tag in the middle of each tag.
    [highlight='vb'][/highlight]

  20. #20
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: formatting code

    Well, whatever the update did, it screwed up my sig... I just had a color tag thrown in there that wasn't before, and it removed a bold tag that WAS in there without removing the closing tag...

    Just do everybody a favor and go back to the old tag setup... everybody knew it, it was easy, it didn't give anybody any crap...

  21. #21

  22. #22
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: formatting code

    In true Microsoft fashion... change it for the worse and call it an upgrade... then sit there an ignore it while people are getting pissed about having to change things around it...

  23. #23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width