Welcome to Geeklog, Anonymous Thursday, October 03 2024 @ 07:01 pm EDT

Geeklog Forums

jquery syntax highlightiing css brush


Status: offline

dwl

Forum User
Junior
Registered: 01/05/11
Posts: 25
I've followed the documentation and steps for implementing the jQuery plugin but can not implement the brush for css. I can successfully implement classes for php and js syntax.

According to the documentation I should be able to activate it with
Text Formatted Code
<code class="css">


On the alex gorbatchev site there is mention of requisite file names for different syntax highlighters but I can not find their location using sh*.js as a filefind parameter.
 Quote

Status: offline

dwl

Forum User
Junior
Registered: 01/05/11
Posts: 25
Nudge.

Does anyone have an answer? If not, I guess I'll have to change blog packages
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hi,

Load the css brush by editing plugins/jquery/functions.php file

Text Formatted Code
// Code highlighter
    if($_JQ_CONF['use_codehighlighter'] == true){
        $strext = '/jquery/codehighlighter/jquery.beautyOfCode.js';
                $_SCRIPTS->setJavaScriptFile('jquery_beautyofcode', $strext);
                $str1 = '    jQuery(document).ready(function() {' . LB;
                $str1 .= '   jQuery.beautyOfCode.init({' . LB;
                $str1 .= '       brushes: ['Xml', 'JScript', 'Css', 'Plain', 'Php'],' . LB;
                $str1 .= '          ready: function() {' . LB;
                $str1 .= '           jQuery.beautyOfCode.beautifyAll();' . LB;
                $str1 .= '       }' . LB;
                $str1 .= '   });' . LB;
                $str1 .= '   });' . LB;
                $_SCRIPTS->setJavaScript($str1, true);
        }


Then use this syntax

Text Formatted Code

<pre><code class="css">

/* SEMANTICS ******************************************************************/

a {
  background:transparent;
}

</code></pre>
 


Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

dwl

Forum User
Junior
Registered: 01/05/11
Posts: 25
Thanks for the effort Ben but it still will not work. I am no longer receiving the error of the brush as unavailable but the styling is not working. The syntax is still coming out as black and white even though I am using:

HTML4STRICT Formatted Code

<pre><code class="css">

/* SEMANTICS ******************************************************************/

a {
  background:transparent;
}

</code></pre>
 


I did a line by line comparison of your block of code and the one already in plugins/jquery/functions.inc (there is no plugins/jquery/functions.php). There were discrepancies. The error I was receiving for css brush not being available is because it was not defined as the syntax below indicates:

Text Formatted Code

//from existing code in function
$str1 .= '        brushes: [\'Xml\', \'JScript\', \'CSharp\', \'Plain\', \'Php\'],' . LB;
 


Unfortunately, with your code none of the brush values was escaped.

Text Formatted Code

//from Ben's solution for function
$str1 .= '       brushes: ['Xml', 'JScript', 'Css', 'Plain', 'Php'],' . LB;
 


If it was intended, then I don't know what the solution is. Loading your code as written, my site would not load. All I had was a blank browser. Doing some debugging of tailing the PHP error log Escaping them or writing the code as
Text Formatted Code

$str1 .= "        brushes: ['Xml', 'JScript', 'css', 'Plain', 'Php']," . LB;
 

did not work either. The site would load but the css syntax in the article I am writing has no highlighting.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hi,

Sorry the file name is functions.inc where I replaced the CSharp by the Css brush but I don't know why none of the brush values was escaped because I pasted the code from the plugin file where they are escape Question

I confirm color hightlighting is working on my testing platform.



Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

dwl

Forum User
Junior
Registered: 01/05/11
Posts: 25
Hi,

As I noticed when writing My post, if you quote code here, you need to double escape with 2 slashes.

As for the "Csharp" vs "css", are you saying "Csharp" is in the code by default as coded by you as plug-in author? The instance of "Csharp" in my quoted post's syntax is from the plug-in as installed from the site, not the block of code you sent to me.

The question now is, why is your version of the plug-in working and mine is not, at least for css syntax?


Quote by: ::Ben

Hi,

Sorry the file name is functions.inc where I replaced the CSharp by the Css brush but I don't know why none of the brush values was escaped because I pasted the code from the plugin file where they are escape Question

I confirm color hightlighting is working on my testing platform.



Ben

 Quote

Status: offline

dwl

Forum User
Junior
Registered: 01/05/11
Posts: 25
Well this is now solved.
  • I removed the plug-in in the back-end
  • deleted the files and directories manually
  • re-installed
  • changed 'Csharp' in the brushes to 'Css' in line 112 of plugins/jquery/functions.inc
  • low and behold it worked
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Good news. I also added a report to the forum tracker.

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 07:01 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content