Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Fun [code] tags!

Fun [code] tags!
Thread Tools
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 31, 2001, 10:22 AM
 
Test...

<pre><font size = 1 face = courier>
<font color = green>int</font> <font color = green>void</font> <font color = purple>id</font>
</font></pre>

[This message has been edited by parallax (edited 05-31-2001).]
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 31, 2001, 11:36 AM
 
Yee-haw.

Anyway, I added stuff so [ code ] tags now color C/ObjC-keywords, numbers, comments, &c. Removies smilies from within [ code ] tags.
<pre><font size = 1 face = courier>
Like this&#58;
-&#40;<font color = green>void</font>&#41;method&#58;&#40;<font color = green>int</font>&#41;param
{
<font color = green>int</font> a;
}
</font></pre>
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
May 31, 2001, 12:54 PM
 
Lemme try:

<pre><font size = 1 face = courier>- &#40;<font color = green>int</font>&#41;coolMethod
{
<font color = green>return</font> [<font color = purple>self</font> coolMethod];
}</font></pre>

EDIT: Wow, spiffy Good work parallax.

------------------


[This message has been edited by mr_sonicblue (edited 05-31-2001).]
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
May 31, 2001, 01:32 PM
 
One problem is that it doesn't seem to like edits. The thing is, if you put some code in, and then you found you made a mistake (wrote maine instead of main or something), you have to go back and repaste all the code because HTML isn't allowed in these forums.

Any ideas on how to solve the parsing problem?

And if I'm completely wrong, feel free to yell at me in formatted Obj-C code.

------------------
the oddball newsletter
------------------
it's only after you lose everything that you're free to do anything
The gem cannot be polished without friction, nor man perfected without trials.
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
May 31, 2001, 01:39 PM
 
All you have to do is move the UBB-to-HTML code to where the forum thread is generated (which is where [B], [I], [URL], etc are converted).

------------------
     
tie
Professional Poster
Join Date: Feb 2001
Status: Offline
Reply With Quote
May 31, 2001, 01:48 PM
 
oops, <pre><font size = 1 face = courier>int, <font color = purple>self</font>, <font color = purple>YES</font>, <font color = purple>NO</font>, <font color = green>null</font>, <font color = green>nil</font>, <font color = green>void</font>, boolean, <font color = purple>BOOL</font>, <font color = green>return</font>, <font color = purple>self</font>, this, <font color = green>static</font>, public, private, protected, @public</font></pre>

[This message has been edited by tie (edited 05-31-2001).]
The 4 o'clock train will be a bus.
It will depart at 20 minutes to 5.
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 31, 2001, 03:27 PM
 
Wasn't anticipating edits.

All I really have to do is add one or two things... I'll do that today.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 31, 2001, 03:39 PM
 
tie raises a good point. I was going to include C++ keywords, but I realized that I didn't know them all :-)

List any keywords that you feel may have been missed. They're easy to add.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
May 31, 2001, 05:09 PM
 
That rules, will make things much easier in the forums.


<pre><font size = 1 face = courier><font color = green>int</font></font></pre>

[This message has been edited by rwc9785 (edited 05-31-2001).]
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
May 31, 2001, 05:14 PM
 
That rules, will make things much easier in the forums.

int
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
May 31, 2001, 05:34 PM
 
parallax, another suggestion.

Maybe you could set off the code with &lt;HR&gt; as it was done before in addition to the color/font change. I know that I always found it easier to notice it when it was set off with an indent within horizontal rules.

Anybody else like this? Or just leave it the way he's done it?

------------------
the oddball newsletter
------------------
it's only after you lose everything that you're free to do anything
The gem cannot be polished without friction, nor man perfected without trials.
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 31, 2001, 06:01 PM
 
Yeah, an &lt;HR&gt; or &lt;BLOCKQUOTE&gt; and something like "code:&lt;br&gt;" after it will make it easy to pick out when I convert HTML back to UBB.

Would you guys prefer an &lt;HR&gt; or a &lt;BLOCKQUOTE&gt;?

(Or any other ideas)
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
May 31, 2001, 06:22 PM
 
To make it easy to pick out for reverse conversion, just put "&lt;!-- START UBBER CODISH STUFINK --&gt; &lt;!-- END DINK CODIN --&gt;" around the generated HTML.

And I vote for &lt;UL&gt; (or &lt;BLOCKQUOTE&gt; ... but that indents the right edge as well, which decreases the usuable width by 2 times that of &lt;UL&gt; )

------------------
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
May 31, 2001, 10:38 PM
 
Try throwing in line breaks. If you don't want them too long, or want them a certain length use:
-------Start Code--------
-------End Code--------
or a simple image.
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 31, 2001, 11:41 PM
 
Thought I should give it a whirl..

<pre><font size = 1 face = courier>
#import &lt;Cocoa/Cocoa.h&gt;

@protocol SomeProtocol
- &#40;<font color = green>int</font>&#41;someNumber;
<font color = purple>@end</font>

<font color = brown>// ...</font>
#import <font color = red>"SomeProtocol.h"</font>

#define SOME_NUMBER <font color = blue>12</font>

<font color = purple>@interface</font> SomeObject &#58; NSObject &lt;SomeProtocol&gt;
{
}
- &#40;<font color = green>int</font>&#41;someNumber;
- &#40;<font color = green>int</font>&#41;anotherNumber;
<font color = purple>@end</font>

<font color = brown>// ...</font>
<font color = purple>@implementation</font> SomeObject
- &#40;<font color = green>int</font>&#41;someNumber
{
<font color = green>return</font> SOME_NUMBER;
}

- &#40;<font color = green>int</font>&#41;anotherNumber
{
<font color = green>return</font> <font color = blue>11</font>;
}
<font color = purple>@end</font></font></pre>
     
Moderator
Join Date: Sep 2000
Location: Irvine, CA
Status: Offline
Reply With Quote
Jun 1, 2001, 01:27 AM
 
Not bad. Not bad at all. I love the idea. I just posted something in the deveoper forum and I am rather impressed. Good work!
{{{ mindwaves }}}
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jun 1, 2001, 06:18 AM
 
Thanks mindwaves :-)
Yeah, I should add really @protocol to the list :-)

If you see any keywords you'd like added (like @protocol), just post 'em here.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jun 1, 2001, 08:38 AM
 
<pre><font size = 1 face = courier><font color = purple>@protocol</font> <font color = green>private</font> <font color = green>protected</font> <font color = green>public</font> <font color = green>this</font> <font color = green>boolean</font>
</font></pre>

Any others?
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jun 1, 2001, 02:17 PM
 
<pre><font size = 1 face = courier>#define, #include, #import, <font color = green>float</font>, <font color = green>short</font>, <font color = green>const</font>, <font color = green>char</font> // ...?</font></pre>

Looks good!
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jun 1, 2001, 11:18 PM
 
Hmm....

[This message has been edited by Synotic (edited 06-02-2001).]
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jun 1, 2001, 11:24 PM
 
This is<pre><font size = 1 face = courier><font color = red>"Interesting"</font></font></pre>.

[This message has been edited by Synotic (edited 06-02-2001).]
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jun 1, 2001, 11:33 PM
 
<pre><font size = 1 face = courier>This is a &lt;b&gt;test&lt;/b&gt;</font></pre>

[This message has been edited by Synotic (edited 06-02-2001).]
     
tie
Professional Poster
Join Date: Feb 2001
Status: Offline
Reply With Quote
Jun 2, 2001, 12:43 AM
 
<pre><font size = 1 face = courier>But when I type a really <font color = green>long</font> line it doesn't seem to wrap and just disappears off the side of the screen.</font></pre>

Edit: I can't seem to reproduce it here, but look in the "Need help changing icons in Nib" thread that I posted to for an example (in OmniWeb).

[This message has been edited by tie (edited 06-02-2001).]
The 4 o'clock train will be a bus.
It will depart at 20 minutes to 5.
     
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
Jun 2, 2001, 03:15 AM
 
[******* double post, sorry]

[This message has been edited by sadie (edited 06-02-2001).]
All words are lies. Including these ones.
     
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
Jun 2, 2001, 03:15 AM
 
<pre><font size = 1 face = courier>#define #include #import '<font color = green>char</font>'
java.lang.String?</font></pre>
All words are lies. Including these ones.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:09 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2