[SOLVED]Syntax highlighter inside [code][/code] tags

What it says on the tin: a place to discuss proposed new features.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by jacmoe » Mon Jan 31, 2011 6:42 pm

And how should the forum display those attachments?
I am too lazy to be opening archives..

Download the highlight.js package and take a look at the language folder. It seems to be easy enough.
I plan to add support for Ogre classes/functions when/if I have time.
If one is not beating me to it.
You can just attach it here, or send it to me by PM.
I need to rebuild our packed script, though. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by betajaen » Mon Jan 31, 2011 6:58 pm

Test

[Edit]

Urgh, I thought the server would just show it when you clicked on it. Mime type problem?
Attachments
Ogre.log
(8.24 KiB) Downloaded 176 times
0 x

User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4293
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 2
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by spacegaier » Mon Jan 31, 2011 7:26 pm

No, I think that's the common behavior: Download :) .
0 x
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by betajaen » Mon Jan 31, 2011 7:35 pm

But I've seen websites properly give out the mime type before, the browser knows what it is and just displays it in the browser as a text file.

[Edit]

For example; This website gives out the right mime type for files - Click any .c file and the browser receives a "text/plain" plain mime type for which the browse just shows it. It also shows when it does not (Makefile).
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by jacmoe » Tue Feb 01, 2011 7:32 pm

xavier wrote:Highlighting time isn't horrible. Hightlighting all the numbers is distracting.
I missed your post, Xavier. :)
I will see if I can implement a log parser.
I'll do some tests and then I need to re-pack the highlighter once it works.
Need to find out how to do this routine anyway in case someone wants to contribute Ogre script parsers and additional Ogre keywords for the cpp parser.

The beauty of this highlighter is that it cost next to nothing on the server.
And it's definitely among the fastest on the client.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by jacmoe » Tue Feb 01, 2011 8:34 pm

Code: Select all

21:59:58: Creating resource group General
21:59:58: Creating resource group Internal
21:59:58: Creating resource group Autodetect
21:59:58: SceneManagerFactory for type 'DefaultSceneManager' registered.
21:59:58: Registering ResourceManager for type Material
21:59:58: Registering ResourceManager for type Mesh
21:59:58: Registering ResourceManager for type Skeleton
21:59:58: MovableObjectFactory for type 'ParticleSystem' registered.
21:59:58: OverlayElementFactory for type Panel registered.
21:59:58: OverlayElementFactory for type BorderPanel registered.
21:59:58: OverlayElementFactory for type TextArea registered.
21:59:58: Registering ResourceManager for type Font
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by jacmoe » Tue Feb 01, 2011 8:38 pm

Now I hacked the message parser so that it changes the code tag to code=off if you put an Ogre log in it.
Hopefully.
It checks if the contents of the tag contains text like this:

Code: Select all

00:00:00:
That's two digits and a semicolon three times in a row.
That ought to take care of the problem. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Zonder
Ogre Magi
Posts: 1133
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 22

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by Zonder » Tue Feb 01, 2011 11:19 pm

nice work :)

I agree it definatly should be on as default with cpp
0 x
There are 10 types of people in the world: Those who understand binary, and those who don't...

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by jacmoe » Tue Feb 01, 2011 11:47 pm

I can do that by checking if the language parameter is missing, just as I check if the contents is an Ogre log.
That means that if you submit a post with a code tag using no parameters, the board will sneakily change it to code=cpp.
If that's okay with you guys, I'll do that change. :)
So if it's a log it becomes code=off, otherwise it becomes code=cpp.
That should take care of it.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Zonder
Ogre Magi
Posts: 1133
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 22

Re: [SOLVED]Syntax highlighter inside [code][/code] tags

Post by Zonder » Thu Feb 03, 2011 2:36 pm

that seems ok to me since I can't really remember much else been posted other than those two. And if somthing shows up that is really bad I am sure a mod can change it :)
0 x
There are 10 types of people in the world: Those who understand binary, and those who don't...

Post Reply