Syntax Highlighting Suggestion

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Why don't you use this syntax highlighter? It has Expand/Contrast feature, support for 140 languages (many of which you don't really need), when it is numbered you will see numbers when you copy paste, but there is an option to download the code which gives you the code without numbers.

It won't give numbers if the text is not numbered... but if it's numbered or not, it is determined by the poster (it doesn't create two instances of the thing like has being mentioned before.

If you want to check it out you can see my forum's post on it... I think it works great.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I have already implemented the new syntax highlighter, and it was actually based on the one above that you mentioned, although I still made numerous changes to it to get it to be exactly how I wanted. If you look in the credits section of that mod's installation file you will see "Bigwebmaster" in it as I helped him fix some bugs that I found:

Quote:
Thanks are due to:
CyberAlien - for releasing the original BBCode parser to the public.
baboon - for (at time of posting this) a part complete Spanish translation
mrbaseball34 - for the idea to use the language as a BBCode tag
Bigwebmaster - for pointing out some errors I'd missed... and the fact that 'debug mode' is there for a reason.


Here are a few screenshots of it on the new version of ozzu:

Attachments:
python.png

Attachments:
python2.png


Once you get over 15 lines of code the expand / contract link will turn on as well. That isn't shown in the above screenshots.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Oh, awesome! How did you get the optional Line Numbers there?

If it doesn't make you feel like you are giving away stuff, could you tell me how to do that on my forum?

Thanks for your hard work... really makes this forum rock! :D
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I really don't have a modification file for it. I completely ripped apart hook_syntax_highlighter.php hardcoding many items, and redid the javascript files and CSS files that came with the mod. Mine are completely different and hardcoded to work with ozzu. I did it that way because I did not plan to release it in a way for others to use. However, those are the areas you need to play with if you want to customize the output and add new features such as the toggling of line numbers. I viewed the source on this page:

http://book.cakephp.org/view/829/The-App-Controller

Which uses a different syntax highlighter to make the line numbers to show and dissappear when you click on the "Plain text view" and "Code View" link. They basically post the same code twice, one inside a ordered list and the other inside a div and then create some javascript to hide one and show the other every time the link is clicked. I based the idea off of that as in the past when I did it all I used was javascript to try and rewrite the entire code and that was just full of all sorts of bugs because it was so complicated.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Thanks... I'll play around with that.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.