Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Syntax Highlighted [code] Tag  (Read 4524 times)

0 Members and 1 Guest are viewing this topic.
Syntax Highlighted [code] Tag
« on: January 04, 2010, 05:19:10 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
I just finished the work on an SMF mod to add syntax highlighting, compatible with SMF 1.1.x and 2.0 RC2 (probably RC1 as well, but I didn't bother testing), that works through client-side javascript, and I think it would be a nice addition to the forums.

It uses SHJS for the syntax highlighting, using a modified version of the Acid theme, and supports a good number of languages, and I'm working to create language definition files for GML and TorqueScript.

Anyway, a sample can be seen at http://minalien.com/shtest/index.php?topic=1, and I doubt it will have problems with the mods and work that has been done on ZFGC's templates. If it does, it'll be a trivial thing for me to get with somebody with access to add the single command to the template that'll call the necessary javascript & css files.

If you're good with it, I'll send it to whoever is going to do the installing. It works through SMF's package system, so there wont be problems there. I'm not releasing it publicly until I finish working up the Readme file and submit it to SMF's mod site.

Oh, and for people who support this:
Go to http://shjs.sourceforge.net/
On the right, preview some of the themes
Tell me which you prefer. The demo I put up shows the Acid theme, which I chose mostly because I didn't feel like searching through the rest, and nedit sucks.

Supported Languages:
Bison
C
C++
Diff
Flex,
GLSL
Haxe
HTML
Java
Java Property files
JavaScript
JavaScript w/DOM extensions
LaTeX
LDAP
Log files
M4
Makefiles
Objective CAML
Oracle
Pascal
Perl
PHP
Prolog
Python
Ruby
S-Lang
Scala
Shell
SQL
TCL
XML
Xorg conf files
« Last Edit: January 23, 2010, 06:58:53 pm by MiNalien »
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog
Re: Syntax Highlighted [code] Tag
« Reply #1 on: January 04, 2010, 05:29:03 pm »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1767
Very nice, and a very good idea. It'll definitely be a great addition to the forum here. I'll probably add it to my forum as well once it's public. Good work.  ;)
Logged
  • https://colbydude.com

Mamoruanime

@Mamoruanime
Re: Syntax Highlighted [code] Tag
« Reply #2 on: January 04, 2010, 05:35:01 pm »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Add Blitz and I'm sold!

(lol j/p; awesome work)
Logged
Re: Syntax Highlighted [code] Tag
« Reply #3 on: January 04, 2010, 05:39:00 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Already working on the next version, which I plan to have the following:

Admin CP
Select a default theme and default language (default language for code tags missing a language parameter)
Allow/Disallow users to select their own themes
Upload new CSS theme files

User CP
(When enabled) selecting syntax highlighting theme

But yeah, that'll be a while, because I'm too lazy and I have to re-learn most of the internal workings of SMF, since I haven't done it in ages. By a while I mean it'll probably never be finished, unless the mod's well-received by the SMF community.

Add Blitz and I'm sold!
Give me a definitive list of keywords, data types, operators, special characters, the comment delimiter, preprocessors, built-in functions that would be good to add, etc. and I'll think about it.
« Last Edit: January 04, 2010, 05:46:13 pm by MiNalien »
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog
Re: Syntax Highlighted [code] Tag
« Reply #4 on: January 04, 2010, 08:17:51 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
That seems really kind of awesome, although for it to be used on the forum it'd be even better if it had GML or Game Maker Language syntax. That is not so much advocacy for GML's use but a realistic observation that a lot of what would be posted in code tags here would be written in it. If you're interested the list of function names, I attached the fnames which contains functions, constants (marked with #), read-only variables (marked with *), etc.

Then again though there are probably some parts not included in that file; what comes to mind would be something like "var", "if", "else", "and", "xor", etc. that just get bolded. Otherwise the syntax is pretty similar to something like C++.
Logged

Mamoruanime

@Mamoruanime
Re: Syntax Highlighted [code] Tag
« Reply #5 on: January 04, 2010, 08:41:14 pm »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I don't imagine the actual script for the highlighting is difficult to modify though. I think more of what Ken's posting is a tag that pulls from the script here: http://shjs.sourceforge.net/. I imagine that if we installed the mod we could change the script itself :P
Logged

DJvenom

super-sage
Re: Syntax Highlighted [code] Tag
« Reply #6 on: January 05, 2010, 01:08:33 am »
  • Colbydude was here.
  • *
  • Reputation: +7/-0
  • Offline Offline
  • Gender: Female
  • Posts: 2898

NEEEEEERRRRRD!!!!
Logged
I do art
I ermmm... DID do art
I do art
Re: Syntax Highlighted [code] Tag
« Reply #7 on: January 05, 2010, 04:33:28 am »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119

NEEEEEERRRRRD!!!!
D:

I don't imagine the actual script for the highlighting is difficult to modify though. I think more of what Ken's posting is a tag that pulls from the script here: http://shjs.sourceforge.net/. I imagine that if we installed the mod we could change the script itself :P
Nothing is pulled from there - SHJS is included with the mod and is what powers it. The highlighting scripts are a bit more complex than usual syntax highlighters in that I have to define it with a file full of regex operations; in fact, it's exactly the same as creating a language for GNU Source-Highlight. Honestly, though, there is a different syntax highlighter that is simpler to implement new languages for, and was what I originally worked on for this mod. I'm going to jump back to working with that one, however, since I found out how to fix some of the issues I was having, and so I'll update when I have that one working. It looks sexier, too.
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog
Re: Syntax Highlighted [code] Tag
« Reply #8 on: January 05, 2010, 06:34:28 am »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Alright, got the new version working with SMF 2 - time to port it to SMF 1.x, and all should be good. This one will be a bit more difficult to bring into ZFGC, though, because I'm sure the template footer has changed a good bit. I'll need to get with Andrew or somebody so that I can make sure it all plays through well with Tim's wonky theme work.

New version can be previewed here: http://www.learn-torque.com/index.php?topic=1

I'll edit this message when I get the preview up on SMF 1.x

SMF 1.1.x port finished, can be seen at http://minalien.com/shtest/index.php?topic=1

Languages already supported:
Bash
C++
C#
CSS
Delphi
Groovy
Java
JavaScript
PHP
Python
Ruby
Scala
SQL
VisualBasic
XML

Working on:
BlitzBasic
GML
TorqueScript
« Last Edit: January 05, 2010, 09:17:36 am by MiNalien »
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

benjamin.richter

Re: Syntax Highlighted [code] Tag
« Reply #9 on: January 22, 2010, 03:38:20 pm »
Any chance I could get your highlighter version for my SMF 2.0RC2 Forum?
Would really like to try it out.
Logged
Re: Syntax Highlighted [code] Tag
« Reply #10 on: January 23, 2010, 06:56:45 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
I suppose so. Give me a couple minutes and I'll upload the mod package to this post.

--Attached to First Post--

NOTICE: I will not be maintaining or doing any further updates to this mod. With the recent drama within SMF, I am going to be stepping toward other forum systems, possibly back to Invision Power Boards, which I particularly like due to its object-oriented source code.
« Last Edit: January 23, 2010, 06:59:21 pm by MiNalien »
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.047 seconds with 57 queries.