I see a potential problem with the new format regarding code tags. Before, you had the option of doing this:

[code]
// paste code here - Courier-style fomatting, multiple spaces allowed, but no line numbers or syntax highlighting.
[/code]

or this:

[code=cplusplus]
// paste code here - Courier-style fomatting, multiple spaces allowed, line numbers and syntax highlighting.
[/code]

Both had their place. Very often I would choose to use the non-syntax specific code tags since I wanted to highlight something in red or because something was pseudocode rather than code and I didn't want the syntax highlighting, or it perhaps wasn't code at all, but I wanted something that would preserve the spacing and [quote] tags wouldn't do because they tend to disappear when replying to replies.

This option has apparently disappeared. When you type in:

[code]
[/code]

if you are in the C++ forum, you get the line numbers and syntax highlighting. I just posted on a new thread, saw it was happening, and changed it. But you have a whole bunch of old posts that look bad now, like this one: http://www.daniweb.com/forums/post965858-19.html

You get stuff like this now:

<span style="color:Red">cout << "i = " << i << " Decrementing lCount\n"; </span>

coupled with instructions to look at the red line, which is no longer red.

Any way we can change back to the old way, without automatic language-specific syntax highlighting, or at least only make it automatic when parsing NEW threads?

This ended up being a bug. I haven't yet had a chance to go over the new functionality of the code tags with everyone yet, but basically they are smart enough to know that if you're trying to use bbcode, don't force a language.

Seems to parse fine if you go to the entire thread and read it, but not if you click on a particular post within the thread:

http://www.daniweb.com/forums/post965858.html

Go to thread 19 in the thread in this post and it parses with the non-language-specific code tags. Click on the post itself though, as I did when linking the first post on this thread, and language-specific code tags are added. The same post is parsed differently.

Cache cleared :)

The one I listed now works, but the problem remains for others, like this random thread I picked from the C++ forum just now.

http://www.daniweb.com/forums/thread220826.html

Same behavior as the prior thread I listed. See post 4. Code is in non-specific code tags and parses as such when viewing the full thread, but if you view it as a single thread and it parses to C++ syntax tags. I hit "Reply with quote" to see the underlying post and it was [code]

[/code] not [code=cplusplus] [/code].

That post was created while I was in the middle of fixing things so its cache got screwed up. Have a LOT on my plate right now so going to finish everything and then clear the cache one last time.

I'm still noticing in the C++ section that [code]

[/code] is adding line numbers and saying "C++ Syntax". It's not supposed to do that, correct?

I'm still noticing in the C++ section that [noparse][code][/code][/noparse] is adding line numbers and saying "C++ Syntax". It's not supposed to do that, correct?

You can get around that behavior. Take a look at this post.

Yeah, I just tried that in the C++ forum. Tried to post this:

[code][B][/B]./calcAverage 5 8 1 4[/code]

It added the C++ code tags, I would imagine since there's nothing to be bolded. Stick an empty space in between the Bold tags and that has no effect. Stick a printable character in between the Bold tags and it has the effect you mentioned. What if you want nothing bolded, as I did not?

I like it better the old way, where nothing was assumed and language-specific code tags were added only at the poster's option. Gives you more control of the post. Worse, the changes are retroactive. Posts prior to the change have the syntax added where it wasn't intended. I'm seeing it all over the place. Here's one of my old threads, chosen at random, See the bottom part of post 1. Syntax has been added where none was intended, so it doesn't look very good.

http://www.daniweb.com/forums/thread147949.html

Can pre-change posts at least no longer be parsed this way? Check the post date and see if it was pre-change and parse it differently based on that?

You can do

to disable syntax highlighting completely:
[code=text]./calcAverage 5 8 1 4

Anyway, I'm not digging the way these new code tags are handling things. They're not even backwards compatible with the old language tags (cplusplus, csharp, etc), and there were A LOT of posts that used code tags for stuff that wasn't 'code' (or wasn't the language of the forum). Thanks to the new parsing method, all these posts are going to be screwed up as VernonDozier mentioned.

The way I found best is by putting a dot between the [b].[/b] tags. So the following is an example of what your code should have looked like:

[code][B].[/B]/calcAverage 5 8 1 4[/code]

Yeah, I guess no one will notice a bold dot, so there are workarounds. I think it would be better to go back to the old way where nothing was assumed and you had to make it explicit.

You can do [code=text] to disable syntax highlighting completely:
[code=text]./calcAverage 5 8 1 4[/code]

Thanks. I hadn't realized this. Good to know.

They're not even backwards compatible with the old language tags (cplusplus, csharp, etc)

"Old" language tags? I remember about a year ago being told not to use [code=C++] when I was using it, but to use [code=cplusplus] instead. Are we not using [code=cplusplus] anymore? And if so, what are we supposed to use now? C++? CPP? cplusplus still seems to work.

These threads should probably be updated to explain the new rules in detail.

http://www.daniweb.com/forums/misc-explaincode.html
http://www.daniweb.com/forums/announcement8-3.html

>Are we not using anymore? Nope. Apparently, now we're supposed to be using the name of the forum (for example, [code=c++], [code=c#], etc.).

>cplusplus still seems to work. That's the thing. If you specify an "invalid language", the syntax defaults to the language of the forum. Which means that, for example, if I had posted code with the [code=cplusplus] tag in the Java forum (perhaps to illustrate differences in the language), the code will now be highlighted as Java. Which I find completely ridiculous.[code=cplusplus] anymore?
Nope. Apparently, now we're supposed to be using the name of the forum (for example, , [code=c#], etc.).

>cplusplus still seems to work. That's the thing. If you specify an "invalid language", the syntax defaults to the language of the forum. Which means that, for example, if I had posted code with the [code=cplusplus] tag in the Java forum (perhaps to illustrate differences in the language), the code will now be highlighted as Java. Which I find completely ridiculous.[code=c++], , etc.).

>cplusplus still seems to work. That's the thing. If you specify an "invalid language", the syntax defaults to the language of the forum. Which means that, for example, if I had posted code with the [code=cplusplus] tag in the Java forum (perhaps to illustrate differences in the language), the code will now be highlighted as Java. Which I find completely ridiculous.[code=c#], etc.).

>cplusplus still seems to work.
That's the thing. If you specify an "invalid language", the syntax defaults to the language of the forum. Which means that, for example, if I had posted code with the tag in the Java forum (perhaps to illustrate differences in the language), the code will now be highlighted as Java. Which I find completely ridiculous.[code=cplusplus] tag in the Java forum (perhaps to illustrate differences in the language), the code will now be highlighted as Java. Which I find completely ridiculous.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.