Author Topic: codebox/syntaxhighlighter  (Read 11273 times)

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
codebox/syntaxhighlighter
« on: March 01, 2012, 02:43:49 AM »
Hi,

I've added a plugin for tinymce so it has a "code" box. So the box  works and such. But now I want to add the highlighting part.

For that i need to load scripts and stylesheets.
Example:
Code: [Select]
<script type="text/javascript" src="syntaxhighlighter_3.0.83/scripts/shCore.js"></script>
<link type="text/css" rel="stylesheet" href="syntaxhighlighter_3.0.83/styles/shCoreDefault.css"/>

<script src="syntaxhighlighter_3.0.83/scripts/shAutoloader.js" type="text/javascript"></script>
<script type="text/javascript">
SyntaxHighlighter.autoloader(
'applescript syntaxhighlighter_3.0.83/scripts/shBrushAppleScript.js'
'as3 syntaxhighlighter_3.0.83/scripts/shBrushAS3.js'
'bash shell syntaxhighlighter_3.0.83/scripts/shBrushBash.js'
'coldfusion syntaxhighlighter_3.0.83/scripts/shBrushColdFusion.js'
'cpp syntaxhighlighter_3.0.83/scripts/shBrushCpp.js'
'csharp syntaxhighlighter_3.0.83/scripts/shBrushCSharp.js'
'css syntaxhighlighter_3.0.83/scripts/shBrushCss.js'
'delphi syntaxhighlighter_3.0.83/scripts/shBrushDelphi.js'
'diff syntaxhighlighter_3.0.83/scripts/shBrushDiff.js'
'erlang syntaxhighlighter_3.0.83/scripts/shBrushErlang.js'
'groovy syntaxhighlighter_3.0.83/scripts/shBrushGroovy.js'
'javafx syntaxhighlighter_3.0.83/scripts/shBrushJavaFX.js'
'java syntaxhighlighter_3.0.83/scripts/shBrushJava.js'
'js jscript javascript syntaxhighlighter_3.0.83/scripts/shBrushJScript.js'
'perl syntaxhighlighter_3.0.83/scripts/shBrushPerl.js'
'php syntaxhighlighter_3.0.83/scripts/shBrushPhp.js'
'plain syntaxhighlighter_3.0.83/scripts/shBrushPlain.js'
'powershell syntaxhighlighter_3.0.83/scripts/shBrushPowerShell.js'
'python syntaxhighlighter_3.0.83/scripts/shBrushPython.js'
'ruby syntaxhighlighter_3.0.83/scripts/shBrushRuby.js'
'sass syntaxhighlighter_3.0.83/scripts/shBrushSass.js'
'scala syntaxhighlighter_3.0.83/scripts/shBrushScala.js'
'sql syntaxhighlighter_3.0.83/scripts/shBrushSql.js'
'vb vbs vbscript syntaxhighlighter_3.0.83/scripts/shBrushVb.js'
'xml syntaxhighlighter_3.0.83/scripts/shBrushXml.js'
);
SyntaxHighlighter.all();
</script>

But the problem is,  these scripts and stylesheets are not loaded inside the content/dijit.TitlePane boxes.
So basically syntax highlighting will work if only i could get "content.php?contentid=111" to also load those javascripts and stylesheets.

Code: [Select]
</div><div class="ContentItem" id="contentid_111" oncontextmenu="KnowledgerootMenu.show('mousemenu','contentcontext', 14, 111); return false;">

                                        <!-- anchor --><a name="111"></a>
                                        <div class="showMe" style="display:none;" dojoType="dijit.TitlePane" title="<b></b>" open="false" href="content.php?contentid=111">
</div>

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #1 on: March 01, 2012, 02:44:39 AM »
attaching the patch to give tinymce a code/syntaxhl button.

Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #2 on: March 01, 2012, 12:48:22 PM »
Hi,

i will check this. Hopefully today ;)

Some questions:
Where is the homepage for this syntaxhighlighter?
Where can i download it?
What license uses this addon?

regards,
Frank

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #3 on: March 01, 2012, 05:57:55 PM »
https://github.com/RichGuk/syntaxhl
It uses LGPL, you can see in my patch how it should be installed and what files needs to be modified.
Well actually I did a bit of overkill. You don't need textarea[cols|rows|disabled|name|readonly|class], you only need to add pre[brush] in the extended_valid_elements.

It uses http://alexgorbatchev.com/SyntaxHighlighter/ as a highlighter, which also must be installed and setup. Currently this is my problem. It uses css and js. Which doesn't get inherited on the "content pages".

Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #4 on: March 02, 2012, 05:30:47 PM »
Hi,

i have tested the first things.
By synataxhighlighting does not work at the moment.
I need to check why.

My envisage is to have an seperate extension for that.

Frank

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #5 on: March 05, 2012, 09:05:22 PM »
Maybe you could ask the dojo community on how to solve this? As I said, I believe it is because the content pages does not inherit the <head> data such as javascripts...

Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #6 on: March 05, 2012, 11:51:39 PM »
Hi,

ok. It works for me now.
It has nothing todo with dojo ;)

So next step is to create an own extension.
I will inform you if i have more news.

regards,
Frank

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #7 on: March 05, 2012, 11:58:44 PM »
Great, I can't wait :)

But you can have the "codebox" as default in tinymce and have the "highlight" part as an extension.

Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #8 on: March 06, 2012, 10:34:51 PM »
Hi,

for first testing you could download and install the two extensions from here:
http://downloads.lordlamer.de/knowledgeroot/ext/

I am waiting for your feedback.

Frank

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #9 on: March 06, 2012, 10:41:54 PM »
Should I undo my own changes that I've done to tinymce first?

Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #10 on: March 06, 2012, 10:48:11 PM »
Hi,

try to rename/backup your existing tinymce extension :)
A complete backup is also nice ;)

Frank

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #11 on: March 06, 2012, 11:11:10 PM »
Codebox works.

Syntax Highlighter does not.
I get error messages like this when Page does have "Initially show all content on this page collapsed?" checked.

Code: [Select]
SyntaxHighlighter
Can't find brush for: ruby

Code: [Select]
SyntaxHighlighter
Can't find brush for: ruby

When it is not checked, it does not display any errors, nor does the syntax highlighting work.

EDIT: missconfusion :)(:

Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #12 on: March 06, 2012, 11:13:24 PM »
Hi,

yes ;)
I only added php and js for testing first.
I will enable the others later.

Frank

Offline Raboo

  • User
  • *
  • Posts: 21
    • View Profile
    • LetIT Hosted Exchange
Re: codebox/syntaxhighlighter
« Reply #13 on: March 06, 2012, 11:19:53 PM »
Ok, php and js work :)
There is a autoloader function.. that loads only the needed brushes I  believe.

Anyway, you did this codebox on the old tinymce.. 3.4.2 and not 3.4.8 :(
Also the syntaxhighlighter does not work when content are collapsed.




Offline admin

  • Administrator
  • User
  • *****
  • Posts: 688
    • View Profile
    • http://www.lordlamer.de
Re: codebox/syntaxhighlighter
« Reply #14 on: March 06, 2012, 11:32:39 PM »
Hi,

ok. But we are on the right way :)

I will try to fix the problems and will let you know if i am finished.

Frank