RSS Forums RSS
Please support our DaniWeb Community Feedback advertiser: Programming Forums
Views: 1552 | Replies: 14 | Thread Tools  Display Modes
Reply
Join Date: Dec 2005
Posts: 4,220
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 26
Solved Threads: 493
Colleague
Salem's Avatar
Salem Salem is offline Offline
Industrious Poster

Language and colour tags

  #1  
Nov 7th, 2007
If I leave the language out of the code, then I can use colour just fine, like so
printf("%d. file has been created\r",i);
fflush(stdout);

But if I add a language, say 'c', then it all goes pear shaped and the colour tags are no longer parsed.
  1. printf("%d. file has been created[color="Red"]\r[/color]",i);
  2. fflush(stdout);
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,115
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Rep Power: 33
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Language and colour tags

  #2  
Nov 7th, 2007
That's the intended behaviour. When using language-specific tags, snippets are already color-coded. If you want to point out something specific, refer to it by line. If you absolutely have to point something out via color, use non language specific tags.
Dani the Computer Science Gal
Reply With Quote  
Join Date: Aug 2005
Posts: 4,844
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 325
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: Language and colour tags

  #3  
Nov 7th, 2007
Exactly.

I thought that was blatantly obvious.

I mean if you tagged something as red with c++ code tags it would hardly stand out amongst the other mix of colours.
Last edited by iamthwee : Nov 7th, 2007 at 1:45 pm.
*Voted best profile in the world*
Reply With Quote  
Join Date: May 2006
Posts: 2,814
Reputation: WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold 
Rep Power: 16
Solved Threads: 240
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Maven

Re: Language and colour tags

  #4  
Nov 7th, 2007
One possibility to consider is to allow BOLD and ITALIC using language-specific tags. Just a thought.
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,115
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Rep Power: 33
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Language and colour tags

  #5  
Nov 7th, 2007
Bold and italic tags are already being used with the language-specific tags for specific keywords. For example, in the line
  1. printf("%d. file has been created\r",i);
the word "printf" is actually in bold in contrast to the rest of the line. However, bold font is hard to distinguish in Courier New (or any fixed width font, for that matter). In fact, when I was very anti-color, and before we had syntax-specific code tags, the reason I conceded to allowing color was because people pointed out that bold and italic tags were not doing a good enough job pointing out specific lines in code.
Last edited by cscgal : Nov 7th, 2007 at 2:27 pm.
Dani the Computer Science Gal
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,600
Reputation: John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all 
Rep Power: 17
Solved Threads: 286
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: Language and colour tags

  #6  
Nov 8th, 2007
Wouldn't it be better if your parser at least removed the color tags from syntax-highlighted code? Some people aren't aware that color tags don't work in syntax-highlighted code tags (or they paste it from their editor, which for some reason has the code all colored), and then all we see is a bunch of BBCode crap.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: May 2006
Posts: 2,814
Reputation: WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold 
Rep Power: 16
Solved Threads: 240
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Maven

Re: Language and colour tags

  #7  
Nov 8th, 2007
Originally Posted by joeprogrammer View Post
Wouldn't it be better if your parser at least removed the color tags from syntax-highlighted code? Some people aren't aware that color tags don't work in syntax-highlighted code tags (or they paste it from their editor, which for some reason has the code all colored), and then all we see is a bunch of BBCode crap.

Nyah. If they want to screw up their code and post without a PREVIEW, let them. We just don't have to read it since they didn't care enough to verify their post.
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,115
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Rep Power: 33
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Language and colour tags

  #8  
Nov 9th, 2007
What if someone wants to type code that uses the [param=value] format? If someone types [x=y] in their code it should be stripped?
Dani the Computer Science Gal
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,600
Reputation: John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all 
Rep Power: 17
Solved Threads: 286
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: Language and colour tags

  #9  
Nov 9th, 2007
Originally Posted by cscgal View Post
What if someone wants to type code that uses the [param=value] format? If someone types [x=y] in their code it should be stripped?

Well, you would only strip [color=xxx], [b], [i], etc. And considering that it would be parsed anyway if they had just used a normal [code] tag, what difference does it make?
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,115
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Rep Power: 33
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Language and colour tags

  #10  
Nov 9th, 2007
Because this way people have a method for when they NEED to use such things in their code. If both code methods stripped them, they'd be SOL to display any code in bbcode format.
Dani the Computer Science Gal
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the DaniWeb Community Feedback Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:52 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC