Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

syntax highlighter

edited August 2007 in Vanilla 1.0 Help
hi im looking for syntax highlighter for local developers forum. im trying GeshiColor 0.2 but doesnt work me with vanilla 1.1.2 and i dont know why... any idea ? or.. Do you know about other syntax highligter ? thank you ! (sry for bad english)
«1

Comments

  • There is Code prettify but it still has some IE7 bugs that I need to work out.
  • edited June 2007
    I don`t know how to use it ? or what ? :( it doesn`t highlighting syntax and i dont know why.i need any other extension ? i have no idea for example i add comment <code> <?php echo 'test'; ?> </code> and it added as normal text (i use firefox)
  • Yes, you need to also install the HTML Formatter
  • edited June 2007
    yes i have and i turn it. i post this code: <code> <strong>test</strong> </code> <code> <?php echo "test"; $variable=1; </code> as Html and syntax is not highlighted :/ check this screens http://blackhole.sk/~patoman/sh.png
  • my friend write me right now that "in opera works it" but i use firefox 2.0.0.4 and its doesnt work
  • It might be some kind of Javascript conflict with another extension... does it work here for you?
  • yes its work
  • edited June 2007
    Then its probably because something is set in the <body onload= tag... its set to be fixed in the next version, but I'm afraid I don't have much time to fix the problem now.

    Someone familiar with Javascript should be able to get it running.
  • edited June 2007
    update: its work but check this : http://blackhole.sk/~patoman/err.png imho bug is in this line : $text = preg_replace('/<(xmp|pre|code).*?<\/\\1>/se', 'str_replace("<br />", "\r\n", "\\0")', $text);
  • please help its important for me
  • edited July 2007
    i have no idea :[
  • please help. i dont found anything help anywhere :/
  • I have a new version in the works, fixes the IE linebreak bug, as well as some other highlight bugs but its not tested yet--and it still might have conflicts with other extensions, Userinfo Tooltip and CommentLinks are known to keep it from working properly. What extensions do you have installed?
  • Code Prettify 1.0
    Comment Links 1.3.2
    Forum Statistics 0.4.5
    GeshiColor 0.2
    Html Formatter 2.2
    Invite-Only System 0.3.0.a
    Members Page 1.2.1
    Notify 1.2.0
    Poll 1.3
    Quotations 1.6
    Who's Online 1.2
    Yellow Fade 0.1
    kses (X)HTML 0.4

    some of this are inactives ...
  • edited July 2007
    OK, Comment Links is probably what is keeping it from working.

    Inside extensions/CommentLinks/default.php, around line 53 you will see this: if ( strstr(strtolower($Context->BodyAttributes), 'onload=') ) { $Context->BodyAttributes = str_replace('onload="', 'onload="BaseUrl=\''. $Context->Configuration['BASE_URL'] . '\';DefaultFormat=\''. $Default . '\';InstalledFormats=Array('. $FormattersCSV . ');MenuTitle=\''. htmlentities($Context->GetDefinition('CommentLinks_Copy')) .'\';HideMenus();', $Context->BodyAttributes); } else { $Context->BodyAttributes .= ' onload="BaseUrl=\''. $Context->Configuration['BASE_URL'] . '\';DiscussionName=\''. htmlentities($Discussion->Name) . '\';DefaultFormat=\''. $Default . '\';InstalledFormats=Array('. $FormattersCSV . ');MenuTitle=\''. $Context->GetDefinition('CommentLinks_Copy') .'\';HideMenus();" '; }
    Cut all that out and replace it with this: $Head->AddString('<script type="text/javascript"><!--//--><![CDATA[//><!-- function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != "function") { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } CommentLinks.Init = function() { BaseUrl = \''. $Context->Configuration['BASE_URL'] .'\'; DefaultFormat = \''. $Default .'\'; DiscussionName = document.getElementsByTagName("title")[0].innerHTML.replace(/^.* - /, \'\'); InstalledFormats = Array('. $FormattersCSV .'); MenuTitle= \''. htmlentities($Context->GetDefinition('CommentLinks_Copy')) . '\'; HideMenus(); } AddLoadEvent(CommentLinks.Init); //--><!]]></script>');
  • That last function block is getting munged up a bit... escaping &gt and &quot when it shouldn't:
    CommentLinks.Init = function() { BaseUrl = \''. $Context->Configuration['BASE_URL'] .'\'; DefaultFormat = \''. $Default .'\'; DiscussionName = document.getElementsByTagName("title")[0].innerHTML.replace(/^.* - /, \'\'); InstalledFormats = Array('. $FormattersCSV .'); MenuTitle= \''. htmlentities($Context->GetDefinition('CommentLinks_Copy')) . '\'; HideMenus(); } AddLoadEvent(CommentLinks.Init); //--><!]]></script>');
  • i'm actively working on a new version of geshicolor too.
  • edited July 2007
    YES! its works. but: - variables dont show in higlighted source - Notice: Undefined variable: script1 in /data/web/patrik/sub/forum/extensions/CodePrettify/default.php(46) : regexp code on line 1 - quotes are slashed (i know its security reason but imho its bad way.. use entities or some like)
  • Yay!

    OK, I'm afraid the regexp problem can't be easily fixed until I update the extension in the next day or two, (which also fixes the IE linebreaks) but for those other problems, replace the prettify.js file with this code and see what that does.
  • same error :/
This discussion has been closed.