Extension talk:ASHighlight

Latest comment: 15 years ago by Jdpipe in topic SVN repo down?

SVN repo down? edit

I've been trying to nab this from the SVN repository all day, and haven't been able to load the page. Anyone know of another source to download this? Anderiv 19:51, 18 July 2008 (UTC)Reply

Launchpad maintains a mirror of the ASCEND SVN repository in which the ASHighlight code is stored. See here: http://bazaar.launchpad.net/~vcs-imports/ascend/extfn/files Jdpipe 07:32, 24 March 2009 (UTC)Reply

Fix for MW 11.1.0 edit

This extension gives the following error with Mediawiki 11.1.0

 Detected bug in an extension! Hook ashighlightLoadMessages failed to return a value; 
 should return true to continue hook processing or false to abort.
 
 Backtrace:
            ....

This was fixed by adding a return(TRUE) to the ashighlightLoadMessages function.

Before:

 function ashighlightLoadMessages() {
   static $loaded = false;
   if ( $loaded ) {
       return;
   }
   global $wgMessageCache;
   require_once( dirname( __FILE__ ) . '/ashighlight.i18n.php' );
   foreach( efashighlightMessages() as $lang => $messages )
       $wgMessageCache->addMessages( $messages, $lang );
 }


After:

 function ashighlightLoadMessages() {
   static $loaded = false;
   if ( $loaded ) {
       return;
   }
   global $wgMessageCache;
   require_once( dirname( __FILE__ ) . '/ashighlight.i18n.php' );
   foreach( efashighlightMessages() as $lang => $messages )
       $wgMessageCache->addMessages( $messages, $lang );
   # return(TRUE);
 }

About the fix for MW 11.1.0 edit

Haven't been able to test this, haven't got that version installed. But it looks like the 'after' case above is not quite right: there is a 'return' which should be 'return TRUE' and another one that is commented out. So you'll probably need to play around and see what works.

I have updated the sources in the SVN repository to include 'return TRUE'. Please let me know how it works. Jdpipe 22:46, 12 January 2008 (UTC)Reply

Issue on Windows with Mediawiki 1.9.3 and PHP 5.2.5 edit

I'm trying this extension on a corporate installation of Mediawiki. I installed the windows package for the highlight library, and I modified the ashighlight.class.php file to reference the appropriate language files. The highlight library was installed to c:\WinHighlight (it defaulted to under Program Files, which I thought might be troublesome because of the space in the directory name). I also found a hard-coded temp path, which I changed to C:\Temp. It gives this error:

Process 'highlight --fragment --syntax="php" --style-outfile="C:\Temp/highlight.css"' failed to start?

It then prints out a usage message with an example syntax and a note about which languages are supported. The wikitext I tried was this:


<source lang="php">
<?php

phpinfo();

?>
</source>

The error and usage messages appear within a red-bordered box on the rendered wiki page. Can you share any ideas on what I can do?

Did you check that 'highlight' is in your PATH? Jdpipe 04:14, 29 January 2008 (UTC)Reply
I checked, and it was not. I added it to the path, and verified that I could then execute the highlight program from the command prompt. However, the same error message still appears on the wiki page. I also tried rebooting the host, and it still has the error... -- Thanks, KaJun
PHP is probably using cmd.exe to open processes, and you need to give your MACHINENAME\IUSR_MACHINENAME account access to c:\windows\system32\cmd.exe, or whatever account IIS is using. - Chris

Using Apache2 edit

I got it to work with apache2 for windows. I had to change $cmd='blah' to $cmd="c:\\winhighlight\\highlight.exe"; the hard coded temp dir to c:\\temp and the defined langdefs dir to c:\\winhighlight\\langDefs. After that though it just worked. My apache service is running with a local service account _apache which has power user privileges.

You should also mention that the $cmd is in the ashighlight.class.php file. I have also encountered this problem. - Zach

Aborts PdfBook export - workaround edit

It seems, that the

/*<![CDATA[*/

blocks are canceling the output for pdfbook.


I modified the ashighlight.php file: in function ashighlightFormat change the lines (should be between lines 106 and 112)

 $css = 
     "<style type=\"text/css\">/*<![CDATA[*/\n".$ash->get_stylesheet()."/*]]>*/</style>\n";

to

 global $wgRequest;
 $css = ($wgRequest->getText('format') == "pdfbook" ? "<style type=\"text/css\">/*<![CDATA[*/\n".$ash->get_stylesheet()."/*]]>*/</style>\n" : "");

This simply disables the css-blocks, if and only IF the "pdfbook" format is requested. Please note, that this is rather a workaround, than a (bug) fix, since i see the bug inside of htmldoc (which is used by Extension:Pdf_Book to generate the pdf pages).

Add border like pre edit

It would be good for the source block to have a border like the pre block. Is this possible?

Return to "ASHighlight" page.