Forum code causing problems with programming code

Posted by Zeno on Sun 09 May 2004 08:59 PM — 10 posts, 27,067 views.

USA #0
Eh, here's what I mean. I use {code} to start it, but in the code is {i} like this:

title_table[index]{i}[0] = str_dup( "Not set." );

So it reads it as italics. If there isn't a way already, can you create a way to somehow fix this?

Note, I changed [ to { etc.
Amended on Sun 09 May 2004 09:00 PM by Zeno
USA #1
Just do this:

\[i\]testing\[/i\]

[i]this is not italics[/i] this is italics
Amended on Mon 10 May 2004 04:41 AM by David Haley
USA #2
the purpose of the code tag is so that you can simply paste something, and have the forum not evaluate it. So you dont need to escape things.

So, they shouldnt be bolded, italicized, or underlined for that matter.

At least, thats how I understand it should work nick. Since the purpose of posting code is to display. I suppose you could also argue that allowing bold and such allows you to emphasise parts of your code.

However, you could also just use non coded. Although that doesnt preserve spaces.

Perhaps we could have a "literal" code nick? Monospaced, preserves spaces, and stops all other evaluation? That would be the only real way to do it I suppose.
Amended on Mon 10 May 2004 04:55 AM by Flannel
USA #3
Personally I would rather keep code as it is, and put in a "literal" tag as you suggested. I like being able to emphasize parts of my code if need be, even if I admit that it can be irritating sometimes to have to go in and change the \[i\] arrays. :)
Australia Forum Administrator #4
At present, for simplicity, the forum codes are simply replaced on a case-by-case basis. For instance, every instance of [b] becomes <b> (ie. becomes HTML).

Thus, [code] becomes <pre><code> (I think). It does not easily recognise that stuff is *inside* a code block. To convert existing code use the "quote forum codes" command in the MUSHclient notepad, that will convert a batch of code in a single operation.
USA #5
Ah, makes sense. But the problem is, if I post a large code, and it has many [i] in it, I'd have to edit them all.
Amended on Mon 10 May 2004 11:23 AM by Zeno
Canada #6
That what Nick was refering to. The quote forum code function in mushclient will do that all for you automatically. You paste in your raw code, and it adds the \[i\] for you.
USA #7
But the thing is, not everyone has MUSHclient, and not everyone is willing to get it just for using that function. But thats just my thought.
Australia Forum Administrator #8
Well, you could get it for that purpose, and wait for the nag screen to timeout, and then leave it running.

Another alternative is to simply use any editor to replace:


\ with \\
[ with \[
] with \]


Some editors would let you script a simple replacement like that.
USA #9
Yeah such as UltraEdit. But there's no way to have HTML/php/cgi do that here? It could be useful for some people I guess.