Hi,

I've a huge problem : Syntax Highlighter didn't detect brush files or available themes (url : admin/config/content/syntaxhighlighter).

See attached screenshoot :
syntaxhighlight no lib ?

First test :

syntaxhighlighter_3.0.83 is not installed and not unziped.

Syntax highlighter js library is reported as "Installed" (url : admin/reports/status ).

But I didn't unzip it.

Second test :

After I've unziped js library in sites/all/libraries/syntaxhighlighter_3.0.83, admin/reports/status always report that Syntax highlighter js library is "Installed".

I've unziped like that :
sites/all/libraries/syntaxhighlighter_3.0.83/scripts/
sites/all/libraries/syntaxhighlighter_3.0.83/styles/

But admin/config/content/syntaxhighlighter show that :
syntaxhighlight no lib ?

Problem :
With or without library, actually I can't use Syntax Highlighter. Why ?

Comments

nothinghere’s picture

I've edited "syntaxhighlighter.admin.inc".

I've changed :
$path = _syntaxhighlighter_get_lib_location();
to :
$path = '/var/www/public_html/sites/all/libraries/syntaxhighlighter_3.0.83';

Now everything work fine.

Why "_syntaxhighlighter_get_lib_location();" didn't return syntaxhighlighter libraries path ?

nothinghere’s picture

StatusFileSize
new1.17 KB

Second problem :

Code isn't highlighted !
See this screenshoot :
no highlight

Below, source code used :

<pre class="brush: php; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag">&lt;?php
phpinfo();
?&gt;</pre>

I need to edit "syntaxhighlighter.module" too, and change

$lib_location = _syntaxhighlighter_get_lib_location();

to

$lib_location = '/var/www/public_html/sites/all/libraries/syntaxhighlighter_3.0.83';

fizk’s picture

Status: Active » Closed (works as designed)

Instead of making any code changes, I think you should have renamed sites/all/libraries/syntaxhighlighter_3.0.83 to sites/all/libraries/syntaxhighlighter

nothinghere’s picture

Status: Closed (works as designed) » Needs review

I've done what you say.

It doesn't work.

How can I display the result of _syntaxhighlighter_get_lib_location(); in admin/reports/status ? (to help to debug this problem)

fizk’s picture

You can try drupal_set_message(print_r(_syntaxhighlighter_get_lib_location(), true));

nothinghere’s picture

StatusFileSize
new31.74 KB
new12.78 KB

I've used :

global $user; if ($user->uid==1) drupal_set_message('<pre>' . print_r(_syntaxhighlighter_get_lib_location(), TRUE) . '</pre>');

First test : with $path = '/var/www/public_html/sites/all/libraries/syntaxhighlighter'; in syntaxhighlighter.admin.inc and syntaxhighlighter.module

I've edited "syntaxhighlighter.admin.inc" as follow :


/**
 * @file
 * Syntax highlighter module admin form
 *
 * Define the admin form
 */

/**
 * An admin form to specify which language to support for highlighting
 */
function syntaxhighlighter_settings_form() {
// delete the variable to force a re-scan of library location just in case
  variable_del('syntaxhighlighter_lib_location');
  #$path = _syntaxhighlighter_get_lib_location();
  $path = '/var/www/public_html/sites/all/libraries/syntaxhighlighter';
#drupal_set_message(print_r(_syntaxhighlighter_get_lib_location(), true));
  if (!$path) {
    drupal_set_message(t('The syntaxhighlighter javascript library is not found. Consult <a href="!readme">README.txt</a> for help on how to install it, then <a href="!reload">reload</a> this page.',
                         array('!readme' => '/' . drupal_get_path('module', 'syntaxhighlighter') . '/README.txt',
                               '!reload' => 'admin/config/content/syntaxhighlighter')),
                         'error');
    return array();
  }
global $user; if ($user->uid==1) drupal_set_message('<pre>' . print_r(_syntaxhighlighter_get_lib_location(), TRUE) . '</pre>');

[...]

Here is what I get on admin/config/content/syntaxhighlighter :
sites/all/libraries/plupload/doc

Second test : with $path = _syntaxhighlighter_get_lib_location(); in syntaxhighlighter.admin.inc and syntaxhighlighter.module

I've edited "syntaxhighlighter.admin.inc" as follow :


/**
 * @file
 * Syntax highlighter module admin form
 *
 * Define the admin form
 */

/**
 * An admin form to specify which language to support for highlighting
 */
function syntaxhighlighter_settings_form() {
// delete the variable to force a re-scan of library location just in case
  variable_del('syntaxhighlighter_lib_location');
  $path = _syntaxhighlighter_get_lib_location();
  #$path = '/var/www/public_html/sites/all/libraries/syntaxhighlighter';
#drupal_set_message(print_r(_syntaxhighlighter_get_lib_location(), true));
  if (!$path) {
    drupal_set_message(t('The syntaxhighlighter javascript library is not found. Consult <a href="!readme">README.txt</a> for help on how to install it, then <a href="!reload">reload</a> this page.',
                         array('!readme' => '/' . drupal_get_path('module', 'syntaxhighlighter') . '/README.txt',
                               '!reload' => 'admin/config/content/syntaxhighlighter')),
                         'error');
    return array();
  }
global $user; if ($user->uid==1) drupal_set_message('<pre>' . print_r(_syntaxhighlighter_get_lib_location(), TRUE) . '</pre>');

[...]

Here is what I get :

same wrong path
There is no language to activate ! :(

Why I have sites/all/libraries/plupload/doc ?
Syntaxhilighter is not compatible with plupload module ? It doesn't find the right path.

fizk’s picture

There's a syntaxhighlighter inside plupload that should be ignored, but there's a typo in syntaxhighlighter.module.

In syntaxhighlighter.module, on line 397, try changing:

foreach (file_scan_directory($d, '/shCore\.js$/', array('nomask' => '/(\.\.?|CVS|src|pupload)$/')) as $filename => $file_info) {

to:

foreach (file_scan_directory($d, '/shCore\.js$/', array('nomask' => '/(\.\.?|CVS|src|plupload)$/')) as $filename => $file_info) {

fizk’s picture

nothinghere’s picture

Should be :
foreach (file_scan_directory($d, '/shCore\.js$/', array('nomask' => '/(\.\.?|CVS|src|pupload|plupload)$/')) as $filename => $file_info) {

nothinghere’s picture

Patch attached.

Here is my first patch for drupal. Hope it works :-)

fizk’s picture

Status: Needs review » Closed (duplicate)

I've become the co-maintainer of this module, so I'll commit your patch and the other patches related to scanning for the syntax highlighter library.

Marking duplicate of #1589140: scan_lib_location finds shCore.js in plupload docs directory.