Code Syntax

  • (2 Pages)
  • +
  • 1
  • 2

24 Replies - 1253 Views - Last Post: 06 December 2008 - 09:55 AM

#1 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Code Syntax

Posted 01 December 2008 - 10:05 PM

Maybe I'm not waiting long enough for firefox to load the page, but it seems like the code syntax doesn't "load". (i.e has named code at the top indicating color syntax, but remains colorless like regular code tags) Usually this only happens after a quick edit of one of my posts and goes away with a page refresh. Anyone else having this problem?
Is This A Good Question/Topic? 0
  • +

Replies To: Code Syntax

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Code Syntax

Posted 01 December 2008 - 10:26 PM

Yes, I noticed the lag time before the syntax highlighting kicks in. It has been that way, for me, since it was added to the forum.

Not sure if this is a FF only issue.
Was This Post Helpful? 0
  • +
  • -

#3 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Code Syntax

Posted 02 December 2008 - 02:32 PM

Weird, today it seems to have resolved itself somewhat.
Was This Post Helpful? 0
  • +
  • -

#4 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Code Syntax

Posted 03 December 2008 - 05:11 PM

Nice! I like the new highlighting. Thought maybe I went red/green color blind, cause of all the pretty colors :)
Was This Post Helpful? 0
  • +
  • -

#5 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Code Syntax

Posted 03 December 2008 - 06:57 PM

The new syntax highlighter loses the line numbers, but it auto-highlights no matter what language and no matter if they put [ code=language ] or just plain [ code ].

I'm going to clean up the colors a bit to make it nicer.
Was This Post Helpful? 0
  • +
  • -

#6 magicmonkey  Icon User is offline

  • D.I.C Regular

Reputation: 106
  • View blog
  • Posts: 484
  • Joined: 12-September 08

Re: Code Syntax

Posted 03 December 2008 - 07:03 PM

Well VB.NET code is a mess, something is wrong with the syntax highlighting logic using IE7.
Was This Post Helpful? 0
  • +
  • -

#7 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Code Syntax

Posted 03 December 2008 - 07:13 PM

Link please.
Was This Post Helpful? 0
  • +
  • -

#8 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Code Syntax

Posted 03 December 2008 - 07:14 PM

View Postskyhawk133, on 3 Dec, 2008 - 05:57 PM, said:

The new syntax highlighter loses the line numbers, but it auto-highlights no matter what language and no matter if they put [ code=language ] or just plain [ code ].

I'm going to clean up the colors a bit to make it nicer.

Something I just noticed... I use the "view plain" feature of the code block all the time. Just now I couldn't copy a poster's code because the feature is missing. If possible, please add it back.

Thanks,

Jeff
Was This Post Helpful? 0
  • +
  • -

#9 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Code Syntax

Posted 03 December 2008 - 07:21 PM

Are you unable to copy the code out of the code block now? The normal [code] blocks never had a "view plain".

What browser are you using and what are you pasting in to. What is the end result look like after you paste it?
Was This Post Helpful? 0
  • +
  • -

#10 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Code Syntax

Posted 03 December 2008 - 08:31 PM

I think I'm narrowing down some of the problems.

The issue with the VB.NET and ASP.NET and VB code is the comments that start with a ' (apostrophe)

I think I've turned off highlighting for any code that has comments with a ' (apostrophe) so there should be issues, but they also won't get highlighted.

Other code is looking good.

How about you IE guys. Seeing indents, coloring, can you copy/paste?
Was This Post Helpful? 0
  • +
  • -

#11 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Code Syntax

Posted 03 December 2008 - 10:16 PM

Indentation is terrible so far. That could just be the posters, but it seems sporadic.
Was This Post Helpful? 0
  • +
  • -

#12 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Code Syntax

Posted 03 December 2008 - 10:17 PM

How are indents looking for IE 7 users? You should be able to see everything ok now.

How about copy/paste. Is that working fine for everyone? I've tested indents, and copy/paste in IE 7, Chrome, Safari, and FireFox 3 and it's all displaying the same way and working properly.

However, I'm hearing rumors that some of you are having problems. Can you go check now (not 5 minutes ago) and see if you're still having problems.

View PostKYA, on 3 Dec, 2008 - 10:16 PM, said:

Indentation is terrible so far. That could just be the posters, but it seems sporadic.


I need links to threads that you're having problems with so I can actually click "Edit" and see if it's an issue with the highlighter, or the user just didn't indent.
Was This Post Helpful? 0
  • +
  • -

#13 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Code Syntax

Posted 03 December 2008 - 11:04 PM

View Postskyhawk133, on 3 Dec, 2008 - 06:21 PM, said:

Are you unable to copy the code out of the code block now? The normal [code] blocks never had a "view plain".

What browser are you using and what are you pasting in to. What is the end result look like after you paste it?

Yes, I can copy now but it's a bit more involved, especially for long posts. I didn't mention in my original post that I always add the language type to the code tag.

With the "view plain" function it's a simple process to copy all the code without have to page or line feed down the text.

What can I say... I'm lazy! :)

Browser is ff 3.04 What I'm pasting into is either a VS2008 source file (VB, C#, etc) or a NetBeans 6.5 one. And what it looks like is entirely normal. :)
Was This Post Helpful? 0
  • +
  • -

#14 red_4900  Icon User is offline

  • Code T(h)inkers
  • member icon

Reputation: 21
  • View blog
  • Posts: 1,120
  • Joined: 22-February 08

Re: Code Syntax

Posted 04 December 2008 - 08:28 AM

Well, sure it looks nicer than before. But Chris, can you please bring back the line numbers features? Sometimes the OP doesn't know what went wrong with his code, so he would just post his entire code. Would be nice to be able to tell which line from his code is bad.

This post has been edited by red_4900: 04 December 2008 - 08:28 AM

Was This Post Helpful? 0
  • +
  • -

#15 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Code Syntax

Posted 04 December 2008 - 08:46 AM

On the topic of line numbers, this script doesn't natively support line numbers because it handles the highlighting differently. The old script would hang the page while it re-write the DOM to add line numbers and that is one of the reasons I switched was to eliminate the page lag/hanging. There are some attempts to integrate line numbers and I'll try them out, but they don't look promising, especially for our implementation.

I'm not out in the trenches like you guys, but if a user posts just a portion of their code, the line numbers in their errors, don't line up with the line numbers in the [code] tags.

The benefits of this new highlighter are:

- Faster loading pages
- ALL code gets highlighted, no matter if it's a [code] or [ code=language ] tag.
- It works in the blogs
- It doesn't cause page hang issues

The drawbacks:

- Logic for highlighting not as advanced
- No line numbers

I might be able to get the copy/paste, view plain behavior working, but let me investigate how the old script did it.

I know the line numbers were helpful, but does the benefit of having all code highlighted outweigh not having line numbers for right now?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2